• 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] A very simple trigger...

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2012
Messages
159
Hello hive members
I have alot of trouble with an annoying easy trigger.
The spell this trigger is based on is Endurance Aura. The spell has 100 levels. It should increase his attack speed by 1% for every 1% health he is missing (yeah, boring work!). But at some point this trigger won't increase the spells level?
  • Rage
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Morogar the Crusher 0052 <gen> is alive) Equal to True
        • Then - Actions
          • Unit - Set level of Rage for Morogar the Crusher 0052 <gen> to ((((Integer((Max life of Morogar the Crusher 0052 <gen>))) - (Integer((Life of Morogar the Crusher 0052 <gen>)))) / (Integer((Max life of Morogar the Crusher 0052 <gen>)))) x 100)
        • Else - Actions
          • Trigger - Turn off (This trigger)
This is an example of the calculation of the trigger:
2000-1500 = 500
500/2000 = 0.25
0.25x100 = 25%.
 
The problem is that you can not represent 0.25 as an integer because integers are whole numbers.
You should do the conversion from "real" to "integer" after you have calculated everything.
(Like "Integer ((max life - life)/(max life))" )
(Which can be simplified to "Integer ( 1 - life/(max life))" )

Values like "max life" are of type "real" on default, e.g. they could be 0.001 or 1337.1337
But if you take two integers and divide them like this: 100/1000 the result will be rounded down and be 0.
 
Level 7
Joined
Jul 9, 2012
Messages
159
Hey, thanks for the reply. I have edited my trigger and tried to make it like you said, but I still have issues with it. - It still doesn't work.
  • Rage
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Morogar the Crusher 0052 <gen> is alive) Equal to True
        • Then - Actions
          • Unit - Set level of Rage for Morogar the Crusher 0052 <gen> to (Integer(((((Max life of Morogar the Crusher 0052 <gen>) - (Life of Morogar the Crusher 0052 <gen>)) / (Max life of Morogar the Crusher 0052 <gen>)) x 100.00)))
        • Else - Actions
          • Trigger - Turn off (This trigger)
Please correct me if it's wrong :)
 
Level 7
Joined
May 15, 2009
Messages
192
I have a fairly simple way to do it, but you would have to revert the Attack speed increase. So that level 100 is the lowest value, and level 1 is the highest attack speed value. If you make it like this, you can simply use percentage health of Morogar. Like below:

  • Rage
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Morogar the Crusher 0000 <gen> is alive) Equal to True
        • Then - Actions
          • Unit - Set level of Rage for Morogar the Crusher 0000 <gen> to (Integer((Percentage life of Morogar the Crusher 0000 <gen>)))
          • Game - Display to (All players) the text: (String((Level of Rage for Morogar the Crusher 0000 <gen>)))
        • Else - Actions
 
Status
Not open for further replies.
Top