How do I make a unit spawn projectiles?

help I can’t do that and when I try to do that I get an erro

1 Like

When do you want the unit to spawn the projectiles? Do you want the unit to attack using them when a hostile unit enters its sensor?

2 Likes

no i want the entity spawn projectile in 4 seconds without an hostile unit enters

1 Like

If you want the unit to create a projectile after a hostile unit hasn’t entered it in 4 seconds, you can make a script like this on the unit type. Make a global variable ‘found’ that has the data type ‘boolean’, and add an attribute on the unit whose initial value and max value is 4 that will be used for counting to 4 seconds.

This script will search for hostile units within the unit’s sensor every second, decrease the unit’s timer if none are found, and create a projectile if its timer is 0.


1 Like