Search the Community
Showing results for tags 'array'.
Found 43 results
-
getPos of EVERY object in an array and createVehicle on EVERY position in that array?
RabbitxRabbit posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I am trying to create a script for an incendiary bomb that sets fire to all objects within a 20m radius. So far, this is what I have: _objectList = nearestObjects [bomb1, [], 20]; //this creates an array "_objectList" of all objects within 20m of object "bomb1" _posArray = []; //this creates an array "_posArray" of the positions of each object in the previous array "_objectList" { _pos = getPosATL _x; _posArray pushBack _pos; } forEach _objectList; All of that works. What I can't figure out is how to create a fire on each position in the array "_posArray". I can create a fire on any ONE of the positions, using this: "test_EmptyObjectForFireBig" createVehicle (getPos (_objectList3 select index)); // where "index" is the index number of any one of the positions in the array _posArray" But I don't know how to create a fire on EVERY position. Thank you in advance for any help! -
Hello guys Obviously a simple thing but I can't make it work for hours now. What I need to put in trigger condition to work if activation is: onAct {_x playMoveNow "AmovPercMstpSnopWnopDnop_exercisePushup"} forEach thisList; ? How to refer all units in the trigger area to do exercises? The trigger is activated with a radio command. I know how to refer to specific units in the trigger area but how to do it for all units no matter if dead, alive or with a cold, no matter of side or anything else. Just condition to be inside the area? Thanks in advance
-
help Applying a custom texture to every vehicle of a certain class in mission
Tochka-U posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
So I want to make a script that checks the mission every set amount of time (30 seconds??) for new vehicles of a certain class and then applies a custom texture to those specific vehicles. I'm at beginner level and I really want to make this work. this what I've managed to make so far: { while {true} do { private _VicData = []; //Array made of all vehicles in the mission by class _VicData resize (count vehicles); for "_i" from 0 to (count vehicles) -1 do { _VicData set [_i, typeof (vehicles select _i)]; }; switch (true) do { case (_x iskindof "BWA3_Leopard2_Fleck") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_MBT.paa"]; }; case (_x iskindof "BWA3_Puma_Fleck") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_IFV.paa"]; }; case (_x iskindof "B_T_APC_Wheeled_01_cannon_F") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_APC.paa"]; }; case (_x iskindof "Fennek_Flektarn") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_MRAP.paa"]; }; case (_x iskindof "Fennek_Flektarn_HMG") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_MRAP.paa"]; }; case (_x iskindof "Fennek_Flektarn_GMG") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_MRAP.paa"]; }; case (_x iskindof "O_Truck_02_covered_F") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_Truck_01.paa"]; _x setObjectTextureGlobal [1, "files\FinTex\FDF_Truck_02.paa"]; }; case (_x iskindof "UK3CB_AAF_B_Gripen_G") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_Jet.paa"]; }; case (_x iskindof "ffaa_ea_ef18m") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_F18_01.paa"]; _x setObjectTextureGlobal [1, "files\FinTex\FDF_F18_02.paa"]; }; case (_x iskindof "BWA3_NH90_TTH_Fleck") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_Heli_01.paa"]; _x setObjectTextureGlobal [1, "files\FinTex\FDF_Heli_02.paa"]; }; case (_x iskindof "BWA3_NH90_TTH_M3M_Fleck") : { _x setObjectTextureGlobal [0, "files\FinTex\FDF_Heli_01.paa"]; _x setObjectTextureGlobal [1, "files\FinTex\FDF_Heli_02.paa"]; }; } foreach _VicData; sleep 30; } }; //didnt work for me -
Hi there. Kind of basic stuff but my brain today is not hooking me up: I need to verify possible inexistent objects in an array: // Soldiers that Editor has been dropped and named through the Eden: _targetsOnEden = [varname_1, varname_2]; // Loop for check if some soldier doesn't exist: { if ( _x isEqualTo objNull ) exitWith { systemChat "One or more soldiers don't exist" }; } forEach _targetsOnEden; But the error prints out saying "Error undefined variable in expression: _x" for some reason. All I need is to print that systemChat out without any game errors on screen.
-
optimization [SOLVED] 5 lines only. Can you do it with less?
thy_ posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, folks. Is there any chance you share a faster or more elegant way to write the same result below? Code goal: at the mission starts, search once all named markers and remove all found markers that aren't area markers (rectangles and ellipses), saving the result in a list for further purposes. Pretty sure even the first code line below could be smarter/complete. // Search through all markers on the map with the prefix "mark_" and append them in a list: _areaMarkersOnly = allMapMarkers select {_x find "mark_" isEqualTo 0}; // result example: ["mark_1", "mark_garbage", "mark_2"] but unfortunately including markers with unwanted shapes. { // forEach in _areaMarkersOnly: // It will be needed to identify what will be deleted later: _index = _areaMarkersOnly find _x; // If the marker (_x) is NOT rectangle and is NOT ellipse, so... if ( (markerShape _x != "RECTANGLE") AND (markerShape _x != "ELLIPSE") ) then { // delete this marker from my list: _areaMarkersOnly deleteAt _index; }; } forEach _areaMarkersOnly; SOLVED! Below, you see the code that works for me after the community advice: _acceptableShapes = ["RECTANGLE", "ELLIPSE"]; _prefix = "mark_"; if ( !_debug ) then { // Selecting only relevant markers: _areaMarkersOnly = allMapMarkers select { (_x find _prefix == 0) AND {(markerShape _x) in _acceptableShapes} }; } else { // For debugging purporses, the way to select the relevant markers here it is slightly different. Now selecting all markers shapes: _areaMarkersOnly = allMapMarkers select { _x find _prefix == 0 }; { // forEach _areaMarkersOnly: // _x index in the list, need it to delete _x from the list: _markerIndex = _areaMarkersOnly find _x; // if the marker has no the shapes acceptables, do it: if ( !((markerShape _x) in _acceptableShapes) ) then { // delete the marker from the list: _possibleMinefields deleteAt _markerIndex; // delete the marker from the map: deleteMarker _x; // and print this messages: systemChat format ["DEBUG > Marker '%1' has NO a rectangle or ellipse shape to be considered a area marker.", _x]; }; } forEach _areaMarkersOnly; }; -
Question about Multi-dimensional arrays #2
Prectatorium posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey guys, Same old, same old, yet another noob looking for clarification. The objective of the script is to: a) after loading map, go through all units, verify which are dead (cuz yeh, in SP you get this, in fact you get units that kill themselves as soon as the map loads, nothing you don't already know), and place a marker on the map. b) every time something is killed, well place a marker on the map. Why? Because reasons... I kid, you all know the camo in this game is too good. Ever spent a couple of minutes looking for a corps to loot that you killed at I don't how many hundreds of meters? Thing is, and as you all know, a dead body is a CIV body. Is this an issue? No, but yes. The issue arises when I attempt to get a color from a unit side, to make the marker that color. It's always "ColorCIV". Closes I've got was this. My approach is to create an array with all units, containing netId and side, them when the EventHandler for "EntityKilled" is triggered, get the id from the unit, cross reference it with the array created at map loading time, to get the side the unit was once apart of. The code is as follows // Create the array of the not yet dead I hope, and each not dead has an array with [ID,SIDE] _unitSidesWhenAlive = []; { _unitSidesWhenAlive set [_forEachIndex, [_x call BIS_fnc_netId, side _x]]; } forEach allUnits; // Create EH to take care of marking for all killed during gameplay addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator"]; if (isNull _instigator) then { _instigator = UAVControl vehicle _killer select 0 }; // UAV/UGV player operated road kill if (isNull _instigator) then { _instigator = _killer }; // player driven vehicle road kill _markerName = str(format ["%1 killed by %2",name _unit, name _killer]); // _sideColor = [side _unit, true] call BIS_fnc_sideColor; // My difficulties start here // An array within an array, attempting to get the index of the array, that contains the array with the units ID and SIDE // That is provided I'm actually contructing the array correctly. _unitNetId = _unit call BIS_fnc_netId; // The ID of unit that triggered "EntityKilled" _unitNetId_Index; // Were I hopefully am able to store the element of the unit's array, within the array contructed at the beginning { _unitNetId_Index = _x findIf { _unitNetId }; // Returns index of the unit's array I hope if (!isnil _unitNetId_Index) exitWith {}; // If the above is right, and we have an index, go no further. Boy does this scripting language } forEach _unitSidesWhenAlive; // have a learning curve // Create a new array to be able to get SIDE from ID _unit_Array = _unitSidesWhenAlive select _unitNetId_Index; // Set the damn color, that of the SIDE the unit used to belong to before it hit the dust _sideColor = [_unit_Array select 1, true] call BIS_fnc_sideColor; _marker = createMarkerLocal [_markerName, position _unit, playerSide call BIS_fnc_sideID, player]; _marker setMarkerAlphaLocal 1; _marker setMarkerColorLocal _sideColor; _marker setMarkerDirLocal (direction _unit); _marker setMarkerShadowLocal false; _marker setMarkerShapeLocal "ICON"; _marker setMarkerSizeLocal [1,1]; _marker setMarkerTextLocal _markerName; _marker setMarkerTypeLocal "hd_dot"; systemChat format ["%1 has been killed by %2", name _unit, name _killer]; // Extract from the log // I guess "_unit_Array select 1" does not return a SIDE? // Error in expression <e _unit, name _killer, side _unit_Array select 1, _sideColor]; // }]; // // { // _kind = ""> // 14:18:54 Error position: <select 1, _sideColor]; // }]; // // { // _kind = ""> // 14:18:54 Error select: Type Side, expected Array,String,Config entry // 14:18:54 File TGF_Init\functions\fn_markOnMapUnitKilled.sqf..., line 33 hint format ["%1 has been killed by %2. %3 color %4", name _unit, name _killer, side _unit_Array select 1, _sideColor]; // line 33 }]; // Mark all the dead after map has loaded // This actually works :) { _kind = ""; switch (true) do { case (_x isKindOf "Car"): {_kind = "Car"}; case (_x isKindOf "Tank"): {_kind = "Tank"}; case (_x isKindOf "Ship"): {_kind = "Ship"}; case (_x isKindOf "Helicopter"): {_kind = "Helicopter"}; case (_x isKindOf "Plane"): {_kind = "Plane"}; default {_kind = ""}; }; _text = ""; _markerType = ""; if (_kind == "") then { _text = "already dead"; _markerType = "KIA"; } else { _text = "already destroyed"; _markerType = "loc_destroy"; }; _markerName = str(format ["%1 " + _text, name _x]); _sideColor = [side _x, true] call BIS_fnc_sideColor; // This here, observation: // Syntax: createMarkerLocal [name, position, channel, creator] // I thought by providing "creator", I would have the ability to remove the markers, but not the case _marker = createMarkerLocal [_markerName, position _x, playerSide call BIS_fnc_sideID, player]; _marker setMarkerAlphaLocal 1; _marker setMarkerColorLocal _sideColor; _marker setMarkerDirLocal (direction _x); _marker setMarkerShadowLocal false; _marker setMarkerShapeLocal "ICON"; _marker setMarkerSizeLocal [1,1]; _marker setMarkerTextLocal _markerName; _marker setMarkerTypeLocal _markerType; systemChat format ["%1 " + _text, name _x]; hint format ["%1 " + _text + "." + "Side %2, color %3", name _x, side _x, _sideColor]; } forEach allDead; So, referencing data that resides in an array, itself in an array is my issue at the moment. Disclaimer: If you say I'm doing it wrong, to me, that much is a given. If you say this is pointless, hey, you clicked the link, you read the post, you know were I'm going with this. I very much do not enjoy this scripting language, the learning curve is... it's $@#% up. I guess until you get to know it... still $@#% up. Thank you. -
Pretty sure I'm stepping through a basic question but, really, I've TRIED hard all this afternoon to find out on my own how to make the forEach understand the array content are trigger variable names already dropped in place via Eden Editor. myTriggersVarNames = [ "myTrg1", "myTrg2", "myTrg3" ]; while {true} do { // Doesn't work: { if (player inArea _x) then { systemChat "Player inside the trigger"; }; } forEach myTriggersVarNames; // Working fine: /* if (player inArea myTrg1) then { systemChat "Player inside the trigger" }; */ sleep 3; }
- 4 replies
-
- triggervarname
- foreach
-
(and 4 more)
Tagged with:
-
.sqf Scripting with Array + forEach + forEach into a forEach
thy_ posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I need some help: my code is stuck in my own (low) understanding around array and forEach when they need/should work together. Below, may you kindly point out the mistakes and show the fixes? I already read a lot of BIS wiki looking for how to code forEach inside forEach, even it doesn't look so clever, feeling... private _drivers = [driver01, driver02, driver03]; private _cars = [car01, car02, car03]; While {true} do { // DRIVERS { // forEach _drivers start... if (alive _x) then // if the driver is alive, so... { if ((_x distance _targetMarker) <= 30) then // DONT KNOW BUT IM NOT SURE THIS IS RIGHT. ISN't IT? { if (lifeState _x == "HEALTHY") then // if the driver is healthy, so... { _x directSay _sound1; // the driver screams. if (!isNull objectParent _x) then // if the driver is onboard a vehicle, so... { hint "driver has a veh"; // show text on screen. }; }; }; }; } forEach _drivers; // repeat that for each driver. // CARS { // forEach _cars start... if (alive _x) then // if the cars alive, then... { if ((_targetMarker distance _x) <= 30) then // DONT KNOW BUT IM NOT SURE THIS IS RIGHT. ISN't IT? { <HERE EACH DRIVER> directSay _sound2; // I DONT KNOW HOW TO CALL ANOTHER ARRAY+FOREACH HERE. sleep 0.3; _something createVehicle getPos _x; // DONT KNOW BUT IM NOT SURE THIS IS RIGHT. ISN't IT? }; if ((damage _x) >= 0.1) then // if the car get damage, then... { hint "car got damage!"; // show the text on screen. }; }; } forEach _cars; // repeat that for each car. sleep 1; // a looping breath. }; // while next looping. -
inidbi2 Help - Saving Player Location (Help with an Array)
pliskin124 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi there, Thank you for taking the time to look at my post. I am trying to save the players location data into the idbi2 database. I have the Gear, Name, and UID all saving correctly, but for the life of me I cannot get the players location to save and read. I keep getting the error "error type String, expected number" on the init.sqf line 13 the "player setPosATL [_location select 0, _location select 1, _location select 2];" section. - Any help would be most appreciated. Init.sqf: _clientID = clientOwner; _UID = getPlayerUID player; _name = name player; _location = getPosATL player; checkForDatabase = [_clientID, _UID, _name, _location]; publicVariableServer "checkForDatabase"; "loadData" addPublicVariableEventHandler { _gear = (_this select 1); _location = [_this select 0, _this select 1, _this select 2]; player setUnitLoadout _gear; player setPosATL [_location select 0, _location select 1, _location select 2]; }; }; initServer: "checkForDatabase" addPublicVariableEventHandler { private ["_data"]; _data = (_this select 1); _clientID = (_data select 0); _UID = (_data select 1); _playerName = (_data select 2); _location = [_data select 0, _data select 1, _data select 2]; _inidbi = ["new", _UID, _location] call OO_INIDBI; _fileExist = "exists" call _inidbi; if (_fileExist) then { hint "FILE DOES EXIST, GETTING DATA"; null = [_UID, _clientID, _location] execVM "getData.sqf"; } else { hint "FILE DOES NOT EXIST, CREATING DATABASE"; null = [_clientID, _UID, _playerName, _location] execVM "createDatabase.sqf"; }; }; "saveData" addPublicVariableEventHandler { private ["_data"]; _data = (_this select 1); _UID = (_data select 0); _gear = (_data select 1); _location = [_data select 0, _data select 1, _data select 2]; _inidbi = ["new", _UID] call OO_INIDBI; ["write", ["Player Location", "Location", _location]] call _inidbi; ["write", ["Player Gear", "Gear", _gear]] call _inidbi; hint "data saved"; }; getData.sqf _UID = (_this select 0); _clientID = (_this select 1); _inidbi = ["new", _UID] call OO_INIDBI; _gear = ["read", ["Player Gear", "Gear", []]] call _inidbi; _location = ["read", ["Player Location", "Location", []]] call _inidbi; loadData = _gear; _clientID publicVariableClient "loadData"; saveData.sqf { _gear = getUnitLoadout player; _location = getPosATL player; saveData = [_UID, _gear, _location]; publicVariableServer "saveData"; }- 28 replies
-
array [Solved]selectRandom [ string, object ] array
rkemsley posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have 6 potential FIA Weapon Caches scattered around the map. (3 normal weapon caches, 3 special weapon caches). At the start of the mission, I would like all except for 1 from each weapon cache type to be deleted from the map, so I am only left with 2 weapon caches on the map. (Each weapon cache has a local map icon that shows the BLUFOR player where the weapon cache is located, which needs to be deleted as well). My current script, located in my "initServer.sqf". This doesn't seem to do anything (no error message or anything) on mission start and I am not sure why. Please help!- 9 replies
-
- arma 3
- deletemarker
-
(and 2 more)
Tagged with:
-
Array in blacklist of BIS_fnc_randomPos
MiB_rus posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I am trying to use array in blacklist of BIS_fnc_randomPos. In array all Towns of map. My task: to make spawn everywhere, except for the area of cities. towns = (nearestLocations [[worldSize / 2, worldsize / 2, 0], ["NameCity", "NameVillage", "NameCityCapital"], worldSize]); townsPosSize = []; { townsPosSize pushBack [(locationPosition _x select 0), (locationPosition _x select 1), ((size _x) select 0)*3]; _name = format["mrk_%1", text _x]; _foo = createmarker [_name, [locationPosition _x select 0, locationPosition _x select 1]]; _foo setMarkerSize [((size _x) select 0)*3, ((size _x) select 0)*3]; _foo setMarkerShape "ELLIPSE"; _foo setMarkerBrush "SOLID"; _foo setMarkerColor "ColorRed"; } forEach towns; //test for "_i" from 1 To 200 do { _newPosTest = [nil, [townsPosSize,"water", [getPos player, 600]]] call BIS_fnc_randomPos; _nameT = format["mrk_%1", _i]; _fooT = createmarker [_nameT, _newPosTest]; _fooT setMarkerType "hd_dot"; _fooT setMarkerColor "ColorGreen"; }; But the function BIS_fnc_randomPos ignores this (area of cities). I also tried _newPosTest = [nil, [towns,"water"]] call BIS_fnc_randomPos; But the result is the same. "water" - works, towns - not works. -
Creating an array from a stringtable
bbaanngg posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm using a stringtable.xml to store text dialogue for my mission. Is there any way to create an array of all keys within a container? For instance, if I have something like this: <Package name="Dialogue"> <Container name="Greeting"> <Key ID="STR_Greeting1"> <Original>Hello.</Original> </Key> <Key ID="STR_Greeting2"> <Original>Hi.</Original> </Key> </Container> I want to make a function that will create an array of all the keys inside the "Greeting" container in an sqf file. Something like this: _greetigns = ["STR_Greeting1", "STR_Greeting2"]; so that I can localize them and use them in order. Is there any way to do this? -
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. -
Hello, i want to have 3 markers on the map where i can get an action 40m from it. i can get it to work if i change (getMarkerPos _markerList) to getMarkerPos 'APF_1' but then only one marker works. it feels really dumb to make 3 actions for the same thing. Do anyone know how to get it to take the names in an array instead? sorry for bad english. _markerList = ["APF_1","APF_2","APF_3"]; player addaction ["<t color='#ff0066'>Plant</t>","actions\plant.sqf", "", 0, true, true, "", "alive _target AND _target distance (getMarkerPos _markerList) <= 40"];
-
Hello ! I have an array of objects in the format : [obj_10,obj_1,obj_12,obj_13,obj_14,obj_11,obj_2,obj_3,obj_4,obj_5,obj_6,obj_7,obj_8,obj_9] I would like to sort this array so it becomes : [obj_1,obj_2,obj_3,obj_4,obj_5,obj_6,obj_7,obj_8,obj_9,obj_10,obj_11,obj_12,obj_13,obj_14] Also please note that the array contains objects and not strings ! I tried the sort function on the array, but no luck 😕 I believe the problem arises from alphabetical sorting as obj_11 comes before obj_2. Any ideas on how to get around the issue ? Thanks for the help !
-
Need help. I want to get units in a group into nearby vehicles. But my code returns an error, as described in the comment, next to it. In my research I found only how to convert string into object. If they point me in a way to research and learn about, it's a big help. Thank you. private _Grupo = (group p1); private _VEIC = nearestObjects [_grupo, ["Car"], 30]; {_grupo addvehicle _x} foreach _VEIC; sleep 1; { _x assignAsCargo _veic} foreach units _grupo; //error, array type waiting for object (_veic is an array of nearestObjects) {[_x] orderGetIn true; [_x] allowGetIn true}foreach units _Grupo;
-
I want to make a ring course to fly through. The ring course will be defined by several markers (ringMARK1_1) and the ring itself has a trigger attached. Each time a ring is cleared I want it to snap to the next position. There is only one ring which moves from marker to marker. ringCHALLENGE.sqf ringChallenge = [] spawn { waitUntil { ring1==1 }; hint "Ring Challenge Activated"; currentRING= [ringMARK1_1,ringMARK1_2,ringMARK1_3] select 0; sleep 1; ["task1",[currentRING,true]] call BIS_fnc_taskSetDestination; ringGOAL setpos (getpos currentRING); }; What's the best way to update the ring position in a sequence? Can "select 0;" in the array be called something like "select next"? Is it better to use IF/WAIT for the next ring? Am I starting this all wrong?
-
Sort an array of array only by number
Crazy_Man posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I want to sort an array of array with strings and numbers but only on the number. With the highest number at the start of the array. _array = [["Player 1",1], ["Player 2",3], ["Player 3", 2]]; // The result I want is : _array = [["Player 2",3], ["Player 3",2], ["Player 1", 1]]; -
Hello there! I've been working the entire day and just came up with a new idea about an hour ago. I'm having problems reight now in gettin the "correct" item. My Goal is the following: I have stetup an array, which contains weapons, Alternative version of weapons and ultimatively the chance by using this: ["SomeWeapon",["WeaponSKin1","Weaponskin2"],70] Now, the problem is the following, im creating a random number the "general" chance. If the Chance of the weapon is lower, it gets added to an array. Creating a big array with all the weapons with a >70% spawnrate. Now I want to select only the weapon with the highest chance and cant seem to get it. I feel like im pretty close but can't figure it out right now (should take a break sometime soon ;) ). Anyway, thats what I have gotten so far: _chance = 100; _array = []; _selectedWeapon = ""; _pistol = [["hgun_ACPC2_snds_F",["hgun_ACPC2_snds_F"],70],["hgun_Pistol_heavy_01_F",[""],5],["arifle_MXC_Black_F",["arifle_MX_khk_F","arifle_MX_F"],35]]; _weapon = _pistol call BIS_fnc_SelectRandom select 0; { if (_chance <= _x select 2) then {_chance = _x select 2; _array = _array + [[_x select 0,_x select 1]]; _selectedWeapon = _array select ((count _array) - 1);}; sleep 1; hint format ["%1\n%2",_array, _selectedWeapon]; } foreach _pistol; Getting the alternate versions isnt big of the porblem, im currently just stuck with selecting the weapon with the highest chance blew the "general chance". Thanks in Advance, CP~
-
So I want to make things easier when randomizing things. Right now I have an array of vehicles, air vehicles, and units class names that I manually pulled from the in game editor. Im alright with manually selecting individual units but now I want to randomize the units vest, weapons, and headgear but I do not want to go through the in games edit loadout screen and export each vest and items then have to search the text to find the class name of the vest to add it to an array. Is there a way for the game to provide a list of ALL vests and ALL weapons ect. in the game including addons? If this is possible is there a way to do that to ALL vehicles and units on a given side like EAST or WEST? Is there a possible way to do this without creating an array like calling a BIS_FN?
- 3 replies
-
- class names
- array
- (and 6 more)
-
Hi. I have a question on arrays. //I get an output as array eg : _fruitarray = [["apple",1],["banana",4],["pear",32]] //I want to convert it to: ["apple","banana","pear"] //What would be the correct syntaxis for that ? //I tried: {_x select 0} foreach _fruitarray //but it only shows one of the elements, and I need an array to be returned. Thanx
- 6 replies
-
- array
- multiarray
-
(and 1 more)
Tagged with:
-
Creating an Array of units not in a trigger zone.
TheSkyStarKnight posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
So, I'm officially stuck. I've been looking everywhere, but I can't seem to find out how to create an array based on units that are NOT in a triggerzone. I discovered that it is fairly simple to collect an (_x array) of units inside of a trigger, however once I use this command: _List = list trigger; It gives me an empty array of units since nobody is in the trigger, even though the trigger is set to "ANY", "NOT PRESENT". Any ideas? -
Get an array of units's classnames with configclass
Crazy_Man posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I need help in creating an array of all zombies (Ryan's Zombies and demons mod) that exist on one side. For the moment i have this : zombies = "getNumber (_x >> 'side') == 0" configClasses (configFile >> "CfgVehicles"); But I miss one condition (maybe a getText) to have all the zombies' class. Like that : getText (_x >> '????') == ???? Can anyone help me? -
Obviously based on my question my Arma scripting experience is limited. I have other coding experience but the Arma nuances make it difficult for me to find out where I am going wrong. I have done a bunch of research and I have found examples of what I want but none are working. If anyone has suggestions it would be very helpful. What I would like to do is step through the players cfgpatches and check to see if each element of that array is in another array or not. If not display text and endmission. I know this question has been asked but in each thread the examples do not work as expected. Below are the three methods I have tried to get what I want done to work. First attempt mods = ["Element1","Element2","Element3"]; _classes = []; _cfg = (ConfigFile >> "CfgPatches"); _itemCount = (count _cfg) - 1; for "_i" from 0 to _itemCount do { if (isClass (_cfg select _i)) then { _classes = _classes + [configName (_cfg select _i)]; }; }; if (!( str _classes in mods)) then { player groupChat "You are using a mod that is not allowed, please check list of approved mods. you are being returned to the lobby in 15 seconds"; sleep 15; "end1" call BIS_fnc_endMission; }; Second Attempt _mods = ["Element1","Element2","Element3"]; _patches = (ConfigFile >> "CfgPatches"); _c = count _patches; _loop = true; _n = 0; _arr []; while{_loop}do{ _cur = _patches select _n; if not(_cur in _mods) { player groupChat "You are using a mod that is not allowed, please check list of approved mods. you are being returned to the lobby in 15 seconds"; sleep 15; "end1" call BIS_fnc_endMission; }; _n = _n + 1; if(_n > _c)then{_loop = false;}; }; _arr; Third Attempt _mods = ["Element1","Element2","Element3"]; _canPass = true; { if (!(["a3_", _x] call BIS_fnc_inString)) then { if (isClass _x) then { if ((!configName _x) in _mods) exitWith {_canPass = false;}; }; }; } forEach activatedAddons; if (!_canPass) exitWith { player groupChat "You are using a mod that is not allowed, please check list of approved mods. you are being returned to the lobby in 15 seconds"; sleep 15; "end1" call BIS_fnc_endMission; }; Any suggestions on how I might get one of these are similar code to work would be a big help, Thanks in advanced.
- 8 replies
-
- array
- cfgpatches
-
(and 2 more)
Tagged with:
-
(Solved, new problem)TypeOf not working well?
Erwin23p posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I'm trying to do a script where just a certain class of vehicles can acces. I have an Array with the classnames: then, I have another array in which the vehicles on the map that correspond to that type of classname are added to this other array. Well my problem is when the script adds the desired vehicles to the new array, they don't get in the array as the classname, but as the .p3d file and some random numbers.