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

How to Calculate Damage Output of Spells?

Status
Not open for further replies.
Level 4
Joined
Aug 9, 2012
Messages
84
I am making a purchasable 'Explosive Arrow' spell item. When used it blows up on units upon their death, exploding them in blood and guts. However, that's the problem. The Event - A Unit Dies is too overgeneralizing. Therefore, instead of just the Explosive Arrow doing the exploding, every other spell explodes on/at the origin of a dying unit/player too.

It looks like this ball of fun in this HD YouTube video at: http://www.youtube.com/watch?v=N6xB7_xIYd8&feature=youtube_gdata

Here are the original triggers (the ones used to showcase the spell):

  • Exploding Arrow
    • Events
      • Unit - A unit Begins casting an ability
      • Unit - A unit Dies
    • Conditions
      • (((Dying unit) is A Hero) Equal to True) and ((Ability being cast) Equal to Exploding Arrow )
    • Actions
      • Special Effect - Create a special effect attached to the origin of (Dying unit) using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of (Dying unit) using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of (Dying unit) using Abilities\Weapons\SteamTank\SteamTankImpact.mdl
      • Special Effect - Destroy (Last created special effect)
And here is one of the recommended suggestions someone here made for the fix:

  • Exploding Arrow
    • Events
      • Unit - A unit Begins casting an ability / I even tried: Unit - A unit Uses an item
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Exploding Arrow / I even tried: (Item-type of (Item being manipulated)) Equal to Exploding Arrow
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of (Dying unit) using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of (Dying unit) using Objects\Spawnmodels\Human\HumanLargeDeathExplode\HumanLargeDeathExplode.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of (Dying unit) using Abilities\Weapons\SteamTank\SteamTankImpact.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
The above still doesn't work . . .

MINUS the abilities Event and the abilities condition and this works, of course. For some reason it won't bring the two events and conditions together so if a unit dies to the item being used, the explosion will trigger for the Explosive Arrow item only.

Furthermore what I need help figuring out is how to calculate the damage output of the Explosive Arrow item spell so that any other spell doing less damage than the Explosive Arrow doesn't explode on a unit's death. The Explosive Arrow does the maximum amount of damage possible in the Object Editor.

Relying on the Event - A Unit Dies is essential to me because it's guaranteed the animations, etc. will always trigger at/on the origin of a dying player. This does away with having to use a dummy unit and using 50-100+ lines of code.

What I need is an ingenious work-around to have the A Unit Dies event mitigated to only trigger with the Explosive Arrow item spell. There has to be a way.

