Announcement

Collapse
No announcement yet.

Custom Loadout Script - JIP help.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Loadout Script - JIP help.

    So need some help. I have a custom loadout script for every unit in my mission.

    Example:

    teamleader.sqf
    waitUntil {!isNull player};
    _unit = _this select 0;
    removeallweapons _unit;
    removeallassigneditems _unit;
    removeallcontainers _unit;

    _unit adduniform "U_I_OfficerUniform";
    _unit addbackpack "B_AssaultPack_rgr";
    _unit addvest "V_PlateCarrierIA2_dgtl";
    _unit addheadgear "H_HelmetIA";

    _unit addmagazines ["30Rnd_556x45_STANAG", 13];
    _unit addmagazines ["1Rnd_HE_Grenade_shell", 9];
    _unit addmagazines ["smokeshell", 4];
    _unit addmagazines ["handgrenade", 4];

    _unit addweapon "arifle_TRG21_GL_F";

    _unit additem "FirstAidKit";
    _unit additem "FirstAidKit";

    _unit additem "ItemCompass";
    _unit additem "itemmap";
    _unit additem "itemradio";
    _unit additem "itemwatch";
    _unit assignitem "itemcompass";
    _unit assignitem "itemmap";
    _unit assignitem "itemradio";
    _unit assignitem "itemwatch";

    if(true) exitWith{};
    In the editor in the units init line I've placed this.

    null = [this] execVM "teamleader.sqf"; this addeventhandler ["respawn","_this execVM 'teamleader.sqf'"];
    Now the script is suppose to spawn the unit in with the above loadout. Also upon respawn, it should spawn in with the above loadout. Doesn't matter how many mags you use or what you pick up, I want the player to spawn with the above loadout.

    After testing on a live server I've found that a non-JIP player has no problems. Spawns with the correct loadout, also respawns with the correct loadout. After testing with JIPs though, the player initial spawned in with some of the above loadout, and after respawning seems to have defaulted back to the default unit loadout. Any ideas what is going wrong?

  • #2
    Hey man,
    im not a good scripter but if you post that to the mission dev. Subforum im pretty sure someone will be able to help you out. We got some pretty good scripter here.

    Cheers
    sigpic


    Dont be shy, add me on Steam by clicking the icon below.



    Comment


    • #3
      Re: Custom Loadout Script - JIP help.

      What if you add this to your teamLeader.sqf....

      Code:
      null = _unit addeventhandler ["respawn","_this execVM 'teamleader.sqf'"];
      It's just a stab in the dark as it seems to me it should be exactly the same either way. Do you have a revive script running? This might be adding a variable into the equasion.

      I'm moving this to the Mission Development forum.
      |TG-189th| Unkl
      ArmA 3 Game Officer
      Dean of Tactical Gamer University
      189th Infantry Brigade Member
      SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
      "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

      Comment


      • #4
        Re: Custom Loadout Script - JIP help.

        Originally posted by Unkl View Post
        What if you add this to your teamLeader.sqf....

        Code:
        null = _unit addeventhandler ["respawn","_this execVM 'teamleader.sqf'"];
        It's just a stab in the dark as it seems to me it should be exactly the same either way. Do you have a revive script running? This might be adding a variable into the equasion.

        I'm moving this to the Mission Development forum.
        Didn't see that I had put it in the general forum :(. I'll try that out and see what happens. Not running any sort of revive script.

        Comment


        • #5
          Re: Custom Loadout Script - JIP help.

          I try to avoid using the Init box in the editor as much as possible. It just isn't consistent enough for me to use.

          That being said, there is a order at which things are executed on the client. An order of operations if you will. This sounds like a problem on that front. I would look up the order at which files process on a regular player vs a JIP, and see how it may affect your event handler.

          Also, try "MPRespawn" instead of "respawn".

          I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

          Comment


          • #6
            Re: Custom Loadout Script - JIP help.

            maybe try
            Code:
            null = (_this select 0) addeventhandler ["respawn","(_this select 0) execVM 'teamleader.sqf'"];
            Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

            Comment


            • #7
              Re: Custom Loadout Script - JIP help.

              what Yink said. A unit respawn function returns an array of two objects. One of them is your old body and the other one is the new body. _this is the array.

              _this select 0 means you want to access the first compartment of this array. Meaning the new body. (not sure)
              _this select 1 means you want to access the second compartment of this array. Meaning the old body. (not sure)

              I remember the similar applies when a vehicle respawns, and I wanted to add custom gear into it upon respawn.

              Comment


              • #8
                Re: Custom Loadout Script - JIP help.

                Definitely MPRespawn though!
                |TG-189th| Unkl
                ArmA 3 Game Officer
                Dean of Tactical Gamer University
                189th Infantry Brigade Member
                SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN
                "We quickly advance in the opposite direction and take cover in a house on the SW side of town." - BadStache

                Comment

                Connect

                Collapse

                TeamSpeak 3 Server

                Collapse

                Advertisement

                Collapse

                Twitter Feed

                Collapse

                Working...
                X