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

[Trigger] Damage only on attack

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
Hey there, I made a spell that when you damage someone you get mana. The problem is that it should only work on normal attacks and not when damaged with a spell.

Question: How do I make it only work on normal attacks.

Trigger 1 (Damage Receive Trigger):

  • Events
    • Map initialization
    • Unit - A unit enters (Playable map area)
  • Conditions
  • Actions
    • Trigger - Add to Devour Magic <gen> the event (Unit - (Entering unit) Takes damage)
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Trigger - Add to Devour Magic <gen> the event (Unit - (Picked unit) Takes damage)
Trigger 2 (Mana Restoring Trigger):

  • Events
  • Conditions
    • ((Damage source) has buff Devour Magic ) Equal to True
  • Actions
    • Set Caster = (Damage source)
    • Set Damage = (Real((Intelligence of Caster (Include bonuses))))
    • Unit - Set mana of Caster to ((Mana of Caster) + Damage)
(The Spell is based of Thorns Aura as dummy spell (That's the reason for the buff condition))

Thanks in advance, Quetzalcotl
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,545
Mind looking at his code for more then two seconds? kthxbai (oh, and you got pwnd).
It's not like it is THAT hard to spot in his 5-line GUI trigger...

Okay I see what you're saying, and I think you need to reconsider your understanding of the phrase pwned.

Now instead of being a flaming douche bag, why don't you explain to him the problem.
 

Cokemonkey11

Spell Reviewer
Level 30
Joined
May 9, 2006
Messages
3,545
Then I'll do it for you, since I'm not here to be funny.

  • Events
  • Map initialization
  • Unit - A unit enters (Playable map area)
  • Conditions
  • Actions
  • Trigger - Add to Devour Magic <gen> the event (Unit - (Entering unit) Takes damage)
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
  • Loop - Actions
  • Trigger - Add to Devour Magic <gen> the event (Unit - (Picked unit) Takes damage)
The problem is that you need to keep these triggers separate. You only want to check all unit's on map initilization, in any other event you want to add the event for ONLY the entering unit.

So split this into 2 triggers, 1 that adds all picked units on initilization, and 1 that adds entering (triggering) unit when it enters playable map area.
 
Level 7
Joined
Jul 9, 2008
Messages
253
I think you guys missunderstood me, the problem isn't that the damage taken doesn't work but that it should only work on normal attack insteads of attacks and spells...
 
Level 4
Joined
May 16, 2009
Messages
61
  • Mana Steal
    • Events
    • Conditions
      • ((Unit-type of (Damage source)) Equal to [I]The Unit[/I])
    • Actions
      • Set DamageMana = (Damage taken)
      • Set ManaGain = (Mana of (Damage source))
      • Unit - Set mana of (Damage source) to (DamageMana + ManaGain)
  • Mana Steal Units
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Unit-type of (Attacking unit)) Equal to [I]The Unit[/I])
    • Actions
      • Trigger - Add to Mana Steal <gen> the event (Unit - (Attacked unit) Takes damage)
If you use in a map please give credit to me!
 
Level 4
Joined
May 16, 2009
Messages
61
oh ya and this does not use any dummy spells so if you use it on a hero then make a dummy spell that turns those triggers on
 
Status
Not open for further replies.
Top