Classic triggers have no random function. What they have is SetSwitch with Randomize, which flips a switch on or off at random. One switch is exactly 50%, so stacking them builds other odds.
Trigger { -- 보스가 죽으면 주사위를 굴린다
players = {Force1},
conditions = {
Kills(CurrentPlayer, AtLeast, 1, "Boss Unit");
},
actions = {
SetKills(CurrentPlayer, SetTo, 0, "Boss Unit");
SetSwitch("Drop A", Randomize);
SetSwitch("Drop B", Randomize);
SetDeaths(CurrentPlayer, SetTo, 1, "RollDrop");
PreserveTrigger();
},
}
Trigger { -- 둘 다 켜졌을 때만 = 25%
players = {Force1},
conditions = {
Deaths(CurrentPlayer, Exactly, 1, "RollDrop");
Switch("Drop A", Set);
Switch("Drop B", Set);
},
actions = {
SetDeaths(CurrentPlayer, SetTo, 0, "RollDrop");
CreateUnit(1, "Rare Item", "Player Start", CurrentPlayer);
DisplayText("\x13\x03희귀 아이템을 획득했습니다!");
PreserveTrigger();
},
}Switches are shared by the whole map, so two players rolling at once overwrite each other. That is why the roll is marked with a per-player counter and resolved inside the same cycle.
Odds like 25% or 12.5% are easy; 10% or 3% cannot be hit exactly this way. When you need a precise chance, that is what EUD's f_rand is for.
