Search the Community
Showing results for tags 'Variable'.
Found 35 results
-
constantly display a variable on screen
dlegion posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
hi all ! i wish to have a sort of "on screen constant scoreboard", that constantly displays a variable (in my case lets name it: "_Gcredits") i really have no idea how do this, any help will be appreciated, thanks guys ! ( i need it works on dedicated server, JIP and respawn) -
Welcome, To keep this short : _hit = 0 I want this variable to increase everytime the object _Str been hit. _Str addEventHandler ["HitPart",{_hit = _hit + 1}]; This doesn't work because the EH doesn't know the localvariable. _Str addEventHandler ["HitPart",{hit = hit + 1}]; This does work because it is a globalvariable. But i need it to be a localvariable, because there are 200 objects that are being spawned using the same variable. waitUntil {_Hit > 3}; deletevehicle _Str; I want the obj to delete itself after being hit 3 times. Is there workaround that i can use? Or maby a different way to approach this? Draoth
- 2 replies
-
- difficult
- eventhandler
-
(and 5 more)
Tagged with:
-
Caching a variable for mission restart?
Midnighters posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I was wondering if there was the possibility of getting a variable to be persistent through a mission restart. I want the player's inventory to be saved and then reloaded when connecting back. Any ideas? -
Global variable - Undefined variable in expression
draoth posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello everyone! I'm pretty new to scripting in Arma, so i hope someone can help me out. I've created a script that makes a global variable grow when a unit spawns. it worked great in singleplayer but when i tested it in multiplayer, it suddenly threw this error. Undefined variable in expression: participants So now i'm asking myself, what did i do wrong? init.sqf participants = 0; code when unit spawns participants = participants + 1; -
Passing variables from Radio Trigger - issue
vapour posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi fellow scripters In a MP mission, I have a radio trigger placed down that runs a script to shift a respawn_west marker to the location of the unit that activated the radio trigger. Normally, with an area trigger you would pass the 'unit' variable to the script by putting: nul = [thisList select 0] execVM "scriptname.sqf" in the 'ON ACTIVATION' box of the trigger, and then in the sqf file having something like: _unit = (_this select 0); What is occurring though with the radio trigger, is that it is obviously not receiving the unit's variable in the script. I get 'ERROR - UNDEFINED VARIABLE' when activating the trigger in mission. Are radio triggers a little different from area triggers in this respect? I'm assuming they either expect just one activator as opposed to many, thus may not use 'thisList', or are perhaps not recording any activator at all. I have tried nul = [this select 0] execVM "scriptname.sqf" and nul = [this] execVM "scriptname.sqf", but to no avail. Still the same error. Does any one have some bright ideas about where I may be going wrong? Any help is much appreciated.- 3 replies
-
- Radio Trigger
- Variable
-
(and 1 more)
Tagged with:
-
How to make actions global for all players
psychorange posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello lads! I'm currently making / modifying a coop mission in ArmA 3, most stuff works so far, managed to find most stuff i needed in the Forums already. Now i have a little problem, it has been explained a few times already, but i just can't seem to understand it somehow :P How can i manage to make stuff sync between all connected users ? e.g. i have some "addaction" stuff used in my mission, but some of these actions are only executed on the local client side, and not globally for all of the players. As far as i know, i will have to somehow send information (for ex. briefcase collected, which would be a addaction) to the server in which i set a server variable (for ex. briefcase_collected) to a specific value, in this case 1 / true. Then the server would share this information with all collected clients, and by changing the value of the variable, the clients would know that this task has been completed, and it would show the next. I just have no idea how i do this in arma, i am trying for quite some hours now but just can seem to get it right. I thank all of those that give me some hints in advance! B) - PsychOrange- 4 replies
-
- Variable
- Multiplayer
- (and 8 more)
-
Help With Choosing A Random Variable (BIS_fnc_selectRandom)
atomickrypton posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello BIS Forums, I am working on a mission which involves a cool chase scene, and to put in a "randomness" factor, I have recorded 3 different paths the AI can take. The paths work, but for some reason, the script I am using to choose the random path isn't really working. Here it is: _poi = _this select 0; _randomMovement = ["pursuitPath1","pursuitPath2","pursuitPath3"]; _dataPath = _randomMovement call BIS_fnc_selectRandom; hint format ["The path will be: %1",_dataPath]; sleep 0.5; // The script works up until here.. if (_dataPath == pursuitPath1) then { hint "good"; _pursuit1 = [_poi] execVM "path\play.sqf"; // play, play3 and play4 are the files that make the AI follow the path, they all work when I execute them through the debug console or by trigger. waitUntil {scriptDone _pursuit1}; terminate _pursuit1; }; if (_dataPath == pursuitPath2) then { hint "bueno"; _pursuit2 = [_poi] execVM "path\play3.sqf"; waitUntil {scriptDone _pursuit2}; terminate _pursuit2; }; if (_dataPath == pursuitPath3) then { hint "gut"; _pursuit3 = [_poi] execVM "path\play4.sqf"; waitUntil {scriptDone _pursuit3}; terminate _pursuit3; }; I am still learning the basics and everything there is to scripting, so bear with me if I made a simple error. I believe it has to do with the condition with the if statement, however, I am not sure what to do and google has failed me in this endeavor. If there is any help you all can offer it will be greatly appreciated! Thanks all : ) -
Two condition in "setTriggerStatements"
cybercoco posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi all ! I have a small problem, I would like to add a trigger and set two conditions for it's activation. _won is the name of the car. The first is "this", player is present in the area (cicle 3,3 around _won). The second is "!(player in _won)", player is not in the vehicle. I can't find a way to make it work... // _won is the name of the car _trg = createTrigger ["EmptyDetector", getPos _won, false]; _trg setTriggerArea[3,3,0,false]; _trg setTriggerActivation["WEST","PRESENT",true]; _trg setTriggerStatements[ "this && !(player in _won)", "hint 'yes yes yes'", "hint 'no civilian near wonno'" ]; -
Minimize number of similar lines in algorithm
cybercoco posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm sure there's a way to minimize the number of lines in this code. I have three variables, each of them needs to get through a simple math function : f(x)=10x. _var1 = 0.2; _var2 = 0.7; _var3 = 0.5; _array = [_var1,_var2,_var3]; _var1 = _var1 * 10; _var2 = _var2 * 10; _var3 = _var3 * 10; If I have let say ten vars, is it better to use the brute way (see snip above), use a foreach command or use a function (optimization wise). Probably the function, isn't it ? -
Set a variable as addAction's title
cybercoco posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, This stores the motor's health of the vehicle in the local variable _motorhealth _motorhealth = vehiclename getHit "motor"; then i want the result (_motorhealth) to show as the title of a addAction. The following code snippet is taken from the internet (raw) : _myname = name player; _addaction = amo addAction [_myname,"scripts\rearm.sqf"]; And the following is my non-working code _motorhealth = vehiclename getHit "motor"; vehiclename addAction [_motorhealth,"niania.sqf"]; Any ideas how it might work ? C.Coco