Jump to content
black_hawk_mw2_87

How to: Cancel AI Spawning After A Trigger

Recommended Posts

Hello everyone! I need some help with scripting. I want to put several enemy squads against a fortified position that must be stopped. But in order not to mass to many enemy units on the ground and prevent fps from dropping down I want to make these enemy units spawn for... let's say... a couple of times after one of the units (entire group) is dead. In my case - enemy boats crossing a river. When one of the boats is disabled, destroyed or the enemy group on board is eliminated, this action should work only a few more times no matter which group is destroyed, so after this condition of destruction is completed for several times, they must stop spawning again. The better idea or solution would be if all enemy groups stop spawning after some time, for example 10 minutes. In this 2nd case - the players receives a task to hold the enemy for 10 minutes (or in the first case to hold X waves/boats). I know how to put the spawn module, but I am not sure if it consist any options to make this action repeat random number of times, for example. Would you help me?

Cheers!

Share this post


Link to post
Share on other sites

I actually have another idea, if that is possible. For example, instead of stop spawning a group of enemies, delete the group after several spawns using deleteVehicle group1, deleteVehicle group2 and so on for each enemy group on the ground. What would you recommend me after all? Which option should I use or which one would be easier to accomplish or more effective? Cheers.

Share this post


Link to post
Share on other sites

Another question. Let's say I have a solution for the spawn/de-spawn issue. I want to spawn a whole group instead of just one unit: a squad leader and his group in a boat, so they can would follow a waypoint and cross a river. I want to create a condition once this entire group is dead, another group to be spawned. But it should be absolutely the same group as the first one. Is this possible?

Share this post


Link to post
Share on other sites

You can spawn group than add killed eh for each unit where you can spawn new unit to this group.in this way you will have group immortal

Share this post


Link to post
Share on other sites
2 hours ago, black_hawk_mw2_87 said:

Another question. Let's say I have a solution for the spawn/de-spawn issue. I want to spawn a whole group instead of just one unit: a squad leader and his group in a boat, so they can would follow a waypoint and cross a river. I want to create a condition once this entire group is dead, another group to be spawned. But it should be absolutely the same group as the first one. Is this possible?

You might want to have a look at this:

 

 

 

Share this post


Link to post
Share on other sites
1 hour ago, dreadpirate said:

You might want to have a look at this:

 

 

 

Thank you very much, I will test this tomorrow! :) Cheers! :)

Share this post


Link to post
Share on other sites

OK, I have tested it, but the condition is not working. I have done everything the right way and I have used 1 condition in a trigger synched to the group's leader. The enemy group disappears, but when the condition is done, the group wouldn't spawn. Am I doing anything wrong?

Share this post


Link to post
Share on other sites
7 hours ago, black_hawk_mw2_87 said:

OK, I have tested it, but the condition is not working. I have done everything the right way and I have used 1 condition in a trigger synched to the group's leader. The enemy group disappears, but when the condition is done, the group wouldn't spawn. Am I doing anything wrong?

Possibly. There are a couple of things you can try:

  • 0 = [this, "DEBUG"] spawn jebus_fnc_main;

and see what it says....

 

The most common thing that trips people up is the pause radius. JEBUS is set to not spawn units if any players are within 200m by default (to stop enemies spawning right on top of players)

  • 0 = [this, "PAUSE=", 0] spawn jebus_fnc_main;

will override this.....

Share this post


Link to post
Share on other sites

It says that the trigger is activated, using the first code. Just one message. Then another one starts repeating: Enemies in pause radius. Waiting. What does this mean?

Edit: I firstly tried to move away enough, more than 200m away, and it didn't work. Then I simply moved the enemy group more than 200m away and started the scenario again. This time it has worked for me. But is it possible to make a group of enemies spawn closer?

Edit: it works until enemies are 200m away. But what code should I use to limit the number of spawns? And after they are completed, a task would be completed?

Share this post


Link to post
Share on other sites

And one more question. If the enemy is static without waypoints, in my case I have tried with a group inside a boat which is not moving just for the test, the next group spawns on them and the boat just explodes. In this case it wouldn't work without waypoints I guess? For example: if that is simply a static MG position? But what I actually want to know is how can I STOP the group to spawn in 10 minutes for example or IF another condition is activated (another trigger's condition)? In this case I'd be able to complete my task and hold off the enemy waves. Cheers!

Edit: the second script has worked. No messages.

Share this post


Link to post
Share on other sites

Edit: it all works!

I use this scrip: 0 = [this, "DEBUG", "EXIT=", myExitTrigger] spawn jebus_fnc_main;

I have created a trigger with a random condition and it's called myExitTrigger and it stops the script, so the same trigger can be used to complete the task.

Edit 2: do you know any script for showing a timer to count down the time while I am holding off enemies?

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

×