Jump to content
Sign in to follow this  

Recommended Posts

Hey all, 

I'm relatively new to Arma 3 scripting and have run into an issue. I recently figured out that I could activate triggers synced to show/hide modules with a variable set with an add-action, essentially allowing me to control entire swaths of triggers with a button press, something I have found to be far more reliable than triggers activated by the physical presence of a unit. 

What I have is a set of triggers that simply have the variable and a semi-colon: StageOneActivated;
And then with an add-action added with an init.sqf, I have:
 

Controller addAction [ "Begin Phase One", 
		{StageOneActivated = true; 
		Controller removeAction (_this select 2);
		}];

Which sets the StageOneActivated to true which activates the trigger and removes the now-useless addaction from the list.

Both locally and testing in local multiplayer via LAN this works flawlessly, but on the server the triggers simply don't respond. I know the init.sqf is working because the addAction's are present. And I know the addAction is working because it's removing the addaction after use. This implies the variables are whats not working correctly.

I went into my init.sqf and decided to call the variables on mission start and set them, so I have the line: 
StageOneActivated = False;

This has made no impact, neither in the locally tested version which still works, nor on the server which still fails. I've read through the documentation on global variables and I think this is probably what I need to do: to call the variables globally in the MP mission but I am struggling with the syntax. Do I just add publicVariable "StageOneActivated"; to the init.sqf after the line where I set the variable state as StageOneActivated = false; or do I need to call the public variable in the add-action as well? or is there another way to name and set these variables that I am missing entirely?

Any help is appreciated. I want to start using variables more to really add some oomph into my missions and this is something that is going to come up a LOT.

Share this post


Link to post
Share on other sites
32 minutes ago, EveMakya said:

Do I just add publicVariable "StageOneActivated"; to the init.sqf after the line where I set the variable state as StageOneActivated = false; or do I need to call the public variable in the add-action as well?

 

Just the addAction.

Controller addAction [ "Begin Phase One", 
{
	StageOneActivated = true;
	publicVariable "StageOneActivated";
	Controller removeAction (_this select 2);
}];

You don't need to add it to init.sqf because init.sqf runs on every machine at mission start.

  • Like 1

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  

×