Jump to content
aeroson

GET/SET Loadout (saves and loads pretty much everything)

Recommended Posts

@KadinX: That is one of the reasons why revive systems use: player addEventHandle["HandleDamage",{ save loadout here }]; You wont notice the "weapon jump" if you die within split second afterwards, or it can get you killed in certain situations.

@Watarimono: Did you update set/get loadout functions that are inside the INS revive or are you using them to handle "loadout respawn" yourself ?

Share this post


Link to post
Share on other sites

I think my problem is that I know too little of scripting...

I'm using a stripped down version (made by tgb) of naong's INS revive script which includes your get/set scripts. The original INS includes a whole lot more than just revive/respawn which I didn't want, that's why I tried the stripped down version. In making the stripped version tgb also updated it with the latest versions of you scripts.

That's the whole story...

So everything works except those items that i listed earlier (map, gps, watch, radio, compass) disappears upon respawn/revive.

Share this post


Link to post
Share on other sites

@aeroson, the addEventHandler you mention did not used to work. Has it been fixed or adjusted to allow enough time for the save?

Edited by KadinX

Share this post


Link to post
Share on other sites

@Aeroson, it seems the weapon attachement and the weapon fire mode are now switching back to default again, each time you get loadout on your unit.

Share this post


Link to post
Share on other sites

@Watarimono: Sorry unable reproduce, it seemed to work all good for me, give me server name or send me your mission file.

@KadinX: Yes it works, all revive systems has been using it for a while.

player addEventHandler["HandleDamage",{
loadout=[player,["ammo"]] call getLoadout;
(_this select 2)
}]; 

@L etranger: Sorry :( unable to reproduce, tested on mk18 abr. I directly used the latest functions though, there might be some issues with the loadout mannager (saved loadouts), i didn't test the backwards compatibility.

Share this post


Link to post
Share on other sites

hi,

we try to start a Mod Server with classic Weapons. So we use the Manager. The Problem is, the Player can load a old setup from orginal A3 Weapons.

How i can reset the saves for the Players in our Mod Missions ? Which Variable we must change/switch ?

And a second Quastion is, how i can turn off the load VAS Loadout Option in the Manager ?

thx in advance

Thunder

solved :yay:

Edited by [J4F]Thunder666

Share this post


Link to post
Share on other sites

@aeroson, thanks and thanks for the code, I was using select 0 instead of player. It works. I do have a little problem not saving gear correctly and adding a few watches in my kit but I am looking into it.

Share this post


Link to post
Share on other sites

Have an issue, we loose items with new patch arma...

issue is when you have a tube on your back but only with a full one.

i figured it out with this modification in get-loadout

// get magazines of all assigned items
_magazines = [];
_weapons = weapons _target;
{
_target selectWeapon _x;
_magazine = currentMagazine _target;
if(_magazine != "") then {
	_magazines set[count _magazines, _magazine];
};
} forEach _weapons;

Edited by Mariodu62
figured it out...

Share this post


Link to post
Share on other sites

@[J4F]Thunder666:

Updated loadout_manager.sqf

All the loadouts are saved in profile variable called aero_loadout, now you can easily change it:

Open up loadout_manager.sqf and look for lines 22 and 23

line 22: #define SHOW_MENU_FOR [#save,#load,#remove,#vas]

line 23: #define PROFILE_VAR_NAME aero_loadout

In your case you want to remove VAS so you would remove it from the array.

So line 22 would look like this: #define SHOW_MENU_FOR [#save,#load,#remove]

And to have completely different save/load loadouts you need to change the profile variable name.

So line 23 would look like this: #define PROFILE_VAR_NAME j4f_custom_loadout

@KadinX and @Mariodu62: Thank you for reporting bugs. Unfortunately there is not much i can do if i can't reproduce it. It would be best if you could give me exact recipe on how to replicate the bug. Although everytime iam trying to reproduce what you have described i usually find and fix something different. ^.^

updated get_loadout.sqf v3.3

- Fixed: assigned items magazines are saved only if you can select it

Share this post


Link to post
Share on other sites

Thanks aeroson, I have not been more descriptive only because I need to eliminate user's(me) error first. :). Let me try the new loadout manager and then I will report back. Thanks for your consideration.

---------- Post added at 05:38 PM ---------- Previous post was at 05:17 PM ----------

I am afraid I cannot check it properly because I am getting this error

Error in expression <Mode _target;
_isFlashlightOn = _target isFlashlightOn _currentWeapon;
_isIRLase>
 Error position: <isFlashlightOn _currentWeapon;
_isIRLase>
 Error isflashlighton: Type Number, expected String
File mpmissions\__cur_mp.Stratis\scripts\loadout_manager.sqf, line 58

If I am the only one then it is probably me :( on this one.

Share this post


Link to post
Share on other sites

KadinX, you might have placed contents of get_loadout.sqf into loadout_manager.sqf

Share this post


Link to post
Share on other sites

Let me redo the three files copying from the site...

---------- Post added at 06:34 PM ---------- Previous post was at 06:13 PM ----------

YES I DID like an idiot...My apologies for wasting your energy...but I do thank you because everything is working just fine now, including the previous issue. :)

I do have two questions.

1. I have all three files under ...MissionName.stratis\scripts\ and I have the fnc_get_loadout and fnc_set_loadout files compiled properly in init.sfq. In your new loadout_manager.sqf you have these three lines:

]#define FUNC_getLoadout getLoadout
#define FUNC_setLoadout setLoadout

