GetLevelSpawnTime

From ZDoom Wiki
Jump to navigation Jump to search


Actor

clearscope int GetLevelSpawnTime () const

Usage

Retrieves the calling actor's spawn time relative to the current map, in tics.

Return value

The spawn time in tics as an integer.

Examples

This version of the Rocket will explode if it was still flying 2 seconds after its existence:

class TimedRocket : Rocket
{
	override void Tick()
	{
		Super.Tick();
 		// TICRATE is equal to 1 second (currently 35 tics)
		if (InStateSequence(curstate, spawnstate) && level.maptime - GetLevelSpawnTime() >= TICRATE * 2)
		{
			ExplodeMissile();
		}
	}
}

See also