ServUO Version
Publish Unknown
Ultima Expansion
Mondain's Legacy
Sorry . . not even sure how to describe this problem.

I have a Monster that can spawn helper minions but when the main monster is killed, the helpers remain forever until they get killed (often they just roam around cluttering up the map for way too long).

Is there a way to have a timer in a creature's script that will delete the creature after a period of time?

Thanks for any help on this.

*bows*
 
In the parent mob you can have a field for the minion or list for minions and add them to that when spawned, once the mob dies, using the ondeath method, you can either delete the minions or start a callback timer to clean them up after x time, using the field or list as reference to the minions!
 
If this is of any help to others . . this is what I found and it works fine to clean up Minions who are spawned by a some other Boss type creature.

In the script header for the spawned Minion place this:
using Server.Spells;

Then in the script Constructor for the Minion place this:
int tm = Utility.Random( 3, 5 );
TimeSpan duration = TimeSpan.FromMinutes( tm );
new UnsummonTimer( this, this, duration ).Start();

The 'Utility.Random' numbers set the min/max time range the creature will stay in the world if still alive.

Cheers
 
Back