SCRMaps
/
Sign in

Idle games and automatic income

The number goes up on its own, and you spend it to make it go up faster.

7 min read

The idle loop is short: pay income on a period, and let the player spend that income on more income. Two counters do it - money, and level.

Trigger { -- 1초마다 단계만큼 돈을 준다
	players = {Force1},
	conditions = {
		Deaths(P8, AtLeast, 24, "IncomeTimer");
		Deaths(CurrentPlayer, AtLeast, 1, "Level");
	},
	actions = {
		SetDeaths(CurrentPlayer, Add, 10, "Money");
		PreserveTrigger();
	},
}
Resetting the timer belongs in its own P8 trigger. Reset it here and only the first player gets paid before it stops.

There is no multiply in classic triggers, so you cannot pay level x rate directly. The normal answer is one trigger per level, each adding its own amount; when the levels outgrow that, it is time for EUD.

Buying is the shop lesson again: check the money, subtract it, raise the level.

Trigger { -- 업그레이드 발판
	players = {Force1},
	conditions = {
		Bring(CurrentPlayer, AtLeast, 1, "Men", "Upgrade Pad");
		Deaths(CurrentPlayer, AtLeast, 500, "Money");
	},
	actions = {
		SetDeaths(CurrentPlayer, Subtract, 500, "Money");
		SetDeaths(CurrentPlayer, Add, 1, "Level");
		MoveUnit(All, "Men", CurrentPlayer, "Upgrade Pad", "Pad Exit");
		DisplayText("\x13\x07단계가 올라갔습니다");
		PreserveTrigger();
	},
}
Move them off the pad or they buy again next cycle, and keep buying while the money lasts.

This loop is the floor under maps like 직업키우기: hunt for money, spend it on hunting better, repeat.

In a map where players actually mine, the natural growth is an upgrade that raises how much a trip brings home. That is not a trigger job - it needs the struct - and what you need to know is five harvest orders.

The order ids of the harvest cycle
87Harvesting minerals.
83Harvesting gas.
151Has just interacted with a resource - and merely right-clicking a geyser also produces this, which is the classic bug in this approach.
85, orderState 0Has just returned minerals.
81, orderState 0Has just returned gas.

A computer-owned refinery reports gas harvesting as 79, not 83. Apply the same system to a computer player's workers and the gas half silently does nothing.

The shape is simple. While harvesting, subtract the bonus from the patch's own remaining amount at +0xD0 and note what you took in a scratch byte on the worker; when the return order appears, add that much with SetResources and clear the byte. Both halves are needed - give without subtracting and the patch becomes infinite.

Two things are easy to miss. The patch may have less left than the bonus, so take the smaller of the two or the 16-bit value wraps and the patch becomes enormous. And writing the remaining amount to 0 does not make the patch disappear - it goes on the next harvest, because the engine removes it when it is mined, not when the number is written.

Sign in to track your progress