Fandom

World in Conflict Tool for ArmA2 Wiki

Ultimate spawning

32pages on
this wiki
Add New Page
Comments0 Share

Compatible with v7.0c (26/03/2011)

One simple but very important question -- is there a way to spawn completely pre-defined mission during gameplay?

aka. Unleashing the beast of spawning in ArmA2
G144

Only 144 groups per each side

Editor based AI script by triggerEdit

by Murklor

I searched around for such a script before and really failed to find anything something like it. Norrins AI/vehicle respawn script work great, but uses icky markers. Dont like filling my map with markers even if they are invisible. If a simple editor based triggered spawn script already have been done - well then this is a repost, LOL!

ArmAIIholic remark : from v8 you can get your mission copied to Clipboard exactly as you made it in the editor. But would it be useful if this script doesn't come with loader, right?

How it works Edit

- Deletes units on mission starts and save them for later usage and/or copy to Clipboard

- Spawn them again based on a trigger

- Unlike my sample mission, the AI should be given more time to get "accustomed" to the world. Spawning enemies too close to each other can cause wierd behaviour.

Supports:

- Any unit, any group (infantry, land vehicle and air vehicle groups)

- Supports mixed infantry and vehicle groups

- Many waypoints supported, unfortunetly not all types and combos (synching won't work)

- Four different modes: "once" mode (one shot), "repeated" mode (respawn), "wave" mode (fixed delay then respawn all), "reset" mode (units can be called again at will)

- Any kind of unit/trigger variable combo (i.e. you can have units going once together with respawning units and wave units etc. on the same trigger)

- Everything done in a single file

- Properly supports crews in turrets-on-turrets

Original Murklor's script Editor based AI spawn script by trigger, and ArmAIIholic's v8.

How to useEdit

File: WICT\sandbox\murk_spawn.sqf

Function: to allow for simple trigger based spawning using editor placed units and waypoints.

The script deletes all units when the mission start and the recreate them on command.

The script also captures mission, so it can be loaded with murk_spawn_loaded.sqf.

Unit (leader of group):

null = [#1,"#2","#3",#4,#5,#6,#7] execVM "WICT\sandbox\murk_spawn.sqf";

Parameters: 
#1 -- unit name (this) - OBJECT 
#2 -- trigger name - STRING
#3 -- spawn type ("once","repeated","wave" and "reset") STRING
#4 -- spawn lives (the amount of time the unit respawns, or wave number) NUMBER -- (optional)
#5 -- spawn delay NUMBER -- (optional)
#6 -- init string called for the leader of the group STRING -- (optional)
#7 -- will start removal sequence of all dead group members after X seconds (default 120) NUMBER -- (optional)

ModesEdit

  • REPEAT MODE, i.e. basic respawn based on lives
Example: null = [this,"triggername","repeated",4,30] execVM "WICT\sandbox\murk_spawn.sqf"; ---- Will spawn the editor unit based on the trigger, then respawn it 4 times with a 30 second delay upon death
  • WAVE MODE, this is fairly simple, just sleep a while then respawn. Spawnlives in this case is number of waves
Example: null = [this,"triggername","wave",5,60] execVM "WICT\sandbox\murk_spawn.sqf"; ---- Will spawn the editor unit once based on the trigger, then respawn the entire group (regardless of deaths) 5 times with 60 seconds between
  • RESET MODE, sleep a while then set the variable to false (even if you set it like 50 times over). Spawn lives is used to tick how many times its possible to reset.
Example: null = [this,"triggername","reset",5] execVM "WICT\sandbox\murk_spawn.sqf"; ---- Will spawn the editor unit once based on the trigger, then reset the trigger after a preset time (15 seconds default). The unit will be created when trigger is true again, maximum number of lives.
  • ONCE MODE
Example: null = [this,"triggername","once"] execVM "WICT\sandbox\murk_spawn.sqf"; ---- Will spawn the editor unit once based on the trigger

Working with stringsEdit

A string may consist of any number of ASCII characters and is enclosed by single-quotes (only in ArmA) or double-quotes.

Examples (ArmA2):

_string = "here is my string";
_string2 = 'It may contain a lot of characters #@$';

If you want to include double quotes (") in strings enclosed by double quotes, the inside double quotes have to be written twice.

_string1 = "my string ""with"" quotes";
_string2 = 'my other string "with" quotes';
_string3 = "another 'string' example";

For init string called for the leader of the group and waypoint statements you have to use this format : "another 'string' example"

Example: "[[WEST,'HQ'],nil,rSIDECHAT,'Enemy chopper!'] call RE;"

null = [this,"trig5","once",0,0,"[[WEST,'HQ'],nil,rSIDECHAT,'Enemy chopper!'] call RE;"] execVM "WICT\sandbox\murk_spawn.sqf";


or some less abstract example >> plane that takes units and drops them at waypoint :

  • paratroopers group leader init line:
nul = [this,"trig1","once",0,0,"{ _x moveInCargo plane1; _x assignAsCargo plane1} forEach (units paras);"] execVM "WICT\sandbox\murk_spawn.sqf";
  • plane waypoint statement :
[[WEST,'HQ'],nil,rSIDECHAT,'PARATROOPERS DROPPING!'] call RE; nul = [] spawn {{sleep (random 0.6); _x action ['eject', vehicle _x]; unassignVehicle _x;} forEach (units paras);};


Trigger activationEdit

triggers are activated now via

catch_trigger = "trigger_name"; publicVariable "catch_trigger";

Triggers is activate by Anybody with condition (vehicle player) in thislist). If I don't want my player that HALOed (or in chopper) to activate the trigger, the solution I've come around is this:

((vehicle player) in thislist) and (((getPosATL (vehicle player)) select 2) < 3)

which means that player in the vehicle will be able to activate the trigger only if his altitude is below 3m, in other words he will be able to do it in jeep or in helicopter (that is on the ground, but not in the air).

Saving your missionEdit

If you want to save mission, open init.sqf and find

//{}{}{}{}{}{}{}{}{} MISSION CAPTURE {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
//Capture your mission to Clipboard!!!
// negative number means OFF, greater or equal than 0 = number of seconds (more is better)
_null = [-10] execVM "WICT\missionCapture.sqf";

For example if you write :

 _null = [15] execVM "WICT\missionCapture.sqf";

mission will be saved to Clipboard after 15 sec from the mission start.

If you have many groups make sure that you give enough time to mission capturing procedure -- spawning units, remembering them and deleting takes some time depending on the numeber of groups used.

You will get notification that capturing process is done.

Loading missionEdit

1) You place as many groups as you can (max 144 groups per each side), e.g. make your mission on one part of the map...

2) In loader you have this line

