StarCraft has no random number action. What it has is randomising a switch, which comes out Set or Cleared - zero or one. One binary digit.
So use several digits. Just as the 4 in 1423 means 400, a 1 in the second binary place means 2 and in the third means 4. Three places give you eight outcomes, 0 through 7.
- 1Randomise the switch.
- 2If it is Set, add 1 to a death counter. If Cleared, do nothing.
- 3Randomise again, and add 2 if Set.
- 4Randomise again, and add 4 if Set.
- 5The counter now holds a number from 0 to 7.
You do not need a trigger for the Cleared case: adding nothing is adding zero. And remember to reset the counter to zero before the next draw.
If the number of outcomes is not a power of two it does not divide cleanly. Six outcomes from three digits leaves 6 and 7 over, and folding those onto other results makes those results twice as likely - a bias that appears silently. Re-drawing when you land on a leftover is the honest fix.
Randomising three switches at once and writing one trigger per combination is the same idea - the shape enhancement maps usually use - and it carries the same limit: probabilities only in eighths. Something like 87% cannot be expressed this way.
In EPScript you can work in percentages directly. Call randomize() once in onPluginStart and take dwrand() modulo whatever range you need.
function onPluginStart() { randomize(); }
const roll = dwrand() % 100;
if (roll < 87) { 성공(); } else { 실패(); }
// 등급이 있는 뽑기는 두 번 굴립니다 / a tiered draw rolls twice
const tier = dwrand() % 100; // 1성 / 2성 / 3성
const pick = dwrand() % 100; // 그 등급 안에서 무엇이 / which one within itNudging the chance up after each failure - a pity system - is not free: it raises the long-run success rate above the number you configured, so 87% on paper becomes 90% in play. In a system with many draws, leave it out; the results converge on their own. In one with few draws, where the point is to stop a streak feeling unfair, it is a deliberate design choice rather than a correction, and it is clearer to call it that.
