Search the Community
Showing results for tags 'variable'.
Found 35 results
-
Update Variables | Player Name | Show on Billboard
SirBassi posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello everyone, as a non-trained programmer but a motivated mission builder, I am contacting you again today with a small problem in which I am sure I am just missing a small thing. Background: I have a trait switcher in the mission where players can select a role as Medic, Engineer or Explosive Specialist. These roles are limited. I would like to set up a billboard next to the role switcher that shows which player currently has which role or which roles are actual unused. My problem: When I test in Selfhost MP, after a selected role, it gives me the role description that is stored on the slot instead of my player / profile name. In another Testplayer sot, it brings me the correct player / profile name of me but still with the current group, which is not needed and does not look good in terms of space / layout. Since my native language is German, a short explanation: String "unbesetzt" means "actually unused". Any dedicated requirements have not yet been checked, first of all everything should work. I hope that I haven't made any major mistakes from the performance side, even if there is certainly a more elegant way, but I'm glad to have created a working basis for now. Following script is actually called in init.sqf by execVm: Thanks a lot for Feedback and ideas how I could handle the "nameproblem" best. -
addaction addAction for switching Variable Values
SirBassi posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi together, I wrote my first lil longer and complex script ready and after a longer period of try and error and hard learning phase I am the happiest guy, now 😉 For stopping and starting my script(s) while the mission I set boolean variables for stopping and continue. I have in my mind to set change this variables not every time by console, better with a easy addaction of local me Ingame. But with this im a little in struggle and not sure if it could work and if I am on the "right path". Idea: The switching of the colors from the addaction works as expected. But the code wasn't executed. Maybe you get a idea for me. Thanks a lot. -
Getting variable from Eden editor for script use
Dnote Gaming posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
So I’m new to coding in general and thought I’d try out scripting in arma 3, I have written code but it does not do as intended. And I don’t even know if I’m using the right commands, I’m done trying to rack my brain scouring BI script command list and random YouTube videos if anyone know how to achieve this please post it here or reference me to where I can get help. so here’s what I want to do: 1. Give variable name in Eden editor. 2. Get variable name given in Eden editor for reference in script as a “class”. 3. Use variable name “class” to run a specific script. plot example: Object (unit) variable name given in editor = Assault //in script code to get the variable name of “This” unit. code to check if the variable name is equal to a specific class name. code that executes another code if the check returns true. if you have any insight on how to achieve this or even close to it please reply -
I have 10 units. Their variable names are: s1, s2, s3, s4, s5, s6, s7, s8, s9, s10. I want to make all of them be in just one name. How do I set this variable?
- 5 replies
-
- eden editor
- variable
-
(and 1 more)
Tagged with:
-
Help - getVariable (ACE)
GaryTheNoTrashCougar posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Trying to make a displayCtrl for blood loss when using ace. Problem I'm having is trying to get blood level value: player getVariable "ace_medical_bloodVolume"; This works in debug console but is not recognised in my script. I'm not familiar with returning variables from mods, do I have to define something in order to pass the variable through to my script? -
EventHandler Increment Internal Variable or Local Variable
Dominicus1165 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is on a multiplayer server. It must work there. I want to breach a door via Slug Ammo. I placed a wooden plank the size of the door in front of it. After two hits the plank gets destroyed and the door opens. I want to use this script multiple times during my mission. Therefore, I don't want n variables counterPlank0 - counterPlankN I want to save the counter locally. Called in init of plank: [this] execVM "scripts\eh_slugBreach.sqf" File: Working with global variable: Not working with setVariable: params ["_object"]; _counterplank = 0; _object setVariable ["counterPlank", _counterPlank]; DIFFERENCE _object addMPEventHandler ["MPHit", { params ["_unit", "_causedBy", "_damage", "_instigator"]; if (currentMagazine _instigator isEqualTo "rhsusf_5Rnd_Slug") then { _unit setVariable ["counterPlank", _counterPlank + 1]; DIFFERENCE }; if (_unit getVariable "counterPlank" > 1) then { DIFFERENCE deleteVehicle _unit; myBuilding animateSource ["Door_1_sound_source", 1]; }; }];- 2 replies
-
- multiplayer
- eventhandler
-
(and 4 more)
Tagged with:
-
Good afternoon all! I am here today because I meet a problem ... Indeed I do not know how to retrieve in a script the content of a variable that was created in another script. In other words I have a script 1 which has a variable _chose and in script 2 I want to recover this variable _chose. Thank you for reading my few lines! and I hope you can help me ... Good bye !
-
Best array position for another array with variable size?
Leopard20 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello everyone. Let's say I want to place array A inside array B: B = [....A....] The dots mean there may be other variables with fixed memory size after or before A (typically some strings or integers in my code). Array A however, may have a variable size (due to using pushBack/append/deleteAt/set for this array), from 0 all the way up to hundreds of elements. In terms of memory allocation speed, is there any difference where you put A inside B? Also, does reading speed (B select _index) vary according to where A is? (I think it doesn't, but asking to make sure) I'm asking this because arrays B and A (and their contents) are read and sometimes modified per frame. -
Removing whitespace script release
das attorney posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Preamble: From the wiki, we can use splitstring and joinstring to remove white space from code. So if we have a function like this one (from the wiki): fnc_deleteTestObj = { _this addMPEventHandler ["MPKilled", { _this = _this select 0; { deleteVehicle _x; } forEach (_this getVariable ["effects", []]); if (isServer) then { deleteVehicle _this; }; }]; _this setDamage 1; }; We can do: copyToClipboard(([fnc_deleteTestObj] joinString "") splitString toString [9,13,10] joinString "") and it returns: { _this addMPEventHandler ["MPKilled", { _this = _this select 0; { deleteVehicle _x; } forEach (_this getVariable ["effects", []]); if (isServer) then { deleteVehicle _this; }; }]; _this setDamage 1; } Which is quite nice. But I wanted a way to remove as much white space as I can (for sending code/variables over the network etc), plus I just fancied playing about with recursion. So with this function, we can use our "fnc_deleteTestObj" function again and plug it in: copyToClipboard(([fnc_deleteTestObj] joinString "") call fnc_whitespace) This returns: {_this addMPEventHandler["MPKilled",{_this=_this select 0;{deleteVehicle _x;}forEach(_this getVariable["effects",[]]);if(isServer)then{deleteVehicle _this;};}];_this setDamage 1;} I'm using joinstring in these examples as opposed to format as it doesn't have the 8k limit. Apparently formatText isn't limited and I'm not sure about str. But you could do this I suppose - just be aware it might have a limit: (str fnc_deleteTestObj) call fnc_whitespace Uses As mentioned, you could shorten variables prior to sending them over the network (then compileFinal at other end). I'm aware that programs like these exist already, but I wanted to do it in sqf (like within the engine). It should be ok but will have a problem if you do silly things like putting spaces into variables ex: player setVariable ["there are spaces in this",true]; which is a bit of a no-no imo and bad practice. You could probably obfuscate your code with this if you want but there are already good online obfuscators available anyway, and also good online de-obfuscators, like this one: http://unminify.com/ I think Dwarden said he used to do this to his mission files to make them smaller so they wouldn't suck up as much bandwidth, so theres a use for it there I suppose. Obv, I haven't tested this much but it seems ok so far - ymmv. Be aware if you use it on very large functions, then it is recursive so it might freeze your game for a few seconds. If you rename it, make sure you rename the call to it in the code as well or you will break it. Function: Here it is for any interested: fnc_whitespace = { private _noWhitespace = toArray(_this); private _anyWS = false; { if (0 isEqualType _x) then { if ([9,13,10] find _x > -1) then { _noWhitespace set [_forEachIndex,objNull]; _anyWS = true; } else { if ([34,39,94,42,40,41,123,125,91,93,59,58,62,47,43,45,61,46] find _x > -1) then { if (_forEachIndex - 1 > -1) then { if ([32,9,13,10] find (_noWhitespace select (_forEachIndex - 1)) > -1) then { _noWhitespace set [_forEachIndex - 1,objNull]; _anyWS = true; } }; if (_forEachIndex + 1 < count _noWhitespace) then { if ([32,9,13,10] find (_noWhitespace select (_forEachIndex + 1)) > -1) then { _noWhitespace set [_forEachIndex + 1,objNull]; _anyWS = true; } }; } } }; } forEach _noWhitespace; _noWhitespace = _noWhitespace - [objNull]; if (_anyWS) then { _noWhitespace = (toString _noWhitespace) call fnc_whitespace; _noWhitespace = toArray _noWhitespace; }; toString(_noWhitespace) }; And here it is compacted (ho ho ho): fnc_whitespace={private _noWhitespace=toArray(_this);private _anyWS=false;{if(0 isEqualType _x)then{if([9,13,10]find _x>-1)then{_noWhitespace set[_forEachIndex,objNull];_anyWS=true;}else{if([34,39,94,42,40,41,123,125,91,93,59,58,62,47,43,45,61,46]find _x>-1)then{if(_forEachIndex-1>-1)then{if([32,9,13,10]find(_noWhitespace select(_forEachIndex-1))>-1)then{_noWhitespace set[_forEachIndex-1,objNull];_anyWS=true;}};if(_forEachIndex+1 < count _noWhitespace)then{if([32,9,13,10]find(_noWhitespace select(_forEachIndex+1))>-1)then{_noWhitespace set[_forEachIndex+1,objNull];_anyWS=true;}};}}};}forEach _noWhitespace;_noWhitespace=_noWhitespace-[objNull];if(_anyWS)then{_noWhitespace=(toString _noWhitespace)call fnc_whitespace;_noWhitespace=toArray _noWhitespace;};toString(_noWhitespace)} Credit to @dreadedentity for his initial code HERE Enjoy!- 11 replies
-
- 6
-
- remove
- whitespace
-
(and 5 more)
Tagged with:
-
Is there a way to delete a variable with a trigger?
ChlckenWlng posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I dont know a lot of making missions and wanted to know if there is a way to delete a variable with a trigger. I tried looking it up but I kinda didnt find anything useful and only found how to delete units. Also where can I look up all the expressions commands for triggers?- 6 replies
-
- arma3
- eden editor
- (and 4 more)
-
params wogz187 learns Function Call Params
wogz187 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm going to learn how to use params in order to make future scripts more effective and you might learn something about params, too (please use the debug console if you want to follow along). A simple example, fnc_learnThis= { params ["_caller","_some","_thing","_luck"]; if (_luck>0) exitWith { systemChat format ["%1", _caller]; systemChat format ["%1 %2", _some, _thing]; }; }; With some luck this call will prompt the functions to run with the parameters set, [player, "is", "cool",1] call fnc_learnThis; The next example shows how to select from an array and sub-array. We can create some helpers and make the orb jump between them. Make three sets so the result isn't binary. Create the array of helpers from named objects like this, Enter the function, and call the function with, [orb, 0] call you_fnc_help; The orb should continue to go around between the three helpers each time you enter the call. To change to the next helper group, [orb, 1] call you_fnc_help; More examples continue throughout the discussion below, Have fun! -
Race Circuit Script (aka learning to count)
wogz187 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
This topic is solved. Clear courses by reaching the next marker. If you're looking for the module it's available here: Drive Link This is the test rig in the demo. Adding new marks and whole new courses is easy. From here on is the original topic, I need to learn how to count. I posted this the other day, with a plea to understand why it works when, in my estimation, it shouldn't really. Regardless. I set about to simplify ring counting. I don't like having one .sqf file for each ring course. I feel like 1 or 2 scripts should be able to do this. One file if somebody helps me to learn how to count. Two if this works: Determine which course and define ring marks with generic titles, ringCOURSE.sqf-- this example shows 2 courses with 3 rings each if (ringCHALL==1) then { ring1=ringMARK1_1; ring2=ringMARK1_2; //first course second mark ring3=ringMARK1_3; rings= []execVM "ringCLEAR.sqf"; }; if (ringCHALL==2) then { ring1=ringMARK2_1; ring2=ringMARK2_2; //second course second mark ring3=ringMARK2_3; rings= []execVM "ringCLEAR.sqf"; }; and then build a switchdo case for each ring, or a waitUntil loop, or... I don't know and that's the question. Keep in mind there is only one ring with one trigger attached to drive the ring clearing script(s). This is what it needs to do, ["task1",[currentRING,true]] call BIS_fnc_taskSetDestination; ringGOAL_1 setpos (getpos currentRING); The real trick in this is how to go from: ring1, ring2, ring3, to set the variable "currentRING" in sequence. Oh, boy! I hope that makes sense! -
Variable not defined when using local variable
SSgt 'Ice Cold' Sykes posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I'm trying to set up a minefield module via script. I get an error when using local variables while everything works fine with global variables. If anyone could tell why that'd be great. Here's my code : POP_fnc_Minefield = { if ((typename _this != "ARRAY") or (count _this < 3)) exitWith {hint format ["Error : POP_fnc_Minefield argument : %1", _this];}; _MineGroup = createGroup [(_this select 0), true]; _pos = _this select 1; _FieldSize = _this select 2; if (count _this <= 3) then {_NbMines = floor(_FieldSize/2);} else {_NbMines = floor(_FieldSize/2*(_this select 3));}; if (count _this <= 4) then {_MineType = "APERSMine";} else {_MineType = this select 4;}; if (count _this <= 5) then {_FieldCond = TRUE;} else {_FieldCond = _this select 5;}; _Minefield = "Site_Minefield" createUnit [ _pos, _MineGroup, format [ "this setVariable ['minescount', '%1']; this setVariable ['minestype', '%2']; this setVariable ['axisa', '%3']; this setVariable ['axisb', '%3']; this setVariable ['shape', 'Rectangle']; this setVariable ['side', 'Independent']; this setVariable ['marked', 'Friendlies']; this setVariable ['conditionofpresence', '%4'];", _NbMines, _MineType, _FieldSize, _FieldCond ] ]; }; This code throws undefined variable errors but if replace _NbMines, _MineType, _FieldCond with NbMines, MineType, FieldCond then everything seems to work fine.- 3 replies
-
- variable
- not defined
-
(and 2 more)
Tagged with:
-
addaction [SOLVED] Troubles Passing Variables to addAction
TexasRussian posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello awesome BI community! This is the first time I'm posting an issue here so any help would be much appreciated, and thank you in advance for the use of your time. 🙂 END GOAL: helicopter spawns (via triggers listening to boolean variable in game) helicopter goes to object (defined in script) helicopter goes to player (defined in script) helicopter returns to base helicopter disappears (via triggers listening to boolean variable in game) and: the addAction has an initial menu that just states "SUPPORTS" then upon selecting deletes that action and adds a subset of supports for the player to use. INTENTION: What I'm trying to do is have ONE .sqf script and pass variables to that script via execVM from a trigger in game. I have created this script using 3 .sqf script files using public and predefined variables in game, and it works. But I want this to work more like a function than a script. So this is my first script which uses private variables. I would like this to remain as ONE .sqf so I can copy this to a new mission and create/define the objects/groups in the game, then pass those using execVM. PROBLEM: Everything works, except addAction transfers the code to a scheduled task and the private variables are undefined there, at least that's how I understand it. CODE THAT WORKS WITH PUBLIC VARIABLES: CODE IM TRYING TO GET WORKING WITH PRIVATE VARIABELS: HOW I'M CALLING THE CODE: *EDIT In the game it errors at: slingloadmain = _player addAction [ "SUPPORTS", { _player removeaction slingloadmain; _activate = false; Is this even possible? -
script make a variable make it so it jumps to another place in script.
Play3r posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
hello anyone I'm making a SP game and i want the player to contact a oldman for info in a town, when the player get in 2 mtr from the oldman i want the oldman to look at the player and the SUBTITLES is shown on screen but i want the script to jump to the subtitle in the EXITWITH if the player runs in to the oldman one more time. i have a trigger with this type: none ACT: none Repeat is ticked \/ COND :TRUE ACT : 0 = oldman spawn { waitUntil {sleep .1; player distance2d oldman < 2}; oldman lookAt player; oldman disableai "move"; _handle = execVM "TALK\oldman.sqf"; }; In my OLDMAN.SQF : // _handle = execVM "TALK\oldman.sqf"; if (oldmandone < 0) exitWith {_handle = [] spawn {["OLDMAN", "I have already given you my information.."] spawn BIS_fnc_showSubtitle};}; <-- i want this to be told to player if he turns to the oldman again in mission _handle = [] spawn {["OLDMAN", "Hello sir, if you go into the barn you will find"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "some things that might could help you with your mission."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "It is all we got, if you need anything else,"] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "you have to find it somewhere else."] spawn BIS_fnc_showSubtitle}; sleep 8; _handle = [] spawn {["OLDMAN", "Good luck, i have work to do.."] spawn BIS_fnc_showSubtitle}; sleep 5; oldmandone = oldmandone + 1; oldman enableai "move"; I think i have to make it run in a loop so it can do the exitwith but i don't know how to do it. can it be done in the trigger. i have tried with [ at the beginning by the if (oldmandone <0 and a ] call BIS_fnc_loop; but no joy Any one with a idea how to solve this problem for me. -
Hey! I've been trying to make a IED script that uses a triggerman instead of the commonly found pressure plate. So far it's early in "development" but eventually I'm aiming for it to become dynamic and able to spawn random death traps all over the chosen map. The problem I've encountered and need help with is that my local variable doesn't work in a trigger. // Pick a spawnpoint _spawnPoint = selectRandom [ "spawn_garage", "spawn_hotel", "spawn_hotel_2", "spawn_shop", "spawn_office", "spawn_binocular", "spawn_suicide", "spawn_minaret", "spawn_wall" ]; // Spawn IED man _bomberGroup = createGroup [East, True]; _bomber = _bomberGroup createUnit ["LOP_AM_OPF_Infantry_Engineer", getMarkerPos _spawnPoint, [], 0, "CAN_COLLIDE"]; _bomberGroup setBehaviour "careless"; //removeAllWeapons _bomber; _bomber setCaptive true; _bomber disableAI "MOVE"; _bomber setUnitPos "UP"; _bomber_weapon = currentWeapon _bomber; // Custom scripts depending on which spawnpoint is chosen switch (_spawnPoint) do { case "spawn_garage": { hint "GARAGE"; _bomber setPos [getPos _bomber select 0, getPos _bomber select 1, 4.040]; }; case "spawn_hotel": { hint "HOTEL"; _bomber setPos [getPos _bomber select 0, getPos _bomber select 1, 3.798]; }; case "spawn_shop": { hint "SHOP"; _bomber setPos [getPos _bomber select 0, getPos _bomber select 1, 4.292]; }; case "spawn_office": { hint "OFFICE"; _bomber setPos [getPos _bomber select 0, getPos _bomber select 1, 5.787]; }; case "spawn_binocular": { hint "BINOCULAR"; _bomber setPos [getPos _bomber select 0, getPos _bomber select 1, 3.403]; }; case "spawn_suicide": { hint "SUICIDE"; }; case "spawn_minaret": { hint "MINARET"; _bomber setPos [getPos _bomber select 0, getPos _bomber select 1, 19.424]; }; case "spawn_hotel_2": { hint "HOTEL_2"; }; case "spawn_wall": { hint "WALL"; }; default { hint "ERROR! No spawnpoint chosen"; }; }; // Make bomber face IED _dir = _bomber getDir IED_L; _bomber setDir _dir; _bomber setFormDir _dir; // Spawn weapon next to bomber //_wh = "WeaponHolderSimulated" createVehicle position _bomber; //_wh addWeaponCargoGlobal ["rhs_weap_akm",1]; //_wh addMagazineCargoGlobal ["rhs_30Rnd_762x39mm",1]; //_wh setPos (getpos _bomber); _wh = "GroundWeaponHolder_Scripted" createVehicle position _bomber; _wh setPosAtl (getPosATL _bomber); _bomber action ["DropWeapon", _wh, _bomber_weapon]; // Create a trigger on triggermans position to make him combat any player that gets close // ###THIS IS WHERE IT GETS FUCKY### _trgr_bomber_1 = createTrigger ["EmptyDetector", getPos _bomber, true]; _trgr_bomber_1 setTriggerArea [10, 10, 0, false]; _trgr_bomber_1 setTriggerActivation ["ANYPLAYER", "PRESENT", false]; _trgr_bomber_1 setTriggerStatements ["this", "hint 'trigger start'; _bomber selectWeapon '_bomber_weapon'; _bomber enableAI 'MOVE'; _bomber setUnitPos 'AUTO'; _bomberGroup setbehaviour 'COMBAT'; _bomber setCaptive false;", "hint 'trigger end'"]; // Testing to see if set to careless because he kept on throwing grenades // Somehow AI still do that in careless I guess? sleep 5; _b = behaviour _bomber; hint format ["%1", _b]; /* ACE Detonation Needs to be fixed No clue how to use this at all // Connect explosives to bomber [_bomber, IED_L, "Cellphone"] call ace_explosives_fnc_connectExplosive; sleep 30; // Boom? [{ ["_bomber", "3000", "IED_L", "0", "Cellphone"]; true }] call ace_explosives_fnc_addDetonateHandler; */ Basically, if you can understand my mess, I have two issues 1: the "_trgr_bomber_1" doesn't know what "_bomber" is so it can't make him pickup a gun and activate standard AI combat. 2: AI still throw grenades at me like 17th century grenadiers even though they're set to "CARELESS". Any help would be greatly appreciated and I'm pretty sure it's an easy fix for anyone who's actually a coder.
-
[Help] Create Variable Name for Spawned Object
Lineman posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Currently using createVehicle to spawn an object under certain conditions. I'm wondering how to create a variable name once it has spawned. -
This is my Create FOB function. If you replace the event handler with removeAllCuratorEditingAreas, it will work. I want to make it where you can place as many HQs as you want, But when they get destroyed so goes the editing area around it. Spent like 4 hours trying to figure it out . My first attempt i just made a _EA variable, but i wasn't sure if it was storing the code or the actual number, And if that number would stay with the event handler or change when the event handler fired, but then this attempt confirms that it wouldn't of worked anyway. I know {} is code, and () is number, but it was still confusing as what if you recalled the function, would previous eventhandlers change? HNK_createFOB = { params ["_veh"]; _vehPos = getPos _veh; deleteVehicle _veh; _HQ = HQClass createVehicle _vehPos; myCurator addCuratorEditableObjects [[_HQ],true]; _HQ setVariable ["_EA",((count curatorEditingArea myCurator) + 1)]; myCurator addCuratorEditingArea [(_HQ getVariable "_EA"),position _HQ,100]; _HQ addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; myCurator removeCuratorEditingArea (_HQ getVariable "_EA"); }];};
-
hinting passed variable, displaying <no shape>
gokitty1199 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
im passing the triggers name from a trigger to a script and then passing the same variable from that script using publicVariableServer. this was working earlier today before i started to rewrite how the triggers spawn but the file that is getting the variable passed to it was not changed which makes no sense to me as to why it is throwing the error. here is the function that creates the trigger and passes the name into register.sqf. you can see r1Trigger is getting passed into register.sqf, now if i pass the name as a string it works just fine such as "cash1 = player addAction ['register 1', {['r1Trigger'] execVM 'server\loot\register.sqf';}];" but even if i use call compile to turn it back into the name of the object in the script, it still throws <no shape> when i hint the name. _area = [0.462, 0.637, 10.650, true, 1]; makeTrig1Fnc = { _pos = [3119, 6303.5, 0.312]; r1Trigger = createTrigger ["EmptyDetector", [_pos select 0, _pos select 1, _pos select 2]]; r1Trigger setTriggerArea [_area select 0, _area select 1, _area select 2, _area select 3, _area select 4]; r1Trigger setTriggerActivation ["GUER", "PRESENT", true]; r1Trigger setTriggerStatements ["this && player in thisList", "cash1 = player addAction ['register 1', {[r1Trigger] execVM 'server\loot\register.sqf';}];", "player removeAction cash1;"]; }; here is the register.sqf _register = _this select 0; _h = [_register]spawn { _register = (_this select 0); hint str _register;//THIS IS WHERE IM TRYING TO PRINT THE HINT FOR TESTING REASONS _register1 = r1Trigger; _register2 = r2Trigger; _register3 = r3Trigger; _register4 = r4Trigger; _moneyAmount = selectRandom [50, 100, 150, 175, 200, 250, 275, 400, 325, 2000]; switch (_register) do { case _register1: { registerUsed = [_register]; publicVariableServer "registerUsed"; player removeAction cash1; award = award + _moneyAmount; //hint format ["You found %1 dollars. Amount Stolen: $%2", _moneyAmount, award]; [r1SoundPos, ["cashRegister", 125, 1]] remoteExec ["say3d", 0, true]; _register setPos [0, 0, 0]; }; }; }; the other strange thing is that it works inside the switch statement and it runs for _register1 and _register2(the rest not included to keep the post size down) but long story short, it just works. but when i try to pass it to the server with publicVariableServer, that is where i run into the problems. when it was hinting the name properly, thats when it was working fine and i was able to work on the registerUsed eventHandler, why is it printing out <no slot>, ive restarted my game and everything and it just makes no sense to me as to why its doing this. -
Bis function and eventhandler keep breaking Randomly
claws01 posted a topic in ARMA 3 - TROUBLESHOOTING
1 - Mission been running for month never had any trouble 2- but since last two day , been having some crazy bug ( where the client get this " 10:04:59 Error in expression <} do { _unitsEvaluated = []; if (count bis_revive3d_unitsToProcess == 0) then {> 10:04:59 Error position: <bis_revive3d_unitsToProcess == 0) then {> 10:04:59 Error Undefined variable in expression: bis_revive3d_unitstoprocess 10:04:59 File a3\functions_f_mp_mark\revive\fn_reviveInit.sqf [BIS_fnc_reviveInit], line 617 Then any player inside the server will see this error with more data (if only scripterror set to 1). as soon this happen all script and eventhandler stop working " 10:04:59 Error in expression <} do { _unitsEvaluated = []; if (count bis_revive3d_unitsToProcess == 0) then {> 10:04:59 Error position: <bis_revive3d_unitsToProcess == 0) then {> 10:04:59 Error Undefined variable in expression: bis_revive3d_unitstoprocess 10:04:59 File a3\functions_f_mp_mark\revive\fn_reviveInit.sqf [BIS_fnc_reviveInit], line 617 3. if a player try to join the server , the client game will crash giving this error Error in expression <!isnull player && BIS_fnc_feedback_allowPP> 10:12:40 Error position: <BIS_fnc_feedback_allowPP> 10:12:40 Error Undefined variable in expression: bis_fnc_feedback_allowpp 10:12:40 Attempt to override final function - bis_fnc_uniqueclasses 10:12:40 Attempt to override final function - bis_fnc_removecuratoricon 10:12:40 Attempt to override final function - bis_fnc_locweaponinfo 10:12:40 Attempt to override final function - bis_fnc_exp_camp_playtimelinevideo 10:12:40 Error in expression <!isnull player && BIS_fnc_feedback_allowPP> 10:12:40 Error position: <BIS_fnc_feedback_allowPP> 4. step i took : -Verify game integrity ( server and client) - check the mission file for any integrity (no error) - debug each step to find if any irregularity during the mission nothing - server rtp don't show any error related to that bug 5. revive setting inside description //--- Respawn respawn = 3; // 0 = NONE. 1 = BIRD. 2 = INSTANT. 3 = BASE. 4 = GROUP. 5 = SIDE. respawnDelay = 15; RespawnDialog = 1; // default = 1. show respawn timer and scoreboard when killed. respawnTemplates[] = {"MenuInventory", "MenuPosition"}; // "Seagull", "f_spectator", "f_JIP", "MenuInventory", "MenuPosition", "Tickets", "EndMission", "Counter", "Wave" respawnButton = 1; respawnOnStart = -1; //--- Revive ReviveMode = 1; //0: disabled, 1: enabled, 2: controlled by player attributes ReviveUnconsciousStateMode = 0; //0: basic, 1: advanced, 2: realistic ReviveRequiredTrait = 0; //0: none, 1: medic trait is required ReviveRequiredItems = 0; //0: none, 1: medkit, 2: medkit or first aid kit ReviveRequiredItemsFakConsumed = 0; //0: first aid kit is not consumed upon revive, 1: first aid kit is consumed ReviveDelay = 6; //time needed to revive someone (in secs) ReviveMedicSpeedMultiplier = 2; //speed multiplier for revive performed by medic ReviveForceRespawnDelay = 3; //time needed to perform force respawn (in secs) ReviveBleedOutDelay = 600; //unconscious state duration (in secs 6- bug happen rarely and affect all client connected also happen after restart time./. logs attached https://1drv.ms/u/s!Ali3CqUW9fqqgcMfOkj-nJwgOOS3GQ -
Freezing a variable in another variable.
Omurice. posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I currently have a script that tracks the velocity and distance traveled by a bullet. I have it set up currently to tell me these things in a hint box. After firing the weapon it displays the _velocity variable and the _distance variable and they update in real time through the hint. I want to know the distance at which the bullet becomes transonic (When the bullet drops beneath 343m/s). I need to get the _distance variables value when _velocity is equal to or less than 343 (something like if (_velocity < 343) then {_transonic = _distance};). The only problem is that if I set the new _transonic variable to be equal to _distance then in the hint box the variable will continue to update with _distance. I need a way to take the _distance variable at a given value of _velocity and take the exact value at that time and save it to another variable. I do know that I could just end the tracking when the _velocity reaches 343 but then the distance would no longer be tracked beyond that time. -
i have this script //init of the pad [h2,4,hlight1] execVM "Lightstime.sqf"; if (!isServer) exitWith {}; while {true} do { _var = _this select 2; if (daytime >= 17.5 || daytime < 6.5) then { if (isNil "_var") then { _var = []; _target_pos = getPos (_this select 0); _point = _this select 0; _light1 = "#lightpoint" createVehicle position _point; _light2 = "Land_runway_edgelight" createVehicle position _point; _light1 setLightBrightness 0.4; _light1 setLightAmbient[0.99, 0.99, 0.74]; _light1 setLightColor[0.0, 0.0, 0.0]; _light1 lightAttachObject [_point, [0,0,0]]; _var set [(count _var), "_light1,_light2"]; if(true) exitWith{}; }; } else{ if ( !(isNil "_var") ) then { { hint "light out"; deleteVehicle _x; }forEach _var; _var = nil; }; }; uiSleep 30; }; the code working for the spawn part (daytime from/to) edit: (when the time comes the lights is spawned.) but my problem is that i cant delete the lights . edit: (when the time pass , the lights is not deleted) i have made many tests with many code changes , but i have no luck yet. i think that the variable i want to set is not working . (hlight1 in this example) how can i check it? i want this script because i want to use it on many pads with unique variable on each one because i want to delete the lights on each pad on demand from another script (without the daytime command) thanks
-
array Compare var string to an array
JustRoger posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I searched for a long while for this before posting. (fairly new to this so keep the snark to a min) I am trying to compare a string against an array: _Wep = "Weapon1; _ArrayWeps = ["Weapon1", "Weapon2", "Weapon3"]; _IsInArray = _Wep in _ArrayWeps; // is _Wep inside the array should give me a boolean for _isInArray of true/false? or do I have to do: if (_Wep in _ArrayWeps) then { // true}; OR if there is a better way to please do share. I do appreciate the input. -
Using a variable from another script
fubister posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I can't figure out how to use same variable on 2 scripts, I'm guessing it's simple but I think I've tried everything with no luck, here is what I've got. 1.sqf private ["_uid","_otherplayer"]; _uid = getPlayerUID player; _otherplayer = lbData[3004,lbCurSel (3004)]; //some function [player,_uid] remoteExecCall ["client_fnc_rec",_otherplayer]; Up till now everything woks as it should including the remote exec for selected player. What I want is to use _uid from 1.sqf in 2.sqf and have not idea how to do that. 2.sqf private ["_uid"]; _uid = ??? //some function -
Command in nested loops - wrong result
pierremgi posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I'm in trouble with what I guessed a simple code but my double loop doesn't work. Aim: make all foot units and land vehicles without collision. Don't crush any body. To start, i did it simple: SP context. Repeatable simple scenario: On map: a Hunter player, 1 or 2 empty Hunter. (or any vehicle you want). 3 civilians. I run this simple code: 0 = [] spawn { result = []; { _veh = _x; { _unit = _x; _veh disableCollisionWith _unit; result pushBack [_veh,_unit]; } forEach (allUnits select {isNull objectParent _x}); } forEach (vehicles select {_x isKindOf "landVehicle" && !(_x isKindOf "WeaponHolderSimulated")}); hint str result; }; I obtain the hint for every couple (vehicle,civilian) but the weird thing is: - only one vehicle is fully collision disabled with the whole civilians; (last loop checked I guess) - the other vehicles are collision disabled with the last civilian (last checked probably), but not with the other ones. I did a full day of tests, coming from MP environment, as it was supposed to loop for spawned units. then simplify everything up to this basic test. Testing further, for variables: 0 = [] spawn { result1 = []; result2 = []; private ["_veh","_unit"]; // doesn't make any difference { _veh = _x; { _unit = _x; [_veh,_unit] spawn { params ["_car","_man"]; _car disableCollisionWith _man; result1 pushBack [_car,_man]; }; result2 pushback [_veh,_unit]; } forEach (allUnits select {isNull objectParent _x}); } forEach (vehicles select {_x isKindOf "landVehicle" && !(_x isKindOf "WeaponHolderSimulated")}); hint (str result1 + str result2); }; Now, my results are: - result1 = []; - result2 is a consistent array of couple (vehicle,unit)!!! Any idea? Thanks