Jump to content
Sign in to follow this  
Arska134

Enemy attack every 5 minutes

Recommended Posts

How do i get enemy group attacking in my base every 5 minutes. So every 5 minutes new enemy group respawns at the marker and attacks to base. Tried to do something with createunit without success.

Share this post


Link to post
Share on other sites

Hey Arska134,

Cant remember at this moment the lines for createunit and giving them waypoints. But for the delay time thing your after just put a loop in you script and a time delay like this

#loop
~300
Your script lines here
goto "loop"

the ~300 is roughly 5 minutes so if you want it faster or to take longer just alter this number.

EDIT: I would also reccomend that you place one of each type of unit your wanting to spawn somewhere on the map where you wont see them with this line in thier initialisation field.

this stop true; this disableai "auto";[code]  This will stop most to all lag when they are spawned.

Regards,

LEGION7698.

Edited by LEGION7698

Share this post


Link to post
Share on other sites

How do i create group instead of one unit? Is this possible. I think 10 createunit lines looks stupid?

Do i set waypoint for the enemy group with setWPPos?

Share this post


Link to post
Share on other sites

It is possible to create a group instead of a unit but I cant remember of the top of my head how to. I will look into it later today if I get the chance.

Regards,

LEGION7698.

Share this post


Link to post
Share on other sites
How do i create group instead of one unit? Is this possible. I think 10 createunit lines looks stupid?

Do i set waypoint for the enemy group with setWPPos?

what you could do is create the first group in the editor and then let your script replace the dead soldiers in the group

_countEnemyGroupUnits = (count units group EnemyGroupName)-1
? (countEnemyGroupUnits < desiredNumber : _newSoldier = "TypeOfSoldier"  createunit [coordinates,EnemyGroupName]

since the game doesn't remove dead units from a group right away, you might want to add a loop that clears out any dead soldiers faster

this is from a script I wrote for a similar situation

_count = (count units _grp)-1
#removeDead
~0.01
_sol = (_grp select _count)
? not (alive _sol) : [_sol] join grpNull ; _sol setpos getmarkerpos "dump" ; _grp = _grp - [_sol]
_count = _count - 1
? _count > 0 : goto "removeDead"

the _sol setpos getmarkerpos "dump" basically removes the dead soldiers from the area to decrease lag

as for the waypoints, the newly spawned soldiers will keep following the existing waypoints of their assigned group. you can use setWPpos to change where they go or use type Switch triggers depending on what u want to do

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  

×