Adding player action

delpi

Well-Known Member
I added an action to certain players. I''m having an odd glitch that I haven't been able to track down.

The ability seems to randomly dissapear. Something is removing all the actions from the player in a place other than fn-selfAction.

To get around it, I just set a timer system that removes mine and marks it removes every so often so that it will autocheck again if it needs to be added.


Anyone got a more gracefull solution?
 
Anyone got suggestions on the right way. I duplicated the way others did things like self bloodbag, but I'm worries there is some reset page or such where you need to add yours to the list.
 
To explain more. I've added the action.

Then it randomly goes away without my setting it.

I assume the player action get reset?
 
I am not a good 'splainer. I am sure this doesn't make the sense that it should. But basically, check to make sure you are setting the action handle to -1 just like the rest of them. Actions are only removed in the selfactions file, at the addaction block itself and at the bottom of the file in the else clause
its kind of counter-intuitive, but they must be removed if you want them displayed otherwise the script assumes that it is already being displayed.
I would say that if your actions are getting removed then there is an error in the actual addaction block. Below you wont get the action of s_player_boil is not set to less than zero ... So if your player action is never set to -1, then it wont show up in the actions menu the next frame because it only shows actions that are -1.
Code:
    // Boil water
    if (_player_boil) then {
        if (s_player_boil < 0) then {
            s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_boil;
      //if S_PLAYER_BOIL is not set to -1 then it will not be displayed again even though we have removed the action above.
         s_player_boil = -1;
    };
dont forget that all the actions are defined and initialized to -1 in the variables.sqf file.

and of course you need to have the actions removed in the else clause towards the bottom also.
 
Last edited:
I'll have to look at again.

I set it up just like you described, but it would Get removed and the value would still be greater than 1 so it wouldn't get added again.


To fix it, I put something at the end of the file to remove it every so often and that enables it to reset.

I must have an error I missed. When I get home, I'll post it.
 
Back
Top