• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to add damage with trigger?

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
Kobas, I believe it's a question to increase a spell's damage (unless you've found some secret ability which lets you increase the power of an item ability).
The simple solution would be to detect whenever the hero casts the spell.

The event would be "Unit starts the effect of an ability"
If you use multiple items: create an if/then/else with as condition "Ability being cast equal to [spell ID]"
And as actions, well whatever you want I assume.

The downside is that the damage done has a horrible timing (dealing damage before the spell is actually cast).
The bright side is that it's extremely easy if you compare it with the better solution (which would be a completely triggered ability).
 
OMG well he can then use Deal damage to unit with triggers ^^
No need for ability at all
Working on test map!

But he don't need that, he need item with aura that will increase hero damage that equal to his hp!

EDIT:

Sry I don't know how to do it!
I have idea but I just lost myself in triggers and variables
I even try Jass but didn't find any functions that can help

:xxd:
 
Last edited:
The best way to do that, in case you don't want to get involved with Jass mechanism is to use Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (0.10 x (Percentage life of (Attacking unit))) of Attack Type Normal and Damage type Normal.

This means that your event should be "Unit - A unit is attacked" and the condition (Level of (your ability) for (Attacking unit) Greater than 0).

Note: This can be abused, by repeatedly ordering your unit to stop. To avoid that, you will need a damage detection system

  • One
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Three <gen> the event (Unit - (Picked unit) Takes damage)
  • Two
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Three <gen> the event (Unit - (Triggering unit) Takes damage)
  • Three
    • Events
    • Conditions
      • (Level of Bash for (Damage source)) Greater than 0
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Cause (Damage source) to damage (Triggering unit), dealing (0.10 x (Percentage life of (Damage source))) damage of attack type Spells and damage type Normal
      • Trigger - Turn on (This trigger)
Turn off the trigger helps us avoid the looping.
 
Level 12
Joined
Apr 16, 2010
Messages
584
Hehe, guys i think i wrote bad, i actually need to add damage to hero equal to his 10% of hp.
But this won't show that +xx damage on hero stats screen :sad:
Yes that's what i had in mind.
and
Kobas, I believe it's a question to increase a spell's damage
nope.

And i like the idea with the aura. Thanks. +rep

I was thinking and i just found out few things:

Well create damage aura
But all damage auras are based on damage of heroes or units not on life.
that effect only hero unit!
But what about other hero standing near. But i need to add damage only to one of them.
Set ability level to 100
Set values
It's a solution but as i said before it won't give damage equal to 10% of heroes' hp. For example, if hero has more damage then hp, then aura will calculate damage of hero and it will be seen that aura adds to much damage, cuz hero has 100 or 200 hp.

So you see guys i need to add damage as Huskars' third spell in DotA.
Sorry that i haven't mentioned it before, forgot.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
add damage with item ability
I thought you meant increase the damage of an item ability, my fault.

But all damage auras are based on damage of heroes or units not on life.
Yes and no.
There are aura's which just add +1/+2/... damage.
The trick is to let the spell have 100 levels and auto-fill them (from 1 to 100).
Then you can do it with triggers: if the hero has 100HP, then set the spell level to 10 ( = 10% of his HP in damage).


But what about other hero standing near. But i need to add damage only to one of them.
In that case, the only way is to completely trigger this system.
Which actually isn't hard for a damage aura.


I don't know anything about DotA as I don't like it's gameplay.
So giving a reference to DotA isn't going to help me at all.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Well, there is a more efficent way to have a small amount of spells/levels for big damage values. Since the data field in object editor of this ability you mentioned only allows integer numbers anyway, I assume you only need whole numbers. I have not seen the damage display having floats too.

The main point is that different instances of this ability do stack. So you could have an ability/levels with the hundreds values, one decadic and one for the last digit to compose 483=400+80+3 for example. This would be 3*9=27 ability levels (you can delete the ability for a null) for a range from 0 to 999, better than the 999 ability levels you'd have with the method you proposed I guess.

But you can reduce it even further. Each integer can be created by adding different powers of 2.

If you want to have 87 damage, you can split this into 64+16+4+2+1.

The range for n abilities (one level each) is from 0 to 2^n-1.
 
Status
Not open for further replies.
Top