Can someone help me (my math is suck)

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,193
How can i make this damage just like this?

Level 1: 1.5 times agility
Level 2: 2.0 times agility
Level 3: 2.5 times agility
Level 4: 3.0 times agility

  • Events
    • Map initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Triplestrike = (Last created hashtable)
  • Triple Slash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Triple Slash //
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (triplestrikers is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on Triple Slash Hits <gen>
        • Else - Actions
      • Set TripleSlasher = (Triggering unit)
      • Set Target_TripleSlash = (Target unit of ability being cast)
      • Set hits = 3
      • Set TripleSlashInt[1] = (Agility of TripleSlasher (Include bonuses))
      • Unit - Pause TripleSlasher
      • Unit - Pause Target_TripleSlash
      • Animation - Change TripleSlasher's animation speed to 400.00% of its original speed
      • Hashtable - Save Handle OfTarget_TripleSlash as 0 of (Key (Triggering unit)) in Triplestrike
      • Hashtable - Save Handle Of(Triggering unit) as 2 of (Key (Triggering unit)) in Triplestrike
      • Hashtable - Save hits as 1 of (Key (Triggering unit)) in Triplestrike
      • Unit Group - Add (Triggering unit) to triplestrikers
  • Triple Slash Hits
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (triplestrikers is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Unit Group - Pick every unit in triplestrikers and do (Actions)
        • Loop - Actions
          • Set Target_TripleSlash = (Load 0 of (Key (Picked unit)) in Triplestrike)
          • Set TripleSlasher = (Load 2 of (Key (Picked unit)) in Triplestrike)
          • Set hits = (Load 1 of (Key (Picked unit)) from Triplestrike)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • hits Greater than or equal to 1
            • Then - Actions
              • Animation - Play TripleSlasher's attack animation
              • Unit - Cause TripleSlasher to damage Target_TripleSlash, dealing ((Real((Level of Triple Slash // for TripleSlasher))) x (Real(TripleSlashInt[1]))) damage of attack type Normal and damage type Normal
              • Set hits = (hits - 1)
              • Hashtable - Save hits as 1 of (Key (Picked unit)) in Triplestrike
            • Else - Actions
              • Unit - Unpause TripleSlasher
              • Animation - Change TripleSlasher's animation speed to 100.00% of its original speed
              • Unit - Unpause Target_TripleSlash
              • Unit Group - Remove (Picked unit) from triplestrikers
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Triplestrike
I think it is 1/2/3/4 times agility. I am so bad with Math and i am totally confused.
 
Level 42
Joined
Feb 27, 2007
Messages
5,273
If you can't find a function that produces the proper output like that you can always do something like thisthis:
  • -------- in an init trigger you set these --------
  • Set SpellAgiScale[1] = 1.50
  • Set SpellAgiScale[2] = 2.00
  • Set SpellAgiScale[3] = 2.50
  • Set SpellAgiScale[4] = 3.00
  • -------- then in the spell trigger: --------
  • Set SpellDmg = (SpellAgiScale[(Level of Triple Slash // for TripleSlasher)] x (Real(TripleSlashInt[1])))
  • Unit - Cause TripleSlasher to damage Target_TripleSlash, dealing SpellDmg damage of attack type Normal and damage type Normal
 
Last edited:
Level 20
Joined
Jan 3, 2022
Messages
353
@JFAMAP For the future: I suggest you to use Excel (LibreOffice) to test functions like these. But you can use Google too to experiment! =x*0.5+1 - Google Search
x = your level; e.g. 1, 2, 3, 4...
You want it to scale by +0.5 per level, so you get: 0.5*x
You also want it to start at 1.5 multiplier, then: 0.5*x + 1.0
For level one: 0.5*1+1.0 = 1.5 multiplier :)

You can experiment with other functions to understand their useful properties:
  • sqrt(x) (square root) increases slower with every x
  • x^2 increases faster with every x
  • x/(x+a) approaches 1 and so on.
 
Last edited:
Level 18
Joined
Jun 2, 2009
Messages
1,193
If you can't find a function that produces the proper output like that you can always do something like thisthis:
  • -------- in an init trigger you set these --------
  • Set SpellAgiScale[1] = 1.50
  • Set SpellAgiScale[2] = 2.00
  • Set SpellAgiScale[3] = 2.50
  • Set SpellAgiScale[4] = 3.00
  • -------- then in the spell trigger: --------
  • Set SpellDmg = (SpellAgiScale[(Level of Triple Slash // for TripleSlasher)] x (Real(TripleSlashInt[1])))
  • Unit - Cause TripleSlasher to damage Target_TripleSlash, dealing SpellDmg damage of attack type Normal and damage type Normal

No no my problem is i don't know when to open and close brackets.

@JFAMAP For the future: I suggest you to use Excel (LibreOffice) to test functions like these. But you can use Google too to experiment! =x*0.5+1 - Google Search
x = your level; e.g. 1, 2, 3, 4...
You want it to scale by +0.5 per level, so you get: 0.5*x
You also want it to start at 1.5 multiplier, then: 0.5*x + 1.0
For level one: 0.5*1+1.0 = 1.5 multiplier :)

You can experiment with other functions to understand their useful properties:
  • sqrt(x) (square root) increases slower with every x
  • x^2 increases faster with every x
  • x/(x+a) approaches 1 and so on.

I have a serious problem with brackets but yes it looks better.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,244
No no my problem is i don't know when to open and close brackets.
Brackets take precedence over other operations so they get evaluated first. In the case of nested brackets this means the inner bracket must be evaluated first so the outer bracket can be evaluated.

For example ((1 + 2) * ((4 / 2) - 4)) + 2 will be evaluated as such...
((1 + 2) * ((4 / 2) - 4)) + 2
((3) * ((4 / 2) - 4)) + 2
(3 * ((4 / 2) - 4)) + 2
(3 * ((2) - 4)) + 2
(3 * (2 - 4)) + 2
(3 * (-2)) + 2
(3 * -2) + 2
(-6) + 2
-6 + 2
-4
 
Status
Not open for further replies.
Top