SCRMaps
/
Sign in

Skills and cooldowns

A production building becomes the skill button - the same structure serves an arena ultimate or a defence map's special ability.

9 min read

A skill is three parts: how it fires, what it does, and the cooldown. All three come from what you already have - production for the trigger, and death counters for the other two.

The most common way to fire one is to use a production building as the button. Give the player a barracks; when a marine comes out of it, treat that as “the skill was pressed”. The marine is removed immediately, so it never actually reaches the field.

Trigger { -- 마린이 나오면 스킬 발동 (쿨다운이 끝났을 때만)
	players = {Force1},
	conditions = {
		Command(CurrentPlayer, AtLeast, 1, "Terran Marine");
		Deaths(CurrentPlayer, AtLeast, 240, "SkillCD");
	},
	actions = {
		RemoveUnit("Terran Marine", CurrentPlayer);
		SetDeaths(CurrentPlayer, SetTo, 0, "SkillCD");
		MoveLocation("Skill Area", "Hero Unit", CurrentPlayer, "FIELD");
		CreateUnit(4, "Protoss Scout", "Skill Area", CurrentPlayer);
		SetDeaths(CurrentPlayer, SetTo, 0, "SkillDuration");
		DisplayText("\x13\x07스킬 발동!");
		PreserveTrigger();
	},
}
If the cooldown has not filled the condition is false and nothing happens - the marine simply stays there until the next trigger clears it.

So that marines do not pile up when the skill is pressed on cooldown, put a trigger below that removes them unconditionally. It must sit below the firing trigger so that a valid press is handled first in the same cycle.

Trigger { -- 쿼다운 중에 누른 경우
	players = {Force1},
	conditions = {
		Command(CurrentPlayer, AtLeast, 1, "Terran Marine");
	},
	actions = {
		RemoveUnit("Terran Marine", CurrentPlayer);
		DisplayText("\x13\x06아직 준비되지 않았습니다");
		PreserveTrigger();
	},
}

The effect turns on MoveLocation: snap a location onto the player's hero and you have “around me”, then create the effect units inside it. In the example above, four scouts appear around the hero.

Now the effect has to be cleaned up, using the conversion from the earlier lesson. 24 deaths is one second, so counting to 24 removes them after a second.

Trigger { -- 지속시간을 센다
	players = {Force1},
	conditions = {
		Command(CurrentPlayer, AtLeast, 1, "Protoss Scout");
	},
	actions = {
		SetDeaths(CurrentPlayer, Add, 1, "SkillDuration");
		PreserveTrigger();
	},
}

Trigger { -- 1초(24) 뒤 제거
	players = {Force1},
	conditions = {
		Deaths(CurrentPlayer, AtLeast, 24, "SkillDuration");
	},
	actions = {
		RemoveUnit("Protoss Scout", CurrentPlayer);
		SetDeaths(CurrentPlayer, SetTo, 0, "SkillDuration");
		PreserveTrigger();
	},
}
Change 24 for a different duration - 120 would be five seconds.

Finally the cooldown recharges. Firing set it to zero, so adding one per cycle until it reaches 240 makes the skill available again - 240 being ten seconds.

Trigger { -- 쿼다운 회복
	players = {Force1},
	conditions = {
		Deaths(CurrentPlayer, AtMost, 239, "SkillCD");
	},
	actions = {
		SetDeaths(CurrentPlayer, Add, 1, "SkillCD");
		PreserveTrigger();
	},
}
The AtMost condition is what stops it at the ceiling; without it the counter climbs forever.

Effect units must be cleaned up. Left behind they accumulate, slow the map down and become targets, which makes fights behave strangely. Making them invincible and hallucinated keeps them decorative.

With several skills, give each its own produced unit and its own counters. A marine from the barracks as skill one and a firebat as skill two lets a single building drive several.

MoveLocation moves a location but does not resize it - the skill's range is however large you drew it in ScmDraft. Give each skill its own.

Sign in to track your progress