{ _null = [_x] execVM "murk_spawn_loaded.sqf"; } forEach *** ;

in the place marked with *** you just paste Ctrl+V what you have captured from the editor.

3) Delete those units in editor and on some other part of the map make some other mission.

Caution : don't delete triggers, markers, etc., only units and their waypoints

4) Capture it, make new line in loader

{ _null = [_x] execVM "murk_spawn_loaded.sqf"; } forEach *** ;

and paste what you have captured.

5) Delete all units

6) When you Preview the mission all groups will be available and spawning by their triggers.

Tips and tricksEdit

Waypoint placement radiusEdit

psvialli : is there a work around as i am using seek&Destroy with a placement radius - how can i set that back up if use the loader?

Here is the catch for placement radius :

In init string, in the call, place some code (see full example below).

For example, you put this :

[(group this), 2] setWaypointPosition [(waypointPosition [(group this), 2]), 50];

It will set up a new position for the waypoint number 2 --- it takes the position of old waypoint and set's new position (in radius 50 -- which is the same thing editor does every time you start the game).

Zero waypoint is waypoint where group is created, so first waypoint in the editor is not zero (as you will see in editor, for example 0: MOVE), but one!!!!!!!! Be careful !

Full example :

null = [this,"t1","wave",5,60,"[(group this), 2] setWaypointPosition [(waypointPosition [(group this), 2]), 50];"] execVM "WICT\sandbox\murk_spawn.sqf";

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.