• 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.

[Spell] Need help with trigger based spell

Status
Not open for further replies.
Level 2
Joined
May 8, 2014
Messages
12
I need help with create a spell:

Pyroblast
Cause [(Attack Power of unit)*2.1] magic damage to oponent.

- I need help with... How can i create spell with Attack Power of unit
!!!!!!NO HERO STATS!!!!!

Triggers or examples?

Thanx advance ;)
 
Level 2
Joined
May 8, 2014
Messages
12
-_- I have Damage detection....

I need function trigger spell...

Ability begin cást
Ability = Pyroblast
Cause to target unit (Attack Power x 2.1)

I need find variable Attack Power of unit

Example
If AP 26-31 (Magic).... cause 39-47 damage...

I have STR, AGI, INT function for heroes and i need Attack Power with all bonuses (buffs, equips, debuffs)...

Thanx advance ;)
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
If by attack power you mean unit's damage, then you will need to "tailor" a system that fits the unit that uses the spell.

You will need to save this prematurely somewhere:
- Damage Base (set up in Object Editor)
- Damage Number of Dices (in OE as well)
- Damage Sides per Dice (in OE)
- Unit's main attribute
- "Constant X" = Attack bonus per point in main attribute (found in Gameplay Constants) - this is a constant, it doesn't change throughout the game and is the same for everyone, but it is important to know the amount to get correct damage.

Hero's basic damage = Damage Base + [Main attribute*constant_X] + [Number of Dices -- (Number of Dices * Sides per Dice)]

For example the Paladin hero unit:
- Damage Base: 0
- Damage Number of Dices: 2
- Damage Sides per Dice: 6
- Main attribute: Strength
- constant X: 1

At level 10, the Paladin has 46 strength, so his damage would be:
Damage = 0 + [46*1] + [2 -- 2*6] = 48--58

This is quite simple if only 1 unit-type can have the Pyroblast spell, if many different units would have this spell, you would need to save the required datas somewhere and load them when needed.

However if you want to include bonus damage from items and abilities, then the system would get complicated quite a lot imo.
You would need to catch when your hero picks/drops items that increase his damage (either by directly increasing damage or by increasing main attribute) and make e.g. "Bonus dmg" variable that saves that amount. For spells you would need to catch when the Paladin is targeted by specific spells that increase damage and once again save that amount. You would also need to handle auras that increase damage (Trueshot aura, etc.)

The auras/buffs could be handled a bit differently by checking if unit has that specific buff and if yes, increase damage... but I'm not sure if you can get level of ability from the buff (in case the ability that places buff on your hero has more levels)
 
Status
Not open for further replies.
Top