Steffo
Member-
Content Count
2 -
Joined
-
Last visited
-
Medals
Community Reputation
1 NeutralAbout Steffo
-
Rank
Newbie
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
RUIS - Random Unit Invasion Script
Steffo replied to igneous01's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
My personal modified version of Ruis script, for running guerrila faction ... // RUIS script (Random Unit Invasion Script) v1.2 // changed attak waypoint to function as array - allows for spawned group to randomly select a position to move to // example: nul = [RUguy, [spawn1, spawn2, spawn3], attackwp, spawntimer, Scripttime] execVM "RUIS.sqf" // unit - this unit will be checked for what side and faction to spawn // [spawn1, ...] - gamelogics for units to spawn on // attackwp - an array of positions spawned units will move to (chosen randomly per group) // spawntimer - amount of time to wait until the spawning of a new unit // scripttime - the amount of waves this script will run (1 wave = 1 iteration of script spawning stuff) if (isServer || isDedicated) then { private ["_spawntime", "_logicS", "_logicE", "_temptime", "_scripttime", "_unit", "_perc", "_faction", "_side", "_MaxInf", "_MaxV", "_MaxLA", "_MaxArm", "_MaxAir", "_PInf", "_PV", "_PLA", "_PArm", "_PAir", "_EmptyGroups"]; _unit = _this select 0; _logicS = _this select 1; _logicE = _this select 2; _spawntime = _this select 3; _scripttime = _this select 4; // this sets the amount of waves the script will do _faction = faction _unit; _side = side _unit; _EmptyGroups = 0; // EDIT THESE VARIABLES TO CUSTOMIZE RUIS _MaxInf = 10; // Maximum amount of infantry that can be spawned in a single wave _MaxV = 3; // Max amount of vehicles to spawn _MaxLA = 3; // Max amount of light armored in a single wave _MaxArm = 1; // Max amount of armor _MaxAir = 1; // Max amount of air _PInf = 100; // Percentage chance of Infantry being spawned (100% = everytime, 0% = never) _PV = 50; // Percentage chance of vehicles spawning _PLA = 25; // Percentage chance of Light vehicles being spawned _PArm = 10; // Percentage chance of Armor being spawned _PAir = 5; // Percentage chance of Air being spawned // DO NOT EDIT PAST THIS // OA Takistani civil faction if (_faction == "BIS_TK_GUE") then { _unit setVariable ["infantry", ["TK_GUE_Group", "TK_GUE_GroupWeapons","TK_GUE_Patrol","TK_GUE_ATTeam","TK_GUE_AATeam"], true]; _unit setVariable ["vehicle", ["TK_GUE_Technicals", "TK_GUE_MotorizedGroup", "TK_GUE_MotorizedPatrol"], true]; _unit setVariable ["lightarmor", ["TK_GUE_MechanizedPatrol", "TK_GUE_MechanizedGroup"], true]; _unit setVariable ["armor", ["TK_GUE_T55Section", "TK_GUE_T34Platoon"], true]; _unit setVariable ["air", [], true]; }; // Functions for spawn if (isnil "DZ_Spawn_INF") then { DZ_Spawn_INF = { private ["_unit", "_loc", "_wp", "_spawned", "_logicS", "_logicE", "_unitarray", "_side", "_faction", "_MaxInf", "_locA"]; _unit = _this select 0; _logicS = _this select 1; _logicE = _this select 2; _side = _this select 3; _faction = _this select 4; _MaxInf = _this select 5; // spawn infantry a random of 5 times for "_i" from 1 to (ceil(random _MaxInf)) + 5 do { _unitarray = (_unit getVariable "infantry") select floor(random(count (_unit getVariable "infantry"))); _loc = _logicS select floor(random(count _logicS)); // spawn random units _spawned = [getPos _loc, _side, (configFile >> "CfgGroups" >> "Guerrila" >> _faction >> "Infantry" >> _unitarray),[],[],[],[],[],180] call BIS_fnc_spawnGroup; // move units to waypoint _locA = _logicE select floor (random(count _logicE)); _wp = _spawned addWaypoint [position _locA, 0]; _wp setWaypointType "SAD"; _wp setWaypointSpeed "NORMAL"; [_spawned, 0] setWaypointBehaviour "AWARE"; sleep (random 20); }; }; }; if (isnil "DZ_Spawn_V") then { DZ_Spawn_V = { private ["_unit", "_loc", "_wp", "_spawned", "_logicS", "_logicE", "_unitarray", "_side", "_faction", "_MaxV", "_locA"]; _unit = _this select 0; _logicS = _this select 1; _logicE = _this select 2; _side = _this select 3; _faction = _this select 4; _MaxV = _this select 5; // spawn vehicle random times for "_i" from 1 to (ceil(random _MaxV)) do { _unitarray = (_unit getVariable "vehicle") select floor(random(count (_unit getVariable "vehicle"))); _loc = _logicS select floor(random(count _logicS)); // spawn random units _spawned = [getPos _loc, _side, (configFile >> "CfgGroups" >> "Guerrila" >> _faction >> "Motorized" >> _unitarray),[],[],[],[],[],180] call BIS_fnc_spawnGroup; // move units to waypoint _locA = _logicE select floor (random(count _logicE)); _wp = _spawned addWaypoint [position _locA, 0]; _wp setWaypointType "SAD"; _wp setWaypointSpeed "LIMITED"; [_spawned, 0] setWaypointBehaviour "AWARE"; sleep (random 20); }; }; }; if (isnil "DZ_Spawn_LA") then { DZ_Spawn_LA = { private ["_unit", "_loc", "_wp", "_spawned", "_logicS", "_logicE", "_unitarray", "_side", "_faction", "_MaxLA", "_locA"]; _unit = _this select 0; _logicS = _this select 1; _logicE = _this select 2; _side = _this select 3; _faction = _this select 4; _MaxLA = _this select 5; // spawn light armor random times for "_i" from 1 to (ceil(random _MaxLA)) do { _unitarray = (_unit getVariable "lightarmor") select floor(random(count (_unit getVariable "lightarmor"))); _loc = _logicS select floor(random(count _logicS)); // spawn random units _spawned = [getPos _loc, _side, (configFile >> "CfgGroups" >> "Guerrila" >> _faction >> "Mechanized" >> _unitarray),[],[],[],[],[],180] call BIS_fnc_spawnGroup; // move units to waypoint _locA = _logicE select floor (random(count _logicE)); _wp = _spawned addWaypoint [position _locA, 0]; _wp setWaypointType "SAD"; _wp setWaypointSpeed "LIMITED"; [_spawned, 0] setWaypointBehaviour "AWARE"; sleep (random 20); }; }; }; if (isnil "DZ_Spawn_ARM") then { DZ_Spawn_ARM = { private ["_unit", "_loc", "_wp", "_spawned", "_logicS", "_logicE", "_unitarray", "_side", "_faction", "_MaxArm", "_locA"]; _unit = _this select 0; _logicS = _this select 1; _logicE = _this select 2; _side = _this select 3; _faction = _this select 4; _MaxArm = _this select 5; // spawn vehicle a random of 3 times for "_i" from 1 to (ceil(random _MaxArm)) do { _unitarray = (_unit getVariable "armor") select floor(random(count (_unit getVariable "armor"))); _loc = _logicS select floor(random(count _logicS)); // spawn random units _spawned = [getPos _loc, _side, (configFile >> "CfgGroups" >> "Guerrila" >> _faction >> "Armored" >> _unitarray),[],[],[],[],[],180] call BIS_fnc_spawnGroup; // move units to waypoint _locA = _logicE select floor (random(count _logicE)); _wp = _spawned addWaypoint [position _locA, 0]; _wp setWaypointType "SAD"; _wp setWaypointSpeed "LIMITED"; [_spawned, 0] setWaypointBehaviour "AWARE"; sleep (random 20); }; }; }; if (isnil "DZ_Spawn_AIR") then { DZ_Spawn_AIR = { private ["_unit", "_loc", "_wp", "_spawned", "_logicS", "_logicE", "_unitarray", "_side", "_faction", "_MaxAir", "_locA"]; _unit = _this select 0; _logicS = _this select 1; _logicE = _this select 2; _side = _this select 3; _faction = _this select 4; _MaxAir = _this select 5; // spawn vehicle a random of 3 times for "_i" from 1 to (ceil(random _MaxAir)) do { _unitarray = (_unit getVariable "air") select floor(random(count (_unit getVariable "air"))); _loc = _logicS select floor(random(count _logicS)); // spawn random units _spawned = [getPos _loc, _side, (configFile >> "CfgGroups" >> "Guerrila" >> _faction >> "Air" >> _unitarray),[],[],[],[],[],180] call BIS_fnc_spawnGroup; // move units to waypoint _locA = _logicE select floor (random(count _logicE)); _wp = _spawned addWaypoint [position _locA, 0]; _wp setWaypointType "SAD"; _wp setWaypointSpeed "NORMAL"; [_spawned, 0] setWaypointBehaviour "AWARE"; sleep (random 20); }; }; }; //player sidechat "getting into loop"; while {_scripttime > 0} do { _perc = round(random 100); _scripttime = _scripttime - 1; _temptime = _spawntime; //player sidechat format ["percentage: %1", _perc]; if (_perc <= _PInf) then { _infspawn = [_unit, _logicS, _logicE, _side, _faction, _MaxInf] spawn DZ_Spawn_INF; }; _perc = round(random 100); if (_perc <= _PV) then { _vehspawn = [_unit, _logicS, _logicE, _side, _faction, _MaxV] spawn DZ_SPAWN_V; }; // check if an index in the array exists if (count (_unit getVariable "lightarmor") > 0) then { _perc = round(random 100); //player sidechat format ["percentage: %1", _perc]; if (_perc <= _PLA) then { _laspawn = [_unit, _logicS, _logicE, _side, _faction, _MaxLA] spawn DZ_Spawn_LA; }; }; _perc = round(random 100); //player sidechat format ["percentage: %1", _perc]; if (_perc <= _PArm) then { _armspawn = [_unit, _logicS, _logicE, _side, _faction, _MaxArm] spawn DZ_Spawn_ARM; }; sleep 1; // check if an index in the array exists if (count (_unit getVariable "air") > 0) then { _perc = round(random 100); //player sidechat format ["percentage: %1", _perc]; if (_perc <= _PAir) then { _airspawn = [_unit, _logicS, _logicE, _side, _faction, _MaxAir] spawn DZ_Spawn_AIR; }; }; waitUntil {sleep 1; _temptime = _temptime - 1; _temptime < 1}; {if (({alive _x} count units _x) == 0) then {deleteGroup _x}} foreach allGroups; }; }; -
RUIS - Random Unit Invasion Script
Steffo replied to igneous01's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hello ! First, sorry for my english. Your script is great and i use it many time with some addon factions. But, is it run with factions of independent side ? I cant do it run anyway. :confused: // OA Takistani civil faction, // Custom Insert faction if (_faction == "BIS_TK_GUE") then { _unit setVariable ["infantry", ["TK_GUE_Group", "TK_GUE_GroupWeapons", "TK_GUE_Patrol", "TK_GUE_ATTeam", "TK_GUE_AATeam"], true]; _unit setVariable ["vehicle", ["TK_GUE_Technicals", "TK_GUE_MotorizedGroup", "TK_GUE_MotorizedPatrol"], true]; _unit setVariable ["lightarmor", ["TK_GUE_MechanizedPatrol", "TK_GUE_MechanizedGroup"], true]; _unit setVariable ["armor", ["TK_GUE_T55Section", "TK_GUE_T34Platoon"], true]; _unit setVariable ["air", ["Your air classname here"], true]; };