I'm a doctor, not a mechanic

Legacy:RandomSpawnPoint

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT :: Actor (UT) >> NavigationPoint (UT) >> RandomSpawnPoint (custom)

This spawnpoint is used in conjunction with the RandomCreatureFactory

//=============================================================================
// RandomSpawnpoint.
// Used by RandomCreatureFactories for spawning monsters
// Created by Naked Monster, updated by Timmypowergammer.
//=============================================================================
class RandomSpawnPoint extends SpawnPoint;
 
var ThingFactory factory;
 
function bool Create()
{
	local pawn newcreature;
	local RandomCreatureFactory pawnFactory;
	local pawn creature;
	local actor temp, A;
	local rotator newRot;
 
	if ( factory.bCovert && PlayerCanSeeMe() ) //make sure no player can see this
		return false;
 
	temp = Spawn(factory.prototype);
	if (temp == None)
		return false;
	newRot = rot(0,0,0);
	newRot.yaw = rotation.yaw;
	temp.SetRotation(newRot);
	temp.event = factory.tag;
	temp.tag = factory.itemtag;
	newcreature = pawn(temp);
	if( Event != '' )
		foreach AllActors( class 'Actor', A, Event )
			A.Trigger( Self, Instigator );
	if ( factory.bFalling )
		temp.SetPhysics(PHYS_Falling);
	if (newcreature == None)
		return true;
 
	pawnFactory = RandomCreatureFactory(factory);
	if (pawnFactory == None)
	{
		log("Error - use creature factory to spawn pawns");
		return true;
	}
	if (ScriptedPawn(newcreature) != None)
	{
		ScriptedPawn(newcreature).Orders = pawnFactory.Orders;
		ScriptedPawn(newcreature).OrderTag = pawnFactory.OrderTag;
		ScriptedPawn(newcreature).SetEnemy(pawnFactory.enemy);
		ScriptedPawn(newcreature).Alarmtag = pawnFactory.AlarmTag;
		ScriptedPawn(newcreature).SetOwner(pawnFactory);
	}
	else
		newcreature.enemy = pawnFactory.enemy;
	if (newcreature.enemy != None)
		newcreature.lastseenpos = newcreature.enemy.location;
	newcreature.SetMovementPhysics();
	if ( newcreature.Physics == PHYS_Walking)
		newcreature.SetPhysics(PHYS_Falling);
	return true;
}

Naked_Monster: It's working now!