SCRMaps
/
Sign in

Experience and levels

Not just for RPGs - difficulty tiers in a defence map and ranks in an arena use the same structure.

5 min read

Putting level in a death counter is the obvious first idea, but maps that get large use Custom Score instead, for three reasons.

  • It costs no spare unit type. You run out of those eventually.
  • It already exists per player - nothing to set up or clean up.
  • It shows up on the game's own score screen for free.
Trigger { -- 적을 죽이면 경험치
	players = {Force1},
	conditions = {
		Kills(CurrentPlayer, AtLeast, 1, "Zerg Zergling");
	},
	actions = {
		SetKills(CurrentPlayer, SetTo, 0, "Zerg Zergling");
		SetDeaths(CurrentPlayer, Add, 10, "Exp");
		PreserveTrigger();
	},
}

Trigger { -- 경험치가 차면 레벨을 올린다
	players = {Force1},
	conditions = {
		Deaths(CurrentPlayer, AtLeast, 100, "Exp");
	},
	actions = {
		SetDeaths(CurrentPlayer, Subtract, 100, "Exp");
		SetScore(CurrentPlayer, Add, 1, Custom);
		DisplayText("\x13\x03레벨 업!");
		PreserveTrigger();
	},
}
Experience in a death counter, level in Custom Score. Subtract rather than SetTo 0 matters - setting it to zero throws the overflow away.

Checking level is a Score condition. This is the basic form of every level requirement, and in a large map it appears thousands of times.

Trigger { -- 레벨 400 이상만 입장
	players = {Force1},
	conditions = {
		Bring(CurrentPlayer, AtLeast, 1, "Men", "Dungeon Entrance");
		Score(CurrentPlayer, Custom, AtMost, 399);
	},
	actions = {
		DisplayText("\x13\x06레벨 400 이상부터 입장할 수 있습니다");
		MoveUnit(All, "Men", CurrentPlayer, "Dungeon Entrance", "Town");
		PreserveTrigger();
	},
}
Writing the restriction as “bounce them if they do not qualify” rather than “let them through if they do” keeps it to a single trigger.

Two ways to make a level mean something: swap the unit for a better one, or grant an upgrade. Upgrades leave the unit alone, which makes them easier to apply mid-game.

Different experience costs per level band need one trigger per band. Hundreds of levels is not something classic triggers can carry - that is the moment to move to EUD.

Sign in to track your progress