• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Real Value Bugged

Status
Not open for further replies.
Level 3
Joined
Apr 5, 2016
Messages
21
So i was making a map, and i use real value to roll a number between 0.01 - 0.03 i make 3 different effect each abilities has a trigger like this:
Event - a unit starts the effect of ability
Condition - Ability being cast equal to (Dice Roll)
Action - Set (Roll) = roll a random number between 0.01 - 0.03
If (Roll) equal to 0.01 then blah blah blah the effect and keep repeating like that till 0.03


the problem is everytime i cast the ability it always get 0.03 it even got 2 effect at the same time so i tried removing the 0.03 and everytime i cast sometimes theres no effect sometimes there's an effect. how do i fix this? please help!
 
Level 3
Joined
Nov 3, 2017
Messages
25
Do you know that between 0.01 and 0.03 are, like, infinity amount of numbers? Guess you're looking for random number between integers 1 and 3
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Real equality test has a large epsilon error to it. The inequality comparator does correct floating point comparisons. This means that there exist real values that are both equal and not equal to each other.

For chance mechanics I recommend using random integer values instead. They are much easier to define and think about.
 
Level 20
Joined
Feb 23, 2014
Messages
1,265
Real(Integer(Random real number between 1 and 3)) / 100
So, convert Real to Integer and then to Real again?

I think it's better to just go with an integer for this one :)
Or do something like this if the OP really wants a Real - Real(Random integer number between 1 and 3)/100.
 
Status
Not open for further replies.
Top