This simple script sample will spawn 3 enemy groups around a central point in safe places. Fixed version, I accidentally posted the wrong code, this will work fine. I tested this in a mission and it works now.
_Center = _randPos2; _Circle1 = [_Center, 150, 150, 0, 0, 20, 0] call BIS_fnc_findSafePos; _Circle2 = [_Center, 250, 250, 0, 0, 20, 0] call BIS_fnc_findSafePos; _Circle3 = [_Center, 350, 350, 0, 0, 20, 0] call BIS_fnc_findSafePos; _aiShooters = [_Circle1,_Circle2,_Circle3]; { sleep 1; _mg13 = createVehicle ["rhs_KORD_high_MSV", _x, [], 0, "CAN_COLLIDE"]; _mgguy13 = [[0,0,0], EAST, ["rhsgref_ins_machinegunner"],[],[],[],[],[],232] call BIS_fnc_spawnGroup; ((units _mgguy13) select 0) moveInGunner _mg13; _mgguy13 enableDynamicSimulation true; _mgguy13 deleteGroupWhenEmpty true; } forEach _aiShooters; |
Spawn an enemy officer in a random position in an editor placed building and give him a name, this allows a trigger to fire when he is killed.
// Spawn an officer in the building named "CargoHQ". _randPos399 = [_pos , 0, 600, 12, 0, 0.3, 0] call BIS_fnc_findSafePos; _officer = [_randPos399, EAST, ["rhs_vdv_officer"],[],[],[],[],[],232] call BIS_fnc_spawnGroup; ((units _officer) select 0) setVehicleVarName "man1"; man1 = ((units _officer) select 0); ((units _officer) select 0) setpos (CargoHQ buildingpos random 6); ((units _officer) select 0) limitspeed 0; ((units _officer) select 0) setUnitPos "MIDDLE"; _officer enableDynamicSimulation true; // enableDynamicSimulation true; |
How to spawn an Arma 3 composition with a script.
_newObjs = [_randPos,random 360,0.0, "OutpostD"] call BIS_fnc_ObjectsMapper; |
This could be very useful to spawn a base for the enemy to use.
Get the name of the location a base has spawned at. This is an easy way to get the name of a location, instead of typing up pre-made location names.
TownLoc = currentAO call BIS_fnc_locationDescription; |
Place this code in the initServer.sqf file. This will make AAF forces enemies to BLUFOR and friends with OPFOR.
Resistance setFriend [East, 1]; East setFriend [Resistance, 1]; |
Make all buildings around a certain location invulnerable.
{ _x allowdamage false; } foreach (nearestTerrainObjects [[11540,17836.3,0],["house"],1900]); |
Finally, this code sample will spawn a cluster of hemp plants around a marker location.
for "_i" from 1 to 200 do { createVehicle ["CUP_p_fiberPlant_EP1",[(getMarkerPos "bombCenter" select 0)+ (_i*cos (_i*17.5)),(getMarkerPos "bombCenter" select 1)+ (_i*sin (_i*17.5)),0],[],0,"CAN_COLLIDE"]; }; |