- Joined
- Nov 20, 2016
- Messages
- 75
Hi! First of all, I just registered so I'm not sure how things go, but I think this is the proper forum for this.
I am trying to make an altered melée map with new tavern heroes, and I want one of them to have an ability that links enemy units, so when one of them is damaged, all linked units receive either a percentage of that damage, or the same amount of damage (without reducing the damage that the first unit takes).
What I got:
I'm using GDD v 1.21
When my hero casts the ability (I called it Soul Bind, so I will call it "SB" for the rest of the post) I create a dummy unit for the owner of the target unit and have that unit cast an ability based on spirit link (with a buff based on the spirit link buff).
Now here's where I've got the problem:
SB Damage Trigger:
When a unit is damaged (detected with GDD v1.21), if it has the SB buff, I cause a the damage source to damage all units with the buff, which fires the trigger again, causing an infinite loop that kills all units with the buff.
I tried turning off the trigger (SB Damage), and making another trigger (SB Control) that turns it on when a unit with the buff is attacked. This makes SB Damage run all the way once, but when it is turned on again by the other trigger, for some reason, it doesn't go into the loop that's supposed to damage all units with the buff.
Code for SB_Damage
I am trying to make an altered melée map with new tavern heroes, and I want one of them to have an ability that links enemy units, so when one of them is damaged, all linked units receive either a percentage of that damage, or the same amount of damage (without reducing the damage that the first unit takes).
What I got:
I'm using GDD v 1.21
When my hero casts the ability (I called it Soul Bind, so I will call it "SB" for the rest of the post) I create a dummy unit for the owner of the target unit and have that unit cast an ability based on spirit link (with a buff based on the spirit link buff).
Now here's where I've got the problem:
SB Damage Trigger:
When a unit is damaged (detected with GDD v1.21), if it has the SB buff, I cause a the damage source to damage all units with the buff, which fires the trigger again, causing an infinite loop that kills all units with the buff.
I tried turning off the trigger (SB Damage), and making another trigger (SB Control) that turns it on when a unit with the buff is attacked. This makes SB Damage run all the way once, but when it is turned on again by the other trigger, for some reason, it doesn't go into the loop that's supposed to damage all units with the buff.
Code for SB_Damage
-
Soul Bind Damage
-
Events
- Game - GDD_Event becomes Equal to 1.00
-
Conditions
- (GDD_DamagedUnit has buff Soul Bind ) Equal to True
-
Actions
-
Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Triggering unit) belongs to an ally of (Triggering player)) Igual a True) and (((Matching unit) has buff Soul Bind ) Igual a True))) and do (Actions)
-
Loop: Actions
- Game - Display to (All players) the text: Trigger is running ...
- Unit Group - Add (Picked unit) to SoulBind_Target_Group
- Unit Group - Remove GDD_DamagedUnit from SoulBind_Target_Group
-
Unit Group - Pick every unit in SoulBind_Target_Group and do (Actions)
-
Loop: Actions
- Game - Display to (All players) the text: (String((Number of units in SoulBind_Target_Group)))
- Unit - Cause GDD_DamageSource to damage (Picked unit), dealing GDD_Damage damage of attack type Spell and damage type Normal
-
Loop: Actions
- Trigger - Turn off (This trigger)
-
Loop: Actions
- Custom script: call RemoveLocation (udg_SoulBind_Target_Location)
- Custom script: call DestroyGroup (udg_SoulBind_Target_Group)
-
Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Triggering unit) belongs to an ally of (Triggering player)) Igual a True) and (((Matching unit) has buff Soul Bind ) Igual a True))) and do (Actions)
-
Events
Last edited: