• 🏆 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!

[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 25
Joined
Sep 26, 2009
Messages
2,390
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