[Programming] Random Initiative
Hey guys! so for my Alien RPG ruleset, I almost have a random initiative button working in the combat tracker; I'm just not sure how to get it to be actually random.
The way initiative works in the ARPG is you have 10 cards, everyone draws a card, some NPC's draw more than one (this can be simulated by dropping the entity in the combat tracker twice i suppose). So unlike with dice, we can't have repeating initiatives.
Is there a way to perhaps rig this to Trenloe's Basic Card Extension? or how might i set it up so that a number can't be used again?
this is what i've put into the CombatManager. nInitNum is set up that way just so i could see if it worked, i'm just not sure how to do the randomization with elimination of results.
Code:
function rollInit()
nInitNum = 0;
for _,v in pairs(getCombatantNodes()) do
nInitNum = nInitNum + 1;
DB.setValue(v, "initresult", "number", nInitNum);
end
end