• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

damage source is the unit being attacked?

Status
Not open for further replies.
Level 5
Joined
Aug 19, 2015
Messages
68
Hey guys,
I have this trigger to give lumber on attack.
But it also gives lumber when the "damage source" is being attacked.
  • onhit vamps
    • Events
    • Conditions
    • Actions
      • Set aantileak_unit = (Damage source)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aantileak_unit Equal to Heiress 0015 <gen>
        • Then - Actions
          • Player - Add (Integer((150.00 + ((Damage taken) / 50.00)))) to valwinner Current lumber
          • Hero - Add (Integer((25.00 + ((Damage taken) / 34.00)))) experience to Heiress 0015 <gen>, Show level-up graphics
        • Else - Actions
      • Custom script: set udg_aantileak_unit = null

  • init enemies
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set aantileak_unittype = (Unit-type of (Entering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aantileak_unittype Equal to Gold supplier
        • Then - Actions
          • Set gsupp = (Entering unit)
          • Trigger - Add to onhit goldsupplier <gen> the event (Unit - (Entering unit) Takes damage)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • aantileak_unittype Equal to Vampire
              • aantileak_unittype Equal to Vampire Minion
        • Then - Actions
          • Trigger - Add to onhit vamps <gen> the event (Unit - (Entering unit) Takes damage)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • aantileak_unittype Equal to Vampiric Stun Tower
        • Then - Actions
          • Trigger - Add to onhit vamptowers <gen> the event (Unit - (Entering unit) Takes damage)
        • Else - Actions

How to do it properly?
Thanks.
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
First of all, making a DDS that way is bad because it leaks a Trigger Event meaning after the unit dies/removed, the event is still there. Second, units initially on the map are not added if they have a 'Vampire' unit type. This won't matter if your map has no units initially.
Now to fix your DDS, you need to periodically (i.e
every 60 sec) 'refresh' the onhitvamps. By 'refresh' I meant destroying and re-creating the onhitvamps trigger to remove all its Events. When re-creating, pick all units in the map and if the condition is true, add them to the Event via
'Trigger - Add to onhit ... the event a (Picked Unit) takes damage'

Now for your problem, you didn't set the valwinner variable.
 
Status
Not open for further replies.
Top