Jump to content
jakes

Eden - Retain custom spawn loadouts after respawn

Recommended Posts

Great addition for Arma 3 is the feature to customize your unit, via Eden,  with exactly the gear you want the payer  to start with.....only problem is as soon as the player respawn the gear goes back to default loadout. What is the point of a custom load out if you lose it after respawn? Am i missing something , PLZ tell me there is a way to make it so player retain there custom loudouts for multiplayer games. Thx in advance

  • Like 1

Share this post


Link to post
Share on other sites

Hm... it´s the way like it was before. You were able to customize units with a script in the init box but after respawn they got the standard gear from the unit.

 

The only change right now is that you customize your unit with just a few clicks. I don´t know if the behaviour you (and probably most others as well) would like to have is just an ordinary button "Keep customized gear after respawn" and some lines of additional code or a big deal with lots of changes needed to accomplish.

Share this post


Link to post
Share on other sites

Hm... it´s the way like it was before. You were able to customize units with a script in the init box but after respawn they got the standard gear from the unit.

 

The only change right now is that you customize your unit with just a few clicks. I don´t know if the behaviour you (and probably most others as well) would like to have is just an ordinary button "Keep customized gear after respawn" and some lines of additional code or a big deal with lots of changes needed to accomplish.

 

It is, adding an extra checkbox which enables gear saving is done in few minutes. However, it would require a mod. You can still do it the old way for now.

 

create two files in your mission root

 

onPlayerRespawn.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

onPlayerKilled.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
  • Like 2

Share this post


Link to post
Share on other sites

It is, adding an extra checkbox which enables gear saving is done in few minutes. However, it would require a mod. You can still do it the old way for now.

create two files in your mission root

onPlayerRespawn.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;
onPlayerKilled.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
Does missionNamespace literally mean the name of the mission? So replace it with Takistan_Mission.Takistan for example or is it literally what you posted for all missions regardless of map or name?

Share this post


Link to post
Share on other sites

Nope, you don't need to change that.

  • Like 1

Share this post


Link to post
Share on other sites

 

It is, adding an extra checkbox which enables gear saving is done in few minutes. However, it would require a mod. You can still do it the old way for now.

 

create two files in your mission root

 

onPlayerRespawn.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

onPlayerKilled.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

 

Is that really all that's needed to retain our virtual arsenal loadouts after revive/death/respawn? By the beard of Zeus, if this works.....

 

For SP and MP?

  • Like 1

Share this post


Link to post
Share on other sites

Is that really all that's needed to retain our virtual arsenal loadouts after revive/death/respawn? By the beard of Zeus, if this works.....

 

For SP and MP?

Try it and let us know! I didn't have a chance yesterday.

Share this post


Link to post
Share on other sites

I quickly tested as well with several different arsenal loadouts and multiple respawns. Seems to be working. Haven't tested it with revive yet though - my Arma buddies are at work. Also, it seems to revert to your current loadout at the time of your death, i.e. if you used all but 1 magazine for your MX, you'll spawn with only 1 mag. Same for rockets/missiles, pistol mags, etc. I'm sure this follows for all equipped gear, but I only spent a quick few mins with it.

 

Many thanks to R3vo.

Share this post


Link to post
Share on other sites

Ooooh inserting, thx all will be testing it today   :)

Share this post


Link to post
Share on other sites

 

It is, adding an extra checkbox which enables gear saving is done in few minutes. However, it would require a mod. You can still do it the old way for now.

 

create two files in your mission root

 

onPlayerRespawn.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;

onPlayerKilled.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

 

THANK YOU R2vo, works like a charm just a pity it doesn't save original ammo amount but that's a small gripe. Thx again

Share this post


Link to post
Share on other sites

THANK YOU R2vo, works like a charm just a pity it doesn't save original ammo amount but that's a small gripe. Thx again

 

 that because its saving your inventory when you  are killed  

 

if you depleted your bullits lost all your grenades emptyed your backpack that will be the state its saving while you'r being killed

try to save with a trigger when you leave the first initial spawn locaction

Share this post


Link to post
Share on other sites

Or use an event handler to sense when the VA is closed, and save the inventory to missionnamespace then

Share this post


Link to post
Share on other sites

OK I think I'm too noob to understand this. 

 

I created both SQF files as explained with the code copied and pasted, but when I load in my mission I get a error BIS_fnc_loadInventory Inventory "inventory_var" Not Found. 

 

Any ideas? 

