Jump to content
palatine

Action Menu keep adding (noob script)

Recommended Posts

Hi, sorry for noob scripting question, I tried to make an Action Menu that disable Fatigue for whole squad, however it doesn't work, the menu become double triple and so on every time I clicked.

 

 

Init.sqf :

--------------------------

 

_FatigueX = 1;
_FatigueAction = player addAction ["Disable Fatigue", "scripts\fatigue_onoff.sqf", _FatigueX];
 
and,
 
Fatigue_onoff.sqf :
-------------------------
 
private ["_obj","_caller","_id","_params"];
 
_obj = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_params = _this select 3;
 
if ( _params == 1 ) then 
{
{ _x enableFatigue false; } forEach (units group player);
 
// remove Action Item
_FatigueX = 0;
_caller removeAction _FatigueAction;
_FatigueAction = _caller addAction ["Enable Fatigue", "scripts\fatigue_onoff.sqf", _FatigueX];
 
hint format ["Fatigue now DISABLED - param: %1 for %2 's group", _params, _caller]; sleep 1; hint "";
else 
{
{ _x enableFatigue true; } forEach (units group player);
 
// remove Action Item
_FatigueX = 1;
_caller removeAction _FatigueAction;
_FatigueAction = _caller addAction ["Disable Fatigue", "scripts\fatigue_onoff.sqf", _FatigueX];
 
hint format ["Fatigue now ENABLED - param: %1 for %2 's group", _params, _caller]; sleep 1; hint "";
};
 
 
Is there someone could help me on how to fix this?
 
Thanks

Share this post


Link to post
Share on other sites

Ups.. sorry I might post this in the wrong channel

Share this post


Link to post
Share on other sites

Is this whole squad AI or players? and is there respawn or no?

Share this post


Link to post
Share on other sites

Hi Jshock, I just a noob in scripting. I was trying to make the squad member require no fatigue at all.

So I tried to create action item that behave like ON-OFF, once I click it will be on, then the text changed, if I click again it will be off and the text changed.

However, the above script resulting error, if I click Disable Fatigue, -> then another action menu appear "Enable Fatigue", instead of replacing the old "Disable Fatigue" text with "Enable Fatigue" - so everytime I click there would be alot of Enable Fatigue and Disable Fatigue action items.... 

Any suggestion?

Share this post


Link to post
Share on other sites

Hi Jshock, I just a noob in scripting. I was trying to make the squad member require no fatigue at all.

So I tried to create action item that behave like ON-OFF, once I click it will be on, then the text changed, if I click again it will be off and the text changed.

However, the above script resulting error, if I click Disable Fatigue, -> then another action menu appear "Enable Fatigue", instead of replacing the old "Disable Fatigue" text with "Enable Fatigue" - so everytime I click there would be alot of Enable Fatigue and Disable Fatigue action items.... 

Any suggestion?

You didn't answer either of my questions, I understand the problem.

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

×