Jump to content

Search the Community

Showing results for tags 'variable'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • BOHEMIA INTERACTIVE
    • BOHEMIA INTERACTIVE - NEWS
    • BOHEMIA INTERACTIVE - JOBS
    • BOHEMIA INTERACTIVE - GENERAL
  • FEATURED GAMES
    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
  • MOBILE GAMES
    • ARMA MOBILE OPS
    • MINIDAYZ
    • ARMA TACTICS
    • ARMA 2 FIRING RANGE
  • BI MILITARY GAMES FORUMS
  • BOHEMIA INCUBATOR
    • PROJECT LUCIE
  • OTHER BOHEMIA GAMES
    • ARGO
    • TAKE ON MARS
    • TAKE ON HELICOPTERS
    • CARRIER COMMAND: GAEA MISSION
    • ARMA: ARMED ASSAULT / COMBAT OPERATIONS
    • ARMA: COLD WAR ASSAULT / OPERATION FLASHPOINT
    • IRON FRONT: LIBERATION 1944
    • BACK CATALOGUE
  • OFFTOPIC
    • OFFTOPIC
  • Die Hard OFP Lovers' Club's Topics
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos
  • BI Forum Ravage Club's Forum Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Jabber (xmpp)


Skype


Biography


Twitter


Google+


Youtube


Vimeo


Xfire


Steam url id


Raptr


MySpace


Linkedin


Tumblr


Flickr


XBOX Live


PlayStation PSN


Origin


PlayFire


SoundCloud


Pinterest


Reddit


Twitch.Tv


Ustream.Tv


Duxter


Instagram


Location


Interests


Interests


Occupation

Found 24 results

  1. 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.
  2. 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?
  3. 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.
  4. 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.
  5. Currently using createVehicle to spawn an object under certain conditions. I'm wondering how to create a variable name once it has spawned.
  6. 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"); }];};
  7. 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.
  8. 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
  9. 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.
  10. 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
  11. 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.
  12. 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
  13. 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!
  14. 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
  15. 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)
  16. 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
  17. 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?
  18. 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;
  19. 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.
  20. 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
  21. 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 : )
  22. 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'" ];
  23. 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 ?
  24. 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
├Ś