Share this post


Link to post
Share on other sites

Hey guys I created those 2 .sqf files and put them in my mission directory and the player still respawns with a standard loadout.

 

Is there another step I'm missing to get it to work? ie a trigger or something?

Share this post


Link to post
Share on other sites

Put this in your init.sqf:

if (hasInterface) then {
    [] spawn {
        waitUntil {alive player};
        player setVariable ["loadout",getUnitLoadout player,false];
        player addEventHandler ["Respawn", {
            player setUnitLoadout (player getVariable "loadout");
        }];
    };
};

That should keep reseting the player to his initial loadout whenever he respawns.

  • Like 1

Share this post


Link to post
Share on other sites

Put this in your init.sqf:

if (hasInterface) then {
    [] spawn {
        waitUntil {alive player};
        player setVariable ["loadout",getUnitLoadout player,false];
        player addEventHandler ["Respawn", {
            player setUnitLoadout (player getVariable "loadout");
        }];
    };
};

That should keep reseting the player to his initial loadout whenever he respawns.

 

 

Hi Tajin,

 

Did that and it didn't work. Player still respawns with default BIS loadout. Is that script multiplayer compatible?

Share this post


Link to post
Share on other sites
On 9/27/2016 at 9:47 PM, -ami- mofo said:

Hey guys I created those 2 .sqf files and put them in my mission directory and the player still respawns with a standard loadout.

 

Is there another step I'm missing to get it to work? ie a trigger or something?

 

Add this into the init for those 2 files;

 

execVM"onPlayerKilled.sqf";
execVM"onPlayerRespawn.sqf";

Share this post


Link to post
Share on other sites

I have  new problem related to these two script. It works but when my character respawns it has seemed to have lost its given unit id or name/variable. How do I save this and add it to the new spawned unit?

 

I need to do this so my addaction scripts will show again after respawning. Usually this works with how i have my scripts set up already but since i wanted to retain the custom loadouts im now using the two scripts suggested in this thread. But i think its reseting the units name/variable back to default. I am sure there is a line i can add in the respawn script to add back the unit name? 

Share this post


Link to post
Share on other sites

Hey daza I'm fine now thanks mate, I use Arma's revive together with a bit of scripting that keeps us in revive mode for 5mins. Plenty of time to get revived and if not it's dead/mission failed.

Share this post


Link to post
Share on other sites
On 27/09/2016 at 3:19 PM, Tajin said:

Put this in your init.sqf:


if (hasInterface) then {
    [] spawn {
        waitUntil {alive player};
        player setVariable ["loadout",getUnitLoadout player,false];
        player addEventHandler ["Respawn", {
            player setUnitLoadout (player getVariable "loadout");
        }];
    };
};

That should keep reseting the player to his initial loadout whenever he respawns.

Nice thx, I can confirm this work by just pasting it into the mission init box in eden. In eden - Attributes - General - copy and paste this code into the init text box area. No need for an init.sqf for a very basic mission. Now its coded into the mission init.

 

edit: Caution - may conflicts happen if you have "Some code in the mission init of eden" and "Possible conflicting code in the init.sqf". Is this traceable or does one supersede the other? Debug Tips if so for future mistakes i will make.

Edited by ElPablo
Extra intel
  • Like 2

Share this post


Link to post
Share on other sites

Is it possible to make this work with vehicles with custom loadouts as well? That's the issue I'm trying to figure out at the moment, retain vehicle custom inventories on vehicle respawn...

  • Like 2

Share this post


Link to post
Share on other sites
On 5/12/2017 at 5:04 AM, fathersarge said:

Is it possible to make this work with vehicles with custom loadouts as well? That's the issue I'm trying to figure out at the moment, retain vehicle custom inventories on vehicle respawn...

 

 

Plus 1

Share this post


Link to post
Share on other sites
On 6/18/2017 at 7:15 PM, Targ35 said:

 

 

Plus 1

 

Here you go!

 

Be careful with it, I have a feeling it won't run very well with a ton of stuff on the map because it constantly checks if the vehicle is alive or not. A friend of mine is trying to get it to work with event handlers so it is more optimized but it works great!

Share this post


Link to post
Share on other sites
On 23/12/2016 at 10:30 PM, daza said:

 

Add this into the init for those 2 files;

 

execVM"onPlayerKilled.sqf";
execVM"onPlayerRespawn.sqf";

 init of what? The unit I want the loadout to be kept? Or on the files themselves?

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

×