#define PATH_ME QUOTE(scripts\loadout_manager.sqf)

Obviously I changed the last line but Is there any change of path on the two lines above?

2. I am using the latest VAS 2.0. Should I use your fn_loadGear.sqf file with it?

Share this post


Link to post
Share on other sites

Has anyone had any success getting the player save to work with GoT Wasteland?

Share this post


Link to post
Share on other sites

One question I haven't seen that icon before for a text editor maybe ask what you use?

Share this post


Link to post
Share on other sites

Any plans to update this awesome script? There is one strange thing that all throwable items are not accessible after a run of get-loadout and set-loadout executions. Grenades, smoke grenades become inaccessible although they are in inventory. One must put these throwables on the ground and then pick it up again to be able to use them.

Thank you.

Share this post


Link to post
Share on other sites

My apologies for not answering sooner.

@madbull: Ive tested those, they dont exactly work corectly.

@Fusion13: That is a pspad, if you are looking for a new text editor go for sublime

@tgb: That is a very common bug. It happens only on certain soldier classes though.

Share this post


Link to post
Share on other sites

Working great overall, but i got one question. In my coop misison for 6 players only 2 real players partipicate, the other 4 is AI. AI does not spawn with the same loadout. Should they do it with that script & if not, is it possible to do so?

Share this post


Link to post
Share on other sites

@KingoftheSandbox: I didn't test it with ai, but my guess is it will work. The ai needs to be local on the computer that is setting its loadout.

Share this post


Link to post
Share on other sites

Thanks aeroson for your functions. We use it all the time as the main loading out script at mission start.

I've noticed one potential bug; If you choose to equip the target with no headgear, then after the function has run, they will have the default headgear for their class. I haven't tested what happens if you give them different headgear, then no headgear, but this error started happening around September.

There may also be another bug where a similar thing happens to NV goggles, except they are added every 5 seconds if the unit doesnt already have them, but I need to test that more carefully to see if its actually your script that is causing it and if i'm using it properly.

Share this post


Link to post
Share on other sites

Hi, I'm pretty clueless at this stuff, and I have a problem. I got the scripts working great - I have a box with VAS presets in case VAS won't load for some players (which seems to happen regularly). I've got the respawn with previous gear and ammo working - but I have a problem: Every time the script cycles through the [] spawn bit the game, for the player, hiccups. The weapon sometimes jumps, the ammo count flickers, sometimes you lose your stride and can't walk (that was the case until I upped the cycle to 5 seconds).

It could be some conflict with Xmed, I suppose... and yes. Testing shows this is the case. Damn. I really like Xmed and I really like having troops respawn without having to mess with VAS.

Share this post


Link to post
Share on other sites
Hi, I'm pretty clueless at this stuff, and I have a problem. I got the scripts working great - I have a box with VAS presets in case VAS won't load for some players (which seems to happen regularly). I've got the respawn with previous gear and ammo working - but I have a problem: Every time the script cycles through the [] spawn bit the game, for the player, hiccups. The weapon sometimes jumps, the ammo count flickers, sometimes you lose your stride and can't walk (that was the case until I upped the cycle to 5 seconds).

It could be some conflict with Xmed, I suppose... and yes. Testing shows this is the case. Damn. I really like Xmed and I really like having troops respawn without having to mess with VAS.

Having the same problem + ir lasers turning off every time the script cycles.

Share this post


Link to post
Share on other sites

Great idea, but right now when using it seems to make the character instantly swap to secondary weapons then back to main in a flinch motion like mentioned above. The flinch also interrupts all animations and actions like scoping and so forth.

Fix this and would be perfect, at 2 seconds like default it is really annoying, I'm not going to raise it either because i just can't have something like that interrupting someone fast-roping, scoping or reviving.

Have removed it until fixed.

Edited by PenguinInATuxedo

Share this post


Link to post
Share on other sites

Updated / Fixed

get_loadout.sqf v3.4

- Added: "repetitve" option flag, will not use selectWeapon, means no visible effect on solder, but will not save magazines of assigned items such as laser designator batteries

- Added: weapons magazines are now saved using the new magazinesAmmoFull command

set_loadout.sqf v4.2

- Fixed: Goggles and headgear are now removed before adding assigned items

@Phoenix_ZA: Thank you, goggles and headgear are now removed when setting loadout. Though i found no problems involving NV goggles.

@TinyPirate, @goldenfiver, @PenguinInATuxedo:

All this flickering/ir laser turning off was caused by quick selectWeapon in order to get current magazine and ammo count of weapons and assigned items. The script is now using magazinesAmmoFull, unfortunately magazinesAmmoFull does not return magazines from laser designator, so we still have to use selectWeapon for assigned items. That's why i've added the "repetitive" options flag, use it and you wont't notice any kind of flickering/animation interrupting, though the drawback is magazines of assigned items won't be saved.

@TinyPirate: I believe VAS has a Load on respawn feature. But you are right, VAS might reload the loadout and Xmed might be replacing it with it's own loadout right after it. Anyway, you should be able to delay the VAS loadout loading or mine setLoadout a bit.

// Load saved loadout on respawn
player addEventHandler ["Respawn", {
	sleep 2; // All other scripts might set loadout in this time, thus making the following setLoadout final
	[player,loadout] spawn setLoadout;
   }
];  

Edited by aeroson

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

×