In my Natural Evolution Enemies mod, I have worms shoot units to the player.
The way it works is that I create a trigger entity that I kill and then spawn the units.
Currently it's instantaneously and I'd like to only like to spawn the newly created units like 5 seconds later. or in other words, kill the trigger entity in 5 seconds after it's created.
Here is the current code:
Code: Select all
script.on_event(defines.events.on_trigger_created_entity, function(event)
local entity = event.entity
--- Unit Cluster created by Worm Launcher Projectile
if entity.valid and global.launch_units[entity.name] then
writeDebug("Cluster Unit Created")
entity.die()
end
end)