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

Dealing damage with triggers

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Hey im trying to trigger my templar dealing 50 damage to a unit, Cannot find the trigger to do that :) ne1 know hao?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
native void UnitCreateEffectPoint (unit inUnit, string inEffect, point inTarget);
native void UnitCreateEffectUnit (unit inUnit, string inEffect, unit inTarget);
native int UnitValidateEffectPoint (unit inUnit, string inEffect, point inTarget);
native int UnitValidateEffectUnit (unit inUnit, string inEffect, unit inTarget);


Those let you use damage effects to deal damage to other units or points etc.

If you need to deal variable damage to a unit based on formula in a trigger try using behaviours as those can stack so make a behaviou have a stacking of like 10000 odd and get it to do like 1 damage a level or something like that.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Huh? lol. i dont know C or C++, i was wondering how to do it w/ trigz

and if u no understand, i mean like using a trigger to literaly reduce a target/s hp from 150/150 to 100/150
 
Level 5
Joined
Jun 13, 2008
Messages
102
When you put it like that you could use Set Unit Property to Current Life - 50, although this won't give credit for kills.

I think what DSG said could be done in GUI, go to Environment and do Create effect on unit (From Unit), just make an effect which is the damage you want and make sure it comes from the templar so it gets kill credit if you need to.
 
Level 11
Joined
Aug 1, 2009
Messages
963
Make multiple damage effects - each a power of 2, ie 1, 2, 4, 8, and so on.

Basically then you convert the damage you want to deal to binary and figure out which of the effects to apply. This would be a lot more efficient than applying a 1 dmg effect 100 times.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Does not do anything :+(

  • Atk
    • Events
      • UI - Player Any Player clicks Left mouse button Down.
    • Local Variables
    • Conditions
    • Actions
      • Point - Move Red Hero To (Point((Mouse X position clicked in the world), (Mouse Y position clicked in the world)))
      • Unit - Make RedHero face Red Hero over 0.0 seconds
      • Animation - Play Attack Default animation for (Actor for RedHero) as Default, using Play Forever options and Default Time blend time
      • Variable - Set Atf[1] = false
      • Variable - Set Atf[2] = false
      • Variable - Set Atf[3] = false
      • Variable - Set Atf[4] = false
      • Unit - Create 1 Apple for player 5 at Red Hero facing 45.0 degrees (No Options)
      • Variable - Set Bes[1] = (Last created unit)
      • Variable - Set Awk[1] = ((Position of Bes[1]) offset by 0.3 towards (Facing of Bes[1]) degrees)
      • Unit - Create 1 Apple for player 5 at Red Hero facing 135.0 degrees (No Options)
      • Variable - Set Bes[2] = (Last created unit)
      • Variable - Set Awk[2] = ((Position of Bes[2]) offset by 0.3 towards (Facing of Bes[2]) degrees)
      • Unit - Create 1 Apple for player 5 at Red Hero facing 225.0 degrees (No Options)
      • Variable - Set Bes[3] = (Last created unit)
      • Variable - Set Awk[3] = ((Position of Bes[3]) offset by 0.3 towards (Facing of Bes[3]) degrees)
      • Unit - Create 1 Apple for player 5 at Red Hero facing 325.0 degrees (No Options)
      • Variable - Set Bes[4] = (Last created unit)
      • Variable - Set Awk[4] = ((Position of Bes[4]) offset by 0.3 towards (Facing of Bes[4]) degrees)
      • Unit Group - Pick each unit in (Units in (Region((X of Awk[1]), (Y of Awk[2]), (X of Awk[3]), (Y of Awk[4]))) having alliance Any Exclude Self with player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
        • Actions
          • Environment - Execute Default Gun on (Picked unit) from RedHero

Replacing environment with kill works fine, when i make default gun do 20 damage, it does 0 damage

Edit : uhh okay, my radius is a bit small. after constant clicking, i got it to kill something lol. +Rep
 
Level 2
Joined
Jan 14, 2007
Messages
11
Unit A is unit dealing damage.
Unit B receives damage from Unit A

"Damage" is an effect of type Damage. Nothing is special about it. Leave it at the default settings of a damage effect.

Catalog - Set value of Effects "Damage" "Amount" for player (Owner of (Unit A)) to (String(damage amount you want) with Any Precision decimal places)
Environment - Execute Damage on (Unit B) from (Unit A)
 
Level 2
Joined
Jan 14, 2007
Messages
11
Feel bad I didn't tell you sooner. I found out about it a couple weeks ago. I figured the word spread around.

Thing you also need to know:

It doesn't work with all data values. Some don't seem to be able to be changed with the catalog action.

It sure beats using binary though and creating several damage effects.

:pal:
 
Status
Not open for further replies.
Top