SCRMaps
/
Sign in

Defence: waves and leaks

Enemies reaching the goal cost you a life.

4 min read

A defence map is three things: spawn enemies on a period, send them toward a goal, and count the ones that arrive. The timer and spawn lessons carry over unchanged.

Trigger { -- 생성된 적을 계속 목표 지점으로 보낸다
	players = {P8},
	conditions = {
		Deaths(P8, AtLeast, 24, "OrderTimer");
	},
	actions = {
		SetDeaths(P8, SetTo, 0, "OrderTimer");
		Order("Men", P8, "Track", Move, "Goal");
		PreserveTrigger();
	},
}
Re-issuing the order once a second stops enemies stalling on the path or wandering off it.

Leak handling is the heart of it: when an enemy enters the goal, remove it and take a life.

Trigger {
	players = {P8},
	conditions = {
		Bring(P8, AtLeast, 1, "Men", "Goal");
	},
	actions = {
		RemoveUnitAt(All, "Men", "Goal", P8);
		SetDeaths(P8, Subtract, 1, "Lives");
		DisplayText("\x13\x06적이 통과했습니다");
		PreserveTrigger();
	},
}

Trigger { -- 생명이 다 떨어지면 패배
	players = {Force1},
	conditions = {
		Deaths(P8, Exactly, 0, "Lives");
	},
	actions = {
		DisplayText("\x13\x06방어에 실패했습니다");
		Defeat();
	},
}
One counter on P8 is enough for lives, because the whole team shares the value.

If each player defends their own lane rather than a shared one, keep lives on CurrentPlayer and eliminate only the player who runs out. Win conditions are covered in a later lesson.

Sign in to track your progress