Jump to content
Sign in to follow this  
Arcurus

Added Action Disappears After Respawning in Multiplayer

Recommended Posts

Searched around, but couldn't find an answer to my problem.

I'm trying to add and action to the Action Menu for a multiplayer game to check the a variable and then tell the player what it is. The action gets the variable, but after a player dies and respawns they no longer have the action on their action menu.

In my init.sqf I have the line

player addAction["Check Thirst", "Survival_Mechanics\thirstStatus.sqf", [], 1, false, false, "", ""];

And that goes to thirstStatus.sqf:

if (not((_this select 0)==player)) exitwith {};


sleep .5;
Stxt = parseText format
["<t size='1.5'><t color='#99D5FF'>Thirst is at </t><t color='#99D5FF'>%1</t><br/><br/>", thirst];
hintSilent Stxt; 

I suspect that the problem lies in with how I added the addAction command moreso than the thirstStatus file. I just don't know how to get it implemented properly.

Share this post


Link to post
Share on other sites

An action pertains only to the unit to which it was added. A respawned unit is not the same as the dead one.

Share this post


Link to post
Share on other sites

So how then would I go about getting it applied to any new unit created that is a player?

Share this post


Link to post
Share on other sites
CheckThirstAction = player addAction["Check Thirst", "Survival_Mechanics\thirstStatus.sqf", [], 1, false, false, "", ""];

player addEventHandler ["killed",{
[] spawn {
	player removeAction CheckThirstAction;
	WaitUntil{alive player};
	CheckThirstAction = player addAction["Check Thirst", "Survival_Mechanics\thirstStatus.sqf", [], 1, false, false, "", ""];
};
}];

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  

×