• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Percentage

Status
Not open for further replies.
Level 2
Joined
Sep 6, 2009
Messages
13
Hi
I'm having trouble with percentages. I'm want to know two things

1- How to make abilities that have percent chance of causing different efects.
For example: A ability that have 50% of chance to hit the caster, and 50% of chance to hit the target.

And 2- How to make abilities based in an atribute percentage. For example: A ablility that damage the target by 30% of the caster HP.

Can someone help me please? :sad:
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
1.
  • Untitled Trigger 005
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to *your ability*
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 2) Equal to 1
        • Then - Actions
        • Else - Actions
2.
  • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (0.30 x (Percentage life of (Triggering unit))) damage of attack type Spells and damage type Normal
Use the arithmetic function for the damage. You can have arithmetic inside arithmetic.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
IF you want to make the ability from 0 ~ 100 %, here's what you gotta do

  • 25% chance ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (your ability)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 25
        • Then - Actions
        • Else - Actions
Random integer number between 1 and 100 refers to Range Values
...Less than or equal to refers to 25 refers to 25%

Like if you set the random integer number between 1 and 10
And set it to less than or equal to 2.5, it is STILL reads as 25%
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Oh yeah, SORRY about that lol
I meant to show him example that we can do ANOTHER way of numbering but ends up as a same result
Like this:
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 1000) Less than or equal to 250
      • Then - Actions
      • Else - Actions
 
Level 2
Joined
Sep 6, 2009
Messages
13
IF you want to make the ability from 0 ~ 100 %, here's what you gotta do

  • 25% chance ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (your ability)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 25
        • Then - Actions
        • Else - Actions
Random integer number between 1 and 100 refers to Range Values
...Less than or equal to refers to 25 refers to 25%

Like if you set the random integer number between 1 and 10
And set it to less than or equal to 2.5, it is STILL reads as 25%

Hey man, i dont understand very well.
So, in your example, it will have 25% of chance of making something, right?
And, if i want a differente value, just change the "less than or qual to" value, like 50% or 40%, right?
 
Hey man, i dont understand very well.
So, in your example, it will have 25% of chance of making something, right?
And, if i want a differente value, just change the "less than or qual to" value, like 50% or 40%, right?

Right, up to the value of the equation (25 in defskull's example), the chance differs.
 
Status
Not open for further replies.
Top