SCRMaps
/
Sign in

Death and respawn

Putting a player who lost their unit back into the game.

3 min read

A player with no unit has nothing to do. Respawning is needed in almost every map and the shape is simple: when they have no unit, count; when the count is up, give them a new one.

Trigger { -- 유닛이 없으면 부활 카운터를 올린다
	players = {Force1},
	conditions = {
		Command(CurrentPlayer, Exactly, 0, "Men");
		Deaths(CurrentPlayer, AtLeast, 1, "Joined");
	},
	actions = {
		SetDeaths(CurrentPlayer, Add, 1, "RespawnTimer");
		PreserveTrigger();
	},
}

Trigger { -- 240 사이클 뒤 부활
	players = {Force1},
	conditions = {
		Deaths(CurrentPlayer, AtLeast, 240, "RespawnTimer");
	},
	actions = {
		SetDeaths(CurrentPlayer, SetTo, 0, "RespawnTimer");
		CreateUnit(1, "Terran Marine", "Player Start", CurrentPlayer);
		CenterView("Player Start");
		DisplayText("\x13\x07부활했습니다");
		PreserveTrigger();
	},
}

CenterView brings the camera along. Without it a player spends a while hunting for where they came back.

Without the “Joined” check, empty slots that never joined will respawn forever. This class of bug never shows up when you test alone.

Sign in to track your progress