Jump to content
Sign in to follow this  
harkkam08

Trying to spawn an AI group

Recommended Posts

Guys Im very new to scripting and I apologize for creating a post, Ive tried my best to search the Biki, and forum posts but I still feel lost.

I'm trying to spawn a group of AI soldiers that spawn when the player reaches a certain distance in relation to them. Then they engage the player and respawn a couple of times and if the player retreats and goes a certain distance away they get deleted.

So its like

Player is 500m from village X and then two squads are spawned at Village X, then player engages the two squads, manages to kill one squad that respawns in the village. Player then decides to retreat to base and leaves the area and is further away than 500m then all the units in village X get deleted.

But if player X was to return to village X again, the script can keep a limit of how many times it allows the AI squad to respawn and remembers that last time it had lost one squad and had respawned once.

So it only lets a AI squad respawn once more if you set a limit to 2 respawns.

I know this is a lot to ask but I would really appreciate it.

I have NO idea where to even start with something like this. My knowledge is as far as putting a trigger down when radio alpha is executed.

Thank so much guys

Id be more than willing to learn if somebody can just point me in the right direction instaed. Id appreciate that too.

Edited by harkkam08

Share this post


Link to post
Share on other sites

Create it by steps and learn as you go.

First just make it so that when your player gets within 500m of a gameLogic your trigger spawns 2 groups (using BIS_fnc_spawnGroup perhaps).

Once you have that working, setup another trigger that checks if the spawned group is dead to respawn them again at the same gameLogic. Use createTrigger to make this dynamic trigger on the fly and feed it the group that you spawned from the first spawn.

Then overlay a variable on the gameLogic that says if the "town" is active or not. If the player ends up being 500m away from the gameLogic and the town is active, set it to deactivate and delete the current troops in the area. Use setVariable and getVariable for this.

Once you have that down, then use the same method to keep track of spawn counter. You'll use the two variables on the gameLogic to determine if new groups spawn so you'll need to add that check to your first spawning trigger function.

Try these steps, post what you've tried so far and see if you can get it working how you want it to. :) Let us know and we'll fill in the gaps for you!

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  

×