How to set up a % chance trigger?

staind25

TH.net Regular
Reaction score
7
I need to make a trigger that says, basically, "If this unit is attacked, there is a 25% chance that this buff will be removed."

Any ideas on how to do that?

I just need to know how to set up the % chance. I can do the buff removal and all...but how do I tell the game to 'roll the dice' so to speak? Do I need a variable for this?

Thanks!
 

staind25

TH.net Regular
Reaction score
7
Pff, now if I would've looked around for 5 minutes before asking.........

I do believe Integer Comparison - (Random number integer between 1 and 4) equal to 4 should work, right? That should take a random number and if it's 4, then do the action?

Thanks
 

Exide

I am amazingly focused right now!
Reaction score
448
Here's the basic idea of how I do it:
Create an ability, for example based on Slow Poison (on that puts a buff on the target and has a 100% chance of hitting.)
Once you have that ability, you can modify it any way you want. The idea is to have a buff that is there for 0,01 seconds. (Just enough to check for it using a trigger.)

Now create a trigger that 'when any unit takes damage' - check if (Triggering unit) has buff *Your_Ability_Buff*, then do actions...

Notice that 'A unit is attacked' doesn't mean that the unit takes damage. (It can be bugged by right-clicking the target 1000 times - the trigger would fire 1000 times.)

"Umm 1 to 100 and if its below 25."
-1 out of 4 is also 25%
 

Menelaus

New Member
Reaction score
9
Pff, now if I would've looked around for 5 minutes before asking.........

I do believe Integer Comparison - (Random number integer between 1 and 4) equal to 4 should work, right? That should take a random number and if it's 4, then do the action?

Thanks

yup this solution is perfectly fine too
 

canons200

New Member
Reaction score
50
"Umm 1 to 100 and if its below 25."
-1 out of 4 is also 25%
this statement is not wrong, but in term of 1 out of 4 as compared to 2500 out of 10000, 2500 out of 10000 is more precise.

I did the experiment before, 1 out of 10 as compared to 1000 out of 10000, i perform the spell for 10000 times, the result from 1 out of 10 is 768 time success while the 100 out of 10000, 947 time success.

but of course, this random test doesn't always the same, but still the higher value, the more precise.
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
this statement is not wrong, but in term of 1 out of 4 as compared to 2500 out of 10000, 2500 out of 10000 is more precise.

I did the experiment before, 1 out of 10 as compared to 1000 out of 10000, i perform the spell for 10000 times, the result from 1 out of 10 is 768 time success while the 100 out of 10000, 947 time success.

but of course, this random test doesn't always the same, but still the higher value, the more precise.

I would agree. 1 out of 4 is 25% but its chance to come up will be less than 25 out of 100. That is why i said the above.
 

killingdyl

Active Member
Reaction score
6
lol learned this from math and bio class, "Probability is only true in big numbers" and by big i mean in the 100,000 to 1,000,000,000. so the higher your number, the more precise
 

Bogrim

y hello thar
Reaction score
154
Trigger:
  • Buff Chance
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) has buff Acid Bomb) Equal to True
      • (Random integer number between 1 and 4) Equal to 1
    • Actions
      • Unit - Remove Acid Bomb buff from (Triggering unit)

Replace Acid Bomb with whichever buff you're using.

lol learned this from math and bio class, "Probability is only true in big numbers" and by big i mean in the 100,000 to 1,000,000,000. so the higher your number, the more precise
1 out of 4 is the same chance as 25 or less out of 100, and 250 or less out of 1000. No matter how many numbers you put on the dice, the roll is still the same.

When your teacher said probability is only true in bigger numbers, he was talking about proving the percentage of a chance. If you roll a dice ten times, each side of the dice theoretically has a 1/6 chance but you might get the same side three times because that is the nature of a random chance. Randomness does not divide equally, but if you roll the dice enough times you will come closer to the theoretical number though you can never get a precise result.
 

staind25

TH.net Regular
Reaction score
7
I'm actually kind of curious how anyone would safely assume that higher numbers means a more precise "roll"...considering like everyone's mentioned, the whole point is that it's supposedly "random" (Even though I guess computers can't truly be random). But I mean, where would you get evidence that 100 out of 1000 is more accurate than 1 out of 10, when each time you test it, the results are EXPECTED to be different?

Just curious. It's actually something interesting to think about, and I'd like to know how that works.
 

Exide

I am amazingly focused right now!
Reaction score
448
I'm actually kind of curious how anyone would safely assume that higher numbers means a more precise "roll"...considering like everyone's mentioned, the whole point is that it's supposedly "random" (Even though I guess computers can't truly be random). But I mean, where would you get evidence that 100 out of 1000 is more accurate than 1 out of 10, when each time you test it, the results are EXPECTED to be different?

Just curious. It's actually something interesting to think about, and I'd like to know how that works.

To put it simple:
Probability theory is bullshit.
'nuff said.
 

Bogrim

y hello thar
Reaction score
154
I'm actually kind of curious how anyone would safely assume that higher numbers means a more precise "roll"...considering like everyone's mentioned, the whole point is that it's supposedly "random" (Even though I guess computers can't truly be random). But I mean, where would you get evidence that 100 out of 1000 is more accurate than 1 out of 10, when each time you test it, the results are EXPECTED to be different?
Read what I wrote in the post just above yours.
To put it simple:
Probability theory is bullshit.
'nuff said.
Because it's not the probability theory. If you roll a dice, there's an equal chance for every side to face up. While chance might be affected by the toss itself and other physical factors, it's generally considered to be random.

The probability theory is that if you throw that dice enough times, you will get results that prove the probability of 1/6 chance for each of the six sides to turn up.

Whoever started this debate got it wrong. It's not about throwing a dice with 1000 sides, but throwing a dice 1000 times to lessen the inaccuracy of randomness and therefore prove the theory.

Go to school and learn this stuff, or something.
 

staind25

TH.net Regular
Reaction score
7
Read what I wrote in the post just above yours

Yeah, I read that...my question was more directed to the people stating that 100 in 1000 is more precise than 1 in 10.

And yeah, you're probably right about the teacher meaning that the more you roll the dice, the more accurate your result...which is NOT the same as saying that 100 in 1000 is more precise than 1 in 10.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top