Author Topic: Randomised AI Group Respawn Script (TESTING)  (Read 687 times)

0 Members and 1 Guest are viewing this topic.

Offline norrin

  • Tutorial Writer
  • **
Randomised AI Group Respawn Script (TESTING)
« on: 05 Feb 2008, 02:12:43 »
Randomised AI Group Respawn Script

Based on idea by W0lle

A simple script that repeatedly spawns a group of AI units of random size, rank, skill and composition at a settable period of time.  Spawned groups can then be set a number of waypoints and waypoint types. 

Instruction for the test mission
In the test mission just run north towards the first road cone and the enemy units should start spawning every 20 seconds (deliberately set low so you can see it working) and then moving through 2 waypoints. Don't worry about shooting them as your unit has been setCaptive. As you can see a mixture of enemy units are spawned each time with a range of ranks and skill levels. Once you're sick of watching this then run toward the second cone, just a little further north, and the script will switch off.

How to implement
To make it work place a trigger on the map and in the onAct line put something like:

Code: [Select]
spawner1 = ["Spawn_1", 20, 4, [["marker_1", "MOVE"],["marker_2", "SAD"]], EAST, 1] execVM "AI_spawner\AI_spawner.sqf";
a. spawner1 is the unique script name, needed for terminating the script when another trigger is activated,
b. Spawn_1 is the marker name where you want the units to spawn each time,
c. 20 is the time between respawns,
d. 4 is the number of units in the group respawned each time,
e. [["marker_1", "MOVE"],["marker_2", "SAD"]]] are the two marker names and types that you want the spawned units to move to (You should be able to set as many waypoints as you like as the script will automataically detect these).
f. the side that the spawning units are friendly to
g. Skill range (skill will be set randomly between 0 and this number).
You'll also need to place markers on the map for each of the waypoints you want your units to move through eg marker_1 and marker_2 in the above example.

You'll also need a second trigger with this in the onAct line
Code: [Select]
terminate spawner1to switch the spawn script off.

You should be able to run several instances of the Spawn script without too much CPU overhead.

If you look in the script itself (AI_spawner.sqf) you can see and set the types of units you can spawn ((ine 22, put what ever you like in here - if you want to ensure that a certain type of unit appears more often then put it in the list on multiple occasions).

You can also set the ranks you want the spawned units to have in here (line 26) as well as the random skill level range (line 47).

ArmA 1.08 and 1.09

Please let me know if run into any problems or you have any suggestions for improvements.
« Last Edit: 05 Feb 2008, 09:41:26 by Loyalguard »

Offline Loyalguard

  • Former Staff
  • ****
Re: Randomised AI Group Respawn Script
« Reply #1 on: 05 Feb 2008, 09:41:10 »
Looks promising Norrin.  I will check it out over the next several days.