P.S. I've looked and looked at other projectile systems, etc. and they either 1. Don't work 2. Have issues or leak really badly 3. Are not up-to-par with the best methods (not that mine really are either, I'm an ideas man) 4. They don't meet the exact caliber of my idea here.
 
Last edited:
the condition will never be true because both events will never fire at the exact same time. u will need to use event unit dies
condition dying unit is a hero
actions
then in here ull need to check if the ability is being casted.
using an ITE is probably ur best bet. this should do what u want
then do ur actions

also instead of dying unit use triggering unit

do detect the damage i guess ur trying to detect the actual amount of damage done?

if u are then u need to use a damage detection system. there are a few on this site.
 
Level 4
Joined
Aug 9, 2012
Messages
84
the condition will never be true because both events will never fire at the exact same time. u will need to use event unit dies
condition dying unit is a hero
actions
then in here ull need to check if the ability is being casted.
using an ITE is probably ur best bet. this should do what u want
then do ur actions

also instead of dying unit use triggering unit

do detect the damage i guess ur trying to detect the actual amount of damage done?

if u are then u need to use a damage detection system. there are a few on this site.

Alright, I have tried only using the Event - A Unit Dies Event alone and the Condition(s) - If Triggering Unit is a Hero equal to True, then in the action line: ITE - IF Ability Being Cast and/or Item-Type of Item Being Manipulated equal to [item] equal to True, THEN do actions, etc.

I tried all that and it still doesn't trigger. What happens is everything/anything used to kill units in the game triggers the animation effects and actions instead of just the Explosive Arrow item doing the exploding. I only want it to work for the Explosive Arrow item, not other spells to trigger the explosions too.

Can you link me to a good damage identifying system? I looked and looked but didn't come across anything relating to what I'm looking for exactly.

Even if I do obtain a good damage identifying system, what other additional Event would I have to use and Condition(s)? And will the problem still occur where the actions will always trigger so long as there's a dying unit on the map when killed?

Thank You.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Why don't you make the dummy cast a dummy buff on the target before dealing the damage so, if a unit dies, and has the buff (Boolean - Unit has buff), make the explotion.

I even think there's already a buff that makes units explode by default without triggers (Like Crixalis in Dota). Obviously, the buff will be applied only by the exploding arrow dummy.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
My suggestion is when you fire an explosive arrow you are actually firing it from an invisible dummy unit at the player's position. You can detect if explosive arrows kills something by seeing if the killing unit is the hero (normal arrows and skills) or the dummy (explosive arrow) and play the appropriate effect.
 
Level 4
Joined
Aug 9, 2012
Messages
84
My suggestion is when you fire an explosive arrow you are actually firing it from an invisible dummy unit at the player's position. You can detect if explosive arrows kills something by seeing if the killing unit is the hero (normal arrows and skills) or the dummy (explosive arrow) and play the appropriate effect.

Yeah, except that the firey explosion animation and blood explosion animation triggers with anything that is capable of killing a unit, any unit. It's not just limited between regular arrows and the purchasable Exploding Arrow.

I think deathismyfriend has it right about using buffs, somehow giving it to the unit that's about to die or being targeted, and if the unit has the buff, make the explosion animations trigger on the buffed unit.

The problem is, as always, I don't know how to do this or where to start because I've never played around with buffs like this.

Edit:
Why don't you make the dummy cast a dummy buff on the target before dealing the damage so, if a unit dies, and has the buff (Boolean - Unit has buff), make the explotion.

I even think there's already a buff that makes units explode by default without triggers (Like Crixalis in Dota). Obviously, the buff will be applied only by the exploding arrow dummy.

Dota's explosion animations --- if you watched the YouTube video in this Thread --- sad to say, do not meet the caliber of the custom animations I am using. This is supposed to be a BIG, realistic-like blood explosion upon death, not a rinky dink lesser one.

And as said, when it comes to hashtables (I'm not even going there) and now these buff recommendations, I've never messed with either in any such way you're speaking. I don't know how to make a unit cast a buff on a unit being targeted by a projectile. How does that work? You give the unit the spell in the Object Editor and make them force-use it? I just don't get it. It makes sense to do it like this but the coding methods are a whole different story.

That said, what I did try and do --- Magtheridon suggested to me in a PM --- is put a buff (I put sleep and even an aura-based buff) on my 'Exploding Arrorw' so that when it fires at the unit and kills it, it'll trigger the explosion animations on the dying unit. This is granted what I read from him is right, because he suggested something similar but didn't recommend a dummy unit be used like you're saying.

P.S. If ever this cool spell/attack gets to working I'd like to post it in a thread and make it CnPable for people's maps if they want to use it. I don't see it happening any time soon though considering my lack of knowledge in this stuff. I have the ideas but what good are those if they're not coded.
 
Last edited by a moderator:
You can also just have your object data ability deal 0 damage and trigger the damage dealt. This way you can easily find out if the damage kills the unit (current life minus damage <= 0) and have your explosion animation playing.

Easiest solution, imho!

Dr Super Good's solution is also great. You should go with either of these two. Having a buff placed on the unit is imho overcomplicating the stuff.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Siryan... be cool, be easy. I think Dota's Crixali's passive can be customized in the Object Editor and replace it with the model of the explotion you want. If not, you can trigger it. I never though about Hashtables; Anyway... This should work (Following Dr.SuperGood suggestion)

  • Trigger
    • Events
      • Unit - A Unit starts the effect of an ability
    • Conditions
      • Ability being cast equal to Explosive Arrow
    • Actions
      • Set Point = Position of (Triggering Unit)
      • Set Target = Target Unit of Ability Being Cast
      • Unit - Create your InvisibleDummyArrowShooter at Point facing Target
      • Unit - Add Generic Expiration timer to (last created unit) that expires in 4 seconds
      • Unit - Set level of ExplosiveArrowDamage equal to Level of Ability Being Cast
      • Unit - Order (Last Created Unit) to attack Target
      • Custom script: call RemoveLocation(udg_Point)
  • Trigger
    • Events
      • Unit - A Unit dies
    • Conditions
      • Unit type of Killing Unit equal to InvisibleDummyArrowShooter
    • Actions
      • Special Effect - Play your thing
      • Special Effect - Destroy (last created special effect)
Make the attack cooldown of the Dummy to a really high value so it doesn't attack more than once. Also create that ExplosiveArrowDamage ability just to adjust the damage done by the dummy based on the ability level on your hero. (I guess the ability deals more damage as ability level increases)

Now, if you want the arrow to go beyond your target and be able to hit another one (I'm not sure where I read that), that's a bit harder, and you would need either Hashtable or Unit Indexer, and handle the dummy parabola moving (to simulate the arrow), and all that stuff.

EDIT: You may have to play a bit with it to make the arrow coming out from the dummy looks like being shooted by the hero. Cooldowns, animations, attack backswing and that stuff...
 
Last edited:
Level 9
Joined
Nov 19, 2011
Messages
516
Point for: Spartipilo

What you are talking about is Flame Lord weapon skill. BTW regarding to Death 05-07-2013, 07:58 PM
Events don't need to be matched at the same time. In events is hidden 'OR'. So if any of event appears it will lunch trigger. 'AND' is in conditions. This way you can stack multiple events into one trigger like this:
Players 1 enters chat message
Players 2 enters chat message
Players 3 enters chat message

Can be in single trigger. Then refer to 'Triggering Player' to get player that lunched it.
 
Last edited by a moderator:
What you are talking about is Flame Lord weapon skill. BTW regarding to Death 05-07-2013, 07:58 PM
Events don't need to be matched at the same time. In events is hidden 'OR'. So if any of event appears it will lunch trigger. 'AND' is in conditions. This way you can stack multiple events into one trigger like this:
Players 1 enters chat message
Players 2 enters chat message
Players 3 enters chat message

Can be in single trigger. Then refer to 'Triggering Player' to get player that lunched it.

i wasnt tlking about the events lol i even said remove all the other conditions.
u almost never need to use the AND condition because the conditions block in both ITE and the trigger header are already in the AND state. only time u need to use AND is if u use it inside an OR condition block.
Also ik how to stack multiple events this was not wat i was tlking about.

plz dont double post instead hit the edit button

edit: when i said remove one of the events it was because both events will never fire at the same time so the trigger would never work.
 
Status
Not open for further replies.
Top