Search the Community
Showing results for tags 'selectrandom'.
Found 2 results
-
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:
-
Spawn unit at random marker and create task
Theo Thalwitzer posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi I sure help someone can shed some light - I'm making a mission where I want several random tasks to be created at random marker positions. With this I have found a way which thus far proved very effective. I created 15 markers which I placed in appropriate positions for each task. Then an officer-unit, named S1, which I placed out of the way (simulation and damage disabled) until the script is called. The working script looks like this: // SCRIPT CODE // //Place officer (s1) at random marker ("red1"-"5") and start him patrol the area. Only markers and unit placed out of the way. Once the unit (s1) has been placed, another script (USPS.sqf) then gives the unit random waypoints to patrol. After that, another script (PWNR) spawns in a support group, also patrolling the area. Task complete when s1 is killed. _taskArray = ["red_1","red_2","red_3","red_4","red_5","red_6","red_7","red_8","red_9","red_10","red_11","red_12","red_13","red_14","red_15"]; //array with marker names _taskPos = _taskArray call BIS_fnc_SelectRandom; //select a random spawn position _officer1 = s1; s1 setPosATL getMarkerPos _taskPos, 100; [player,"Task_1",["A CSAT officer is around this area","Assassinate the officer","Kill"],_officer1,True] call BIS_fnc_taskCreate; sleep 0.5; s1 hideObject false; s1 allowDamage true; s1 setCaptive false; null = [s1, 100, 200, _taskPos, _taskPos, 200, true, "SAFE", "RED", "LIMITED", "FILE", 30, 30, 0, [true,35,25,3,1]] execVM "scripts\USPS.sqf"; sleep 0.5; nul = [_taskPos,200,"EAST GUERILLA INFANTRY UNITS",8] execVM "PWNR\Scripts\PUGS.sqf"; while {alive s1} do { waitUntil {not alive s1}; ["Task_1","Succeeded"] call BIS_fnc_taskSetState; }; As I said, this works fine as long as the unit (S1) and markers is placed in the editor. My objective: I want to create the same task WITHOUT placing the unit in the editor, but rather spawning him in with <createUnit>. In this regard I have made the following script: // Task: Kill HVT _hvtArray = ["hvt_1","hvt_2","hvt_3","hvt_4","hvt_5"];//Set location array _hvtPos = _hvtArray call BIS_fnc_SelectRandom; //Select random position from array _hvtGroup = createGroup EAST; // Create HVT group _hvt = "O_Officer_F" createUnit [position _hvtPos, _hvtGroup]; // Spawn HVT [player,"Eliminate_HVT",["We have pinpointed the position of a High Value Target in the indicated area. You are to relocate and eliminate the HVT.","High Value Target","Kill"],_hvt,True] call BIS_fnc_taskCreate; while {not isNull _hvt} do { waitUntil {not alive _hvt}; ["Eliminate_HVT","Succeeded"] call BIS_fnc_taskSetState; }; //The script exits with the following error refering, I think, to line 4 : <_hvt = "O_Officer_F" createUnit [position _hvtPos, _hvtGroup]; > and neither the unit is spawned, or the task is created. "Error position, Type String, Expected object, position" I have very little scripting experience but I'm learning fast. What am I doing wrong here?- 10 replies
-
- createunit
- selectrandom
-
(and 1 more)
Tagged with: