Logo Platform
logo amplifiers simplified

Generating A Random Number

Reply
Copied to clipboard!
10 years ago
Dec 16, 2014, 1:07:12 PM




I want to change the 0.15 with a number between -0.5 and 0.5 randomly. $(randomnumber) didn't work, or I couldn't get it done. How to do it, any idea?



This line is within SimulationDescriptors[Class].xml btw, maybe that helps.
0Send private message
10 years ago
Mar 17, 2015, 12:16:33 AM
If you look at line 196 of BattleActions[Unit].xml, you'll find your answer, but basically it's "$(RandomNumber)".



It's used in the bit of the file that defines the algorithm for determining whether an attack is a crit, hit, partial hit, or miss. My impression is that it generates a float between 0 and 1, but it might be -1 and 1 too.

[code]










InterpreterFormula="(0-1) max ( 1 min (2 - ((2 * $Link(Initiator|Property|ClassUnit:AttributeDefense)) / $Property(ClassUnit:AttributeAttack))))" />









$(RandomNumber) gt (0.9 - (0.1 * $Property(ClassUnit:StrengthRatio)))













$(RandomNumber) le (0.9 - (0.1 * $Property(ClassUnit:StrengthRatio)))

$(RandomNumber) gt (0.4 - (0.6 * $Property(ClassUnit:StrengthRatio)))













$(RandomNumber) le (0.4 - (0.6 * $Property(ClassUnit:StrengthRatio)))

$(RandomNumber) gt (0.1 - (0.15 * $Property(ClassUnit:StrengthRatio)))













$(RandomNumber) le (0.1 - (0.15 * $Property(ClassUnit:StrengthRatio)))









[/code]

Just found this yesterday while looking for something else, and then ran across this thread so thought I'd answer, even tho this is an old old post.
0Send private message
?

Click here to login

Reply
Comment