Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Gameplay.ActionForceRespawn


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
class ActionForceRespawn extends Scripting.Action;

// execute
latent function Variable execute()
{
	local SinglePlayerGameInfo gi;
	local PlayerController pc;
	local Character c;
	local bool temp;

	Super.execute();

	gi = SinglePlayerGameInfo(parentScript.Level.Game);

	if (gi != None)
	{
		pc = parentScript.Level.GetLocalPlayerController();

		if (pc != None)
		{
			temp = gi.bRestartLevel;
			gi.bRestartLevel = false;

			// kill label on all dead players, so if scripts want to refer to the player after respawn it works
			foreach parentScript.actorLabel(class'Character', c, 'Player')
			{
				if (c.health <= 0)
					c.Label = 'DeadPlayer';
			}

			gi.RestartPlayer(pc);

			gi.bRestartLevel = temp;
		}
		else
			logError("Couldn't get the local player controller");
	}
	else
		logError("The force respawn action only works for single player games");

	return None;
}

// editorDisplayString
function editorDisplayString(out string s)
{
	s = "Force the player to respawn";
}

defaultproperties
{
	returnType			= None
	actionDisplayName	= "Force Respawn"
	actionHelp			= "Forces the player to respawn, only works in single player games"
	category			= "Level"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 15:53:24.000 - Creation time: st 23.5.2018 00:10:40.273 - Created with UnCodeX