Search the Community
Showing results for tags 'global variables'.
Found 3 results
-
Variables for Triggers in Multiplayer Mission File
EveMakya posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
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.- 1 reply
-
- help requested
- variables
-
(and 4 more)
Tagged with:
-
HI All, I need a better understanding of the consequences of using global variables in my MP game. I read the following Variables and KK's blog – Variables - ArmA Scripting Tutorials: Variables all three part by Killzonekid but still unsure how global variables will impact the performance of my MP game and the many scripts I have. For example, is it better to use the following in every function that requires the enemy's side _AIside = WEST; if (playerSide isEqualTo WEST) then {_AIside = EAST}; or simply create the following in initServer.sqf if (playerSide == WEST) then {AIside = EAST} else {AIside = WEST}; and use AIside in each function. What is better for overall performance?
-
Who is the person that got the remoteExec ?
JeyR posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Alright. Welcome everyone. I have a very interesting problem, and I couldn't find a solution for it. I have been really trying to get past this but I can't solve this riddle. I have this small code snippet inside the initPlayerLocal.sqf: if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And here is the CHAB_fnc_jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???; As you can see, I clearly have no clue who is the owner of machine ? In my mind's eye remoteExec sends a message to every player that they have to run this script with the given parameters. Here is what I tried so far: Create a global variable (not public) for each player and give it the playerUID -> Result is that inside the jipcam the returned value is "any" on each PC. Create a missionnamespace variable (global but not public) and give it the playerUID -> same results as before I have completely run out of ideas, I tried mostly everything I could think of. Is there anyone who has more tricks up his sleeve?- 24 replies
-
- remoteexec
- global variables
-
(and 4 more)
Tagged with: