Jump to content
Sign in to follow this  
kilo1-1

Virtual Arsenal loadouts not working correctly

Recommended Posts

Hello,

I am having a few issues where loadouts that I exported from Virtual Arsenal aren't working properly on my dedicated server. When a player JIP, certain items such as medkits, FAKs, and smoke grenades are duplicated. Are there any workarounds that I can implement to make it so when a player JIP that my loadouts don't get duplicated?

Share this post


Link to post
Share on other sites

Any ideas? I tried if(!isServer) and while that works, if anyone comes in as JIP, they don't get the virtual arsenal loadout. Instead, they get the standard loadout of what unit I am trying to replace.

Share this post


Link to post
Share on other sites

Try putting this at the top of your init.sqf:

waitUntil {(!isNull player && time > 0)}; 

Share this post


Link to post
Share on other sites
Try putting this at the top of your init.sqf:

waitUntil {(!isNull player && time > 0)}; 

After banging my head against the wall trying to figure this out, I have shelved this issue. Now I am bringing it up again.

Thanks for the suggestion, JShock. That semi-works. With that, it seems whenever someone changes uniform or vest and someone else JIPs, the person with the different equipment changes back to the original loadout. Other than that, it seems to work fine. Here is what I am looking for specifically.

So my missions have custom loadouts from virtual arsenal with the loadouts copied and pasted into each unit init in the editor. These missions are run on a dedicated server. What I want is whenever a player joins on that loadout, it loads the custom loadout and that's it. I don't want it to execute on players who are already in the game, I just want it to exec when players join their slot.

Now here is where I am banging my head against the wall with the whole dedicated server and JIP thing. From my understanding waitUntil {!isNull player}; won't work on dedicated server because player is always null? What would be used instead?

Share this post


Link to post
Share on other sites

You have to check for locality. If the unit is local, run the script...

What is happening, is those init boxes are being run once again on the JIPs machine when they enter the game.

if (local this) then {
// run scripts.
};

or

if (local _this) then {
// run scripts
};

Share this post


Link to post
Share on other sites

With time comes knowledge and seeing how this was almost 5 months ago, create a file named initPlayerLocal.sqf, then add the waitUnitil {time > 0} line just for assurances, then run your code that checks for the player's classname, then runs loadout code based on that class.

Edited by JShock

Share this post


Link to post
Share on other sites

Thank you so much, Fight9! This fixed everything! And thank you JShock with the initPlayerLocal.sqf tip.

Just to help me further understand this whole JIP and locality thing, would this ifLocal have the same effect as this?

WITHIN UNIT INIT
if (isServer) then {  
//loadout code here 
};

When I was searching around to find threads with dedicated servers and loadout script issues, it seems ifLocal is never used where it seems it would fix lots of problems with JIP issues. Is this a new method for JIP proofing things? Lastly, while I haven't tried this method yet, would this have the same effect that I am looking for in regards to no JIP issues?

 WITHIN UNIT INIT 
if (!isDedicated && isNull player) then { waitUntil {!isNull player}; }; 
// Loadout code here

Share this post


Link to post
Share on other sites
Is this a new method for JIP proofing things?

It isn't new, I believe it's been around for a while, just not many get into the world of scripting enough have to worry about locality, much less understand it.

But the initPlayerLocal.sqf (which is new in A3) is the fix that most end up using because it includes all these locality/JIP checks natively, so it makes life on the coder way easier :).

https://community.bistudio.com/wiki/Event_Scripts

Edited by JShock

Share this post


Link to post
Share on other sites
KillZoneKid wrote a great guide for multiplayer scripting for this.

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

Yeah I read that and utilized what he did with the if (!isServer) exitWith {}; method. It was very helpful and descriptive. However, while it worked in not duplicating gear whenever someone JIP, they never got the custom loadout that they were assigned within their init.

When I did it, it looked like the following. Maybe I did something wrong?

if (!isServer) exitWith {};
//virtual arsenal loadout here

Share this post


Link to post
Share on other sites

He suggest to also try:

if (!local this) exitWith {};

Another thing, I can suggest is to put the loadout into an own sqf file. For example:

[color="#FF8040"][color="#1874CD"]_unit[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color]

[color="#191970"][b]removeAllWeapons[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeAllItems[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeAllAssignedItems[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeUniform[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeVest[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeBackpack[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeHeadgear[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]removeGoggles[/b][/color] [color="#1874CD"]_unit[/color][color="#8B3E2F"][b];[/b][/color]

[color="#1874CD"]_unit[/color] [color="#191970"][b]forceAddUniform[/b][/color] [color="#7A7A7A"]"U_B_GhillieSuit"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]10[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_Bandage"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]4[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_Morphine"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_MapTools"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]4[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_Epipen"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_Bloodbag"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_ItemKestrel"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToUniform[/b][/color] [color="#7A7A7A"]"AGM_EarBuds"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addVest[/b][/color] [color="#7A7A7A"]"rhsusf_iotv_ocp_Rifleman"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]5[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToVest[/b][/color] [color="#7A7A7A"]"9Rnd_45ACP_Mag"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_i"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]1[/color] [color="#191970"][b]to[/b][/color] [color="#FF0000"]4[/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_unit[/color] [color="#191970"][b]addItemToVest[/b][/color] [color="#7A7A7A"]"7Rnd_408_Mag"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addHeadgear[/b][/color] [color="#7A7A7A"]"rhsusf_ach_helmet_ESS_ocp"[/color][color="#8B3E2F"][b];[/b][/color]

[color="#1874CD"]_unit[/color] [color="#191970"][b]addWeapon[/b][/color] [color="#7A7A7A"]"srifle_LRR_camo_F"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addPrimaryWeaponItem[/b][/color] [color="#7A7A7A"]"optic_LRPS"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addWeapon[/b][/color] [color="#7A7A7A"]"hgun_ACPC2_F"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]addHandgunItem[/b][/color] [color="#7A7A7A"]"muzzle_snds_acp"[/color][color="#8B3E2F"][b];[/b][/color]

[color="#1874CD"]_unit[/color] [color="#191970"][b]linkItem[/b][/color] [color="#7A7A7A"]"ItemMap"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]linkItem[/b][/color] [color="#7A7A7A"]"ItemCompass"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]linkItem[/b][/color] [color="#7A7A7A"]"ItemWatch"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]linkItem[/b][/color] [color="#7A7A7A"]"ItemRadio"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_unit[/color] [color="#191970"][b]linkItem[/b][/color] [color="#7A7A7A"]"rhsusf_ANPVS_14"[/color][color="#8B3E2F"][b];[/b][/color]
[/color]

Made with KK's SQF to BBCode Converter

And the the following line intro the init of the unit

[color="#FF8040"][color="#8B3E2F"][b][[/b][/color]this[color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"loadout.sqf"[/color][color="#8B3E2F"][b];[/b][/color][/color]

Made with KK's SQF to BBCode Converter

This always worked for me, I actually never had problems with duplicated items trough JIP players.

Edited by R3vo

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
Sign in to follow this  

×