Jump to content
johnflenaly

Custom Loadout Script - JIP help.

Recommended Posts

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?

Share this post


Link to post
Share on other sites

This sounds similar to my recent issue, check out my recent post. I have an entire team of guys with custom loadouts and I can get 2 of them to spawn and respawn right, but 3-6 don't.

---------- Post added at 16:47 ---------- Previous post was at 16:46 ----------

also what is a JIP or non JIP?

As another used the script and says he can get them all to work on a locally hosted server, but I cannot get it to work on a LAN one with just me and AI.

Share this post


Link to post
Share on other sites

Join in progress, someone who join the mission after it has started. So what I've experienced is any player that starts the mission when the mission starts has no problem and the script works, but JIPs are having issues.

Share this post


Link to post
Share on other sites

HMMMMMM let me ask Kylania to come in, he might be able to help you and see if your progress will fix my issue.

Question, how many units have different loadouts? Ive got 6 guys with 4 different loadouts...

Share this post


Link to post
Share on other sites

17 playable slots using 8 unique loadouts. Some of them call on the same loadout script, example I have two autorifleman, both calling on the autorifleman.sqf.

Share this post


Link to post
Share on other sites

Just don't support JIP. It's a huge pain in the butt. If your friends can't be on time let them deal with default loadouts. :P

Share this post


Link to post
Share on other sites

John can you tell me how you did your loadout sqf files and what you put into each units init line? I think that will help my issue.

Share this post


Link to post
Share on other sites

It might be easier to create new soldiers in an addon with a config.bin/*.pbo, so you can just place them through the mission editor. The drawback is that everyone has to download and install a new addon (it would be really small), but the benefit is that your JIP problem is completely eliminated.

Share this post


Link to post
Share on other sites

what you do is in the initplayerlocal.sqf file launch the scripts, not in the init of the unit.

null = [player] execVM "teamleader.sqf"; player addeventhandler ["respawn","_this execVM 'teamleader.sqf'"];

Share this post


Link to post
Share on other sites

You do not need the

waitUntil {!isNull player}; 

if you don't use the player command. (which you don't since it is in a init line).

Try it without it. I'm using a similar script and it works just fine for JiPs.

Share this post


Link to post
Share on other sites

You do not need the

waitUntil {!isNull player}; 
if you don't use the player command. (which you don't since it is in a init line).

Try it without it. I'm using a similar script and it works just fine for JiPs.

 

 

I know this is a 2 year old post, but i tried to find a reason to use "waitUntil {!isNull player};" if you don't actually use player and "_this" instead. I was really wondering because it doesn't make sense... You wait for "player" to be initialized and then use "_this" anyway(which essentially is "this")... As far as i know "this" is initialized prior to "player".

 

Isn't it like: If i use "player" in my init line i MUST use "waitUntil {!isNull player};" to guarantee it is initialized when executing the script. If not, i can use "this" without bothering checking for initialization.

 

Also, i saw "if(true) exitWith {};". Honestly, that looks like it simply does nothing. Can anyone elaborate how and why this is needed??

Share this post


Link to post
Share on other sites

http://killzonekid.com/arma-scripting-tutorials-basic-multiplayer-coding-v2/

 

Read this post created by killzone kid, really helpful.
 

 

Also, i saw "if(true) exitWith {};". Honestly, that looks like it simply does nothing. Can anyone elaborate how and why this is needed??

 

 

Unnecessary, script will end after the last line even without that.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×