Magic damage reflection

Status
Not open for further replies.
Level 25
Joined
Mar 23, 2008
Messages
1,813
I am creating a spell that triggers when my unit (that has a specific buff) gets damage by magic. When that happens he should damage the source with 10 % of the damage he has taken and create some fancy special effect on the source also. Its not hard to make this when being targeted by a target spell. But i cant figure it out how to make the trigger detect when being damaged by non-target spell and damage the source. How can i make that?
 
  • Map Initialization
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set T_Group = (Units in Playable Map Area)
    • Unit Group - Pick up every unit in (T_Group) and do (Actions)
      • Loop - Actions
        • Unit - Add (Picked unit) in (Damage_Group)
        • Trigger - Add to Trigger3 <gen> the event (Unit - (Picked unit) takes damage)
    • Custom script: call DestroyGroup (udg_T_Group)
  • Trigger2
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
    • ((Triggering unit) is in (Damage_Group)) Equal to True
  • Actions
    • Set Unit1 = (Triggering unit)
    • Unit - Remove (Unit1) from (Damage_Group)
    • Trigger - Add to Trigger3 <gen> the event (Unit - (Unit1) takes damage)
  • Trigger3
  • Events
  • Conditions
    • ((Unit1) has (Your buff)) Equal to True
  • Actions
    • Set Real1 = (Damage taken)
    • Unit - Cause (Unit1) to damage (Damage source) dealing (0.1*(Real1)) of attack type Spells and damage type Normal
 
I think that -for the second question- the second trigger is what does that. When a unit enters the Playable Map Area, it means that it's a new unit, so yes, the damage system is refreshed. The first trigger picks up every unit in the map to add it in the third trigger as a unit that takes damage. By default, the event "Unit takes damage" responds to the "Specific unit" event, which means that someone would need a pre-set unit. In order to avoid this disturbing thing (a holy action bequathed to us by Mrs. Blizzard), we use the "Trigger - Add event to (TriggerX)", which has the ability of overriding such issues.
Finally, the last trigger claims if the unit that takes damage has the buff you want, it will return a portion of the damage dealt to it, back to its damage source.
 
Level 25
Joined
Mar 23, 2008
Messages
1,813
Oh i see, thank you very much. Will test it now and see if it'll work :)

{EDIT}
  • Magic Shield
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MagicShieldGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in MagicShieldGroup and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to MagicShieldDamageGroup
          • Trigger - Add to Magic Shield 3 <gen> the event (Unit - (Picked unit) Takes damage)
  • Magic Shield 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is in MagicShieldDamageGroup) Equal to True
    • Actions
      • Set MagicShieldUnit = (Triggering unit)
      • Unit Group - Remove MagicShieldUnit from MagicShieldDamageGroup
      • Trigger - Add to Magic Shield 3 <gen> the event (Unit - MagicShieldUnit Takes damage)
  • Magic Shield 3
    • Events
    • Conditions
      • (MagicShieldUnit has buff Magic Shield ) Equal to True
    • Actions
      • Set MagicShieldDamage = (Damage taken)
      • Unit - Cause MagicShieldUnit to damage (Damage source), dealing (0.10 x MagicShieldDamage) damage of attack type Spells and damage type Normal
This is how it looks now, everything look okay?

(sorry for doubleposting)
 
Last edited by a moderator:
Level 12
Joined
Jul 27, 2008
Messages
1,181
Try
  • Magic Shield
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Set MagicShieldGroup = (Units in (Playable map area))
    • Unit Group - Pick every unit in MagicShieldGroup and do (Actions)
      • Loop - Actions
        • Trigger - Add to Magic Shield 3 <gen> the event (Unit - (Picked unit) Takes damage)
  • Magic Shield 2
  • Events
    • Unit - A unit enters (Playable map area)
  • Conditions
    • Unit Group - Add (Entering Unit) to MagicShieldGroup
    • ((Triggering unit) is in MagicShieldGroup) Equal to False
  • Actions
    • Trigger - Add to Magic Shield 3 <gen> the event (Unit - MagicShieldUnit Takes damage)
  • Magic Shield 3
  • Events
  • Conditions
    • ((Damaged Unit) has buff Magic Shield ) Equal to True
  • Actions
    • Set MagicShieldDamage = (Damage taken)
    • Unit - (Damaged Unit) to damage (Damage source), dealing (0.10 x MagicShieldDamage) damage of attack type Spells and damage type Normal
 
Level 25
Joined
Mar 23, 2008
Messages
1,813
Cant find any (damaged unit) in actions :/

{EDIT}
  • Magic Shield
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MagicShieldGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in MagicShieldGroup and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to MagicShieldDamageGroup
          • Trigger - Add to Magic Shield 3 <gen> the event (Unit - (Picked unit) Takes damage)
  • Magic Shield 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is in MagicShieldDamageGroup) Equal to False
    • Actions
      • Set MagicShieldUnit = (Triggering unit)
      • Trigger - Add to Magic Shield 3 <gen> the event (Unit - MagicShieldUnit Takes damage)
  • Magic Shield 3
    • Events
    • Conditions
      • (MagicShieldUnit has buff Magic Shield ) Equal to True
    • Actions
      • Set MagicShieldDamage = (Damage taken)
      • Unit - Cause MagicShieldUnit to damage (Damage source), dealing (0.10 x MagicShieldDamage) damage of attack type Spells and damage type Normal
Changed the triggers to this, the game fatal'd...

(again, sry for doublepost)
 
Last edited by a moderator:
Level 11
Joined
Dec 31, 2007
Messages
780
you have one solution for that... any damage detection system made in gui will detect any kind of damage, not only spells... they will fire if your unit is damaged by a normal attack too...

to solve this Download vexorians damage detection system

or

search for EGUI Warcraft in google and that will help you a lot ;)
 
Status
Not open for further replies.
Top