Jump to content
Sign in to follow this  
Fork122

Spawning AI Groups

Recommended Posts

I'm working on a simple little coop for flashpoint.  It's got a group of 9 special forces soldiers surrounded in a small clearing in the Tonali jungle.  They have to hold off the enemy at the LZ until a helicopter comes to extract them.

If it helps at all the mission looks like this:

wuhukx.jpg

The problem is I want to have a endless stream of enemies attacking the LZ from different directions.  Ideally, I'd like to have a group come from each of the 4 arrows in the picture above.  I've been trying to find a script or something to keep respawning the groups and have them head towards the LZ.  I've searched the forums and the internet, but I just can't find something that would work and that I understand.  I'd appreciate it if someone could help me out.

Share this post


Link to post
Share on other sites

As far as I know, it is impossible to actually create a group in a mission. For every group you want to use, you must create a group (even if it's one man) in the mission editor.

I wrote a script to spawn an air cav squad and posted it here the other day:

http://www.flashpoint1985.com/cgi-bin....3;st=30

You could use this as a basis to build on if you like. If you want unlimited waves, just modify it so there is always a guy at a safe inaccessable location.

Make no mistake, there is a lot of scripting to be done to sucessfully execute a spawn script.

Share this post


Link to post
Share on other sites

Fork, you may be interested in the following script suite from the Chain of Command:

Link to COC Forums

I think its function is to respawn enemy groups once they're dead a number of editor-set times, keeping all waypoints, etc.

Share this post


Link to post
Share on other sites

Here is a simple and remedial way to create an entire group:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"officerW" createUnit [getpos Player, player, {TempReference = this}, 1, "CAPTAIN"]

~1

; This next line takes the unit and creates a new group

[TempReference] join grpNull

"SoldierWB" createUnit [getpos Player, TempReference, {}, 0.75, "PRIVATE"]

"SoldierWG" createUnit [getpos Player, TempReference, {}, 0.75, "PRIVATE"]

"SoldierWMG" createUnit [getpos Player, TempReference, {}, 0.75, "PRIVATE"]

"SoldierWLaw" createUnit [getpos Player, TempReference, {}, 0.75, "PRIVATE"]

First unit spawn creates the unit within the players group...

also, the new unit gets assigned to a global variable for temporary reference ability. Followed by a short pause just to allow it to join a new group which is created.

Subsequent units get assigned to the referenced group.

The important thing is: [unit] join grpNull

will create a new group

Once 64 groups have been created it recycles and can cause erratic behavior

[EDIT] ColSanderslite: I highly recommend you check out the EnemyStack scripts by CoC. You would get a big kick out of em.

[EDIT 2] Corrected myself... the original code was wrong - was thinking of something else

Share this post


Link to post
Share on other sites

Wow, that's news to me. I'll have to try that out now!

So you create the unit inside of a group, then you create a new group and join the other units to it.

Share this post


Link to post
Share on other sites

Thanks for the link to that script biggrin_o.gif

What do I need to change to make the Enemy Stack scripts work with the BAS Tonal Rebels? (or any addon units)

I get lost in the tutorial once it gets to the part about Active and Available units.  I have the 4 spawn logics set up, but I get confused about what I have to do from there.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×