Always snap to grid
Unreal Editor
Class ownage extends Mutator;
var array<AGP_PlayerStart> Spots; var bool bdoing;
event PreBeginPlay() { Level.Game.BaseMutator.AddMutator(self); }
event Tick (float DeltaTime) { local PlayerController PC;
foreach Level.DynamicActors(Class'PlayerController',PC) { if ((PC.PlayerReplicationInfo.bDead == True) && (PC.playerreplicationinfo.team.teamindex != 255) && PC.bInitialAuthComplete == true && (bdoing == false)) { bdoing = true; respawn(PC); } } }
function respawn(PlayerController Sender) { local AGP_PlayerStart StartSpot; local int i;
i = 0;
foreach Level.AllActors(Class'AGP_PlayerStart',StartSpot) { if (StartSpot.TeamNumber == Sender.PlayerReplicationInfo.Team.TeamIndex) { Spots[i] = StartSpot; i++; } }
if (Spots.Length == 0) {
AGP_Gameinfo(level.game).EnterSpectatorMode(Sender); HumanController(Sender).ClientResetSpectator();
Sender.PlayerReplicationInfo.bDead = true; bdoing = false; return; }
StartSpot = Spots[Rand(Spots.Length)];
if ( StartSpot == None ) { AGP_Gameinfo(level.game).EnterSpectatorMode(Sender); HumanController(Sender).ClientResetSpectator();
Sender.PlayerReplicationInfo.bDead = true; bdoing = false; return;
}
Sender.Pawn = Spawn(Sender.PawnClass,,,StartSpot.Location,StartSpot.Rotation);
if ( sender.Pawn == None ) { sender.GotoState('Dead');
bdoing = false;
return;
} else if(Sender.Pawn != None) { Sender.Possess(Sender.Pawn); Sender.ClientSetRotation(Sender.Pawn.Rotation); Sender.PlayerReplicationInfo.bDead = false; Sender.PlayerReplicationInfo.bOutOfLives = false; Sender.PlayerReplicationInfo.bIsSpectator = false; HumanController(Sender).SetStartupStage(1); Sender.bGodMode = True; settimer(8,false); bdoing = false; } }
function timer() { local PlayerController PC;
foreach Level.AllActors(Class'PlayerController',PC) { PC.bGodMode = false; } }
defaultproperties { bdoing=false;
}
<uscript>Insert code
</uscript>