Jump to content
ALPHIVE

How to get same uniform at each respawn ?

Recommended Posts

Hi everybody, 

 

I placed some survivors independant and i want that some of them wear different uniform.

 

Problem : at every respawn, they do not keep the uniforms i placed on them before through Eden Editor

 

So how can i do to make them keep their uniform when respawn ?

 

By advance, thank you guys 😉

Share this post


Link to post
Share on other sites

Hi, i use this to save loadout when a player is killed and respawning.

OnPlayerKilled.sqf

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

And then

OnPlayerRespawn.sqf

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

 

Share this post


Link to post
Share on other sites

But with this command, if the person get a different weapon on the ground, and i respawn, i will keep this different weapon no ?

I mean : if im a survivor, and i get AK, with your command, i will respawn with survivor stuff of with the AK too ?

Share this post


Link to post
Share on other sites
12 minutes ago, ALPHIVE said:

But with this command, if the person get a different weapon on the ground, and i respawn, i will keep this different weapon no ?

I mean : if im a survivor, and i get AK, with your command, i will respawn with survivor stuff of with the AK too ?

Yes correct, but you can put the first code in Initplayerlocal.sqf instead of OnPlayerKilled.sqf if you only want to save the loadout the player start with but then it wont save the new items picked up.

Share this post


Link to post
Share on other sites

Perfect Robust, i will try that 😉

 

So i use only this code (not the other one) :

 

OnPlayerKilled.sqf [player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;

 

And i put in in Initplayerlocal.sqf

 

If i only want to save the loadout the player start with but then it wont save the new items picked up

 

 

Right ? 🙂

Share this post


Link to post
Share on other sites

Yes correct @ALPHIVE

initPlayerLocal.sqf

[player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
OnPlayerRespawn.sqf

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

 

  • Like 2

Share this post


Link to post
Share on other sites
6 hours ago, ALPHIVE said:

This command doesnt work 😕

Yes it does. Make a sqf and name it

InitPlayerLocal in your missionfolder. Put this code inside it

 

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

 

Then make one more sqf and name it OnPlayerRespawn and put this code inside it.

 

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

Share this post


Link to post
Share on other sites
On 10/26/2019 at 1:44 PM, ALPHIVE said:

I placed some survivors independant and i want that some of them wear different uniform.

 

On 10/26/2019 at 4:29 PM, Robustcolor said:

Hi, i use this to save loadout when a player is killed and respawning.

 

Hello there Guys !

 

Is this about players only or for ai as well ?

It's possible to do this with many ways.

Since you are saying about placing units in the editor , ( probably for both players and ai ) ,

then you can use this :

 

place in the init of any unit :

ex:

0 = [this] execVM "GF_Loadout.sqf";

and create an sqf:

GF_Loadout.sqf

_unit = _this select 0;


_unit addEventHandler ["Killed", {
	params ["_unit", "_killer", "_instigator", "_useEffects"];	
	[_unit, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory;
}];


_unit addEventHandler ["Respawn", {
	params ["_unit", "_corpse"];
	[_unit, [missionNamespace, "inventory_var"]] call BIS_fnc_loadInventory;
}];

 

and this way it will keep the current loadout every time that the unit is killed.

Share this post


Link to post
Share on other sites

Hi Georges, but with this system, it keeps the initial stuff (at spawn) ? or it keeps the stuff aquired when the person is killed ?

Share this post


Link to post
Share on other sites
On 10/27/2019 at 11:15 PM, GEORGE FLOROS GR said:

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

 

This way it will keep the current inventory when you are killed and also the loadout that you have placed in the editor , if this will not be changed.

If you want to have a certain loadout , you can export the loadout and add this code in the :

On 10/27/2019 at 11:15 PM, GEORGE FLOROS GR said:

_unit addEventHandler ["Respawn", {

 

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

×