Search the Community
Showing results for tags 'bis_fnc_selectrandom'.
Found 3 results
-
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:
-
Hello everyone, I added a sound script in the task file, there are several audio files, I only know that "call BIS_fnc_selectRandom;" can be played at random, but I hope to play it in order in the game, I do not know the specific command What is it? I searched Google for a lot of web pages but didn't get what I wanted. I hope everyone can give me help. Thank you!
-
Help With Choosing A Random Variable (BIS_fnc_selectRandom)
atomickrypton posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello BIS Forums, I am working on a mission which involves a cool chase scene, and to put in a "randomness" factor, I have recorded 3 different paths the AI can take. The paths work, but for some reason, the script I am using to choose the random path isn't really working. Here it is: _poi = _this select 0; _randomMovement = ["pursuitPath1","pursuitPath2","pursuitPath3"]; _dataPath = _randomMovement call BIS_fnc_selectRandom; hint format ["The path will be: %1",_dataPath]; sleep 0.5; // The script works up until here.. if (_dataPath == pursuitPath1) then { hint "good"; _pursuit1 = [_poi] execVM "path\play.sqf"; // play, play3 and play4 are the files that make the AI follow the path, they all work when I execute them through the debug console or by trigger. waitUntil {scriptDone _pursuit1}; terminate _pursuit1; }; if (_dataPath == pursuitPath2) then { hint "bueno"; _pursuit2 = [_poi] execVM "path\play3.sqf"; waitUntil {scriptDone _pursuit2}; terminate _pursuit2; }; if (_dataPath == pursuitPath3) then { hint "gut"; _pursuit3 = [_poi] execVM "path\play4.sqf"; waitUntil {scriptDone _pursuit3}; terminate _pursuit3; }; I am still learning the basics and everything there is to scripting, so bear with me if I made a simple error. I believe it has to do with the condition with the if statement, however, I am not sure what to do and google has failed me in this endeavor. If there is any help you all can offer it will be greatly appreciated! Thanks all : )