• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Insetting a math function in a trigger

Status
Not open for further replies.
Level 2
Joined
Jun 1, 2017
Messages
25
Hello i am trying to make my first damaging spell.
But i can't figure out how to put a formula like "((5*INT)+100)" where "Ok" is.

Capture.PNG
 
Level 7
Joined
Mar 10, 2013
Messages
366
Is "Ok" a variable? Most of the time, using arithmetics should help, since they give the power of using operators (+ - x and /)
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
Use arithmetic.

"Ok" is: arithmetic "a" + 100
"a" is arithmetic 5 * "b"
"b" is Conversion - convert integer to real ("c")
"c" is Hero - Hero Attribute, Int
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
It's under Hero - Hero Attribute
you can press H to find it, but there are several blocks with h, so you need to press it multiple times.

Make sure, that you used convert integer to real before, because hero - hero attrivute is an integer
 
Level 2
Joined
Jun 1, 2017
Messages
25
I'm totally lost, if any of you have the time could you upload a map with an example of the trigger in it?
 
Level 2
Joined
Jun 1, 2017
Messages
25
Can't seem to make the ability to do damage, what am i doing wrong?
 

Attachments

  • hilp.PNG
    hilp.PNG
    9.5 KB · Views: 34
Level 2
Joined
Jun 1, 2017
Messages
25
If 5x is changed into -5x and c is changed to something negative too, could it be made into a healing ability?
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
You only need - once (-*-=+). You still need to change +100 into -100.
I am not sure if UnitDamageTarget works with negative amounts, but you can try it.
You can also use Unit - Set Life, to heal a unit.
 

ISL

ISL

Level 13
Joined
Nov 7, 2014
Messages
238
Writing the whole calculation into just one spot may bring you some pain if you ever need to change it. Especially if your damage formula is extremely long.

Better separate them so they would look simple and come handier.
  • Set Damage = 50 // Basic damage
  • Set Damage = (Damage + (1.25*(Intelligence of Caster (Include bonuses))) // Intelligence Scaling
  • Set Damage = (Damage * 0.8) // Percentage scaling
  • Unit - Cause (Caster) to damage (Target) dealing (Damage) damage of attack type Spell and damage type Normal
 
Level 11
Joined
Jun 2, 2004
Messages
849
I sometimes convert a long calculation to a custom script to make updating easier.


Also negative values work fine with the damage trigger. However, if it's set to physical it will be subject to armor reduction.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
If 5x is changed into -5x and c is changed to something negative too, could it be made into a healing ability?
No it will not make it a healing ability. Healing is done by modifying unit current health, adding the heal amount to it. An ability like Holy Light will not trigger damage events when healing, but will when damaging undead.

Set unit life to current unit life + heal amount. Heal amount can be your existing formula.
 
Status
Not open for further replies.
Top