Trigger Chain Lightning.. help

Status
Not open for further replies.
Level 8
Joined
Sep 30, 2012
Messages
205
Hey Since i wanted to know witch units get hit by my "chain lightning", i created my own "chain lightning trigger", well i used some stuff i found on the internet as core, since I'm a bit lazy - thats what i used: //www.thehelper.net/threads/chain-storm-bolt.28316/ - so thanks to -Lycan-.

Anyway i changed it a bit, since i wanted that each unit can only be hit once...
and there is my problem.. i add them to the Group: WoN_GroupAlready
and i check later if the new target is in that group, but it can still be hit again..

Any ideas?

  • WoN
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Lightning
    • Actions
      • Set WoN_Caster = (Triggering unit)
      • Set WoN_Target = (Target unit of ability being cast)
      • Unit Group - Add WoN_Target to WoN_AlreadyGroup
      • Set WoN_Int = (Level of Chain Lightning for WoN_Caster)
      • Set Loops = (WoN_Int + 2)
      • Set WoN_Counter = 0
      • Set WoN_Target_Loc = (Position of WoN_Target)
      • Unit - Create 1 StormBoltDummyUnit for (Owner of WoN_Caster) at WoN_Target_Loc facing Default building facing degrees
      • Set Dummy_Unit = (Last created unit)
      • Unit - Add Chain Lightning (Neutral Hostile) to Dummy_Unit
      • Custom script: call RemoveLocation(udg_WoN_Target_Loc)
      • For each (Integer A) from 1 to Loops, do (Actions)
        • Loop - Actions
          • Set WoN_Counter = (WoN_Counter + 1)
          • Set Dummy_Loc = (Position of Dummy_Unit)
          • Set WoN_Group = (Units within 400.00 of Dummy_Loc matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of WoN_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching un
          • Set WoN_Final_Group = (Random 1 units from WoN_Group)
          • Unit Group - Pick every unit in WoN_Final_Group and do (Actions)
            • Loop - Actions
              • Set Picked_Unit = (Picked unit)
              • Set Picked_Unit_Loc = (Position of Picked_Unit)
              • Unit Group - Add Picked_Unit to WoN_AlreadyGroup
              • Unit - Order Dummy_Unit to Orc Far Seer - Chain Lightning Picked_Unit
              • Unit - Cause WoN_Caster to damage Picked_Unit, dealing (((((Real(WoN_Int)) - 1.00) x 25.00) + 50.00) x (Power(1.20, (Real(WoN_Counter))))) damage of attack type Spells and damage type Plant
              • Game - Display to (All players) the text: (String((((((Real(WoN_Int)) - 1.00) x 25.00) + 50.00) x (Power(1.20, (Real(WoN_Counter)))))))
          • Unit - Move Dummy_Unit instantly to Picked_Unit_Loc
          • Custom script: call RemoveLocation(udg_Dummy_Loc)
          • Custom script: call DestroyGroup(udg_WoN_Group)
          • Custom script: call DestroyGroup(udg_WoN_AlreadyGroup)
          • Custom script: call DestroyGroup(udg_WoN_Final_Group)
          • Custom script: call RemoveLocation(udg_Picked_Unit_Loc)
      • Unit - Add a 2.00 second Generic expiration timer to Dummy_Unit
      • Set WoN_Caster = No unit
      • Set WoN_Target = No unit
      • Set Picked_Unit = No unit
thanks
 
Level 8
Joined
Sep 30, 2012
Messages
205
  • Set WoN_Group = (Units within 400.00 of Dummy_Loc matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of WoN_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching unit is alive) Equal to True) and ((((Matching unit) is Mechanical) Not equal to Ture) and ((((Matching unit) is hidden) Not equal to True) and ((((Matching unit) is in WoN_AlreadyGroup) Not equal to True)
Set WoN_Group = (Units within 400.00 of Dummy_Loc matching
((((Matching unit) is A structure) Not equal to True) and
((((Matching unit) belongs to an enemy of (Owner of WoN_Caster)) Equal to True) and
((((Matching unit) is Magic Immune) Not equal to True) and
((((Matching unit is alive) Equal to True) and
((((Matching unit) is Mechanical) Not equal to Ture) and
((((Matching unit) is hidden) Not equal to True) and
((((Matching unit) is in WoN_AlreadyGroup) Not equal to True)

_________

do i need a wait and give the units buffs? did some research and most people did that..
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,241
Custom script: call DestroyGroup(udg_WoN_AlreadyGroup)
This should be done at the end of the trigger and not in the loop. You destroy the group containing all units that were previously hit (losing all that information) so obviously it will hit them again. The group should last through the loop and only be cleaned at the end of the ability actions (clean up stage).
 
Level 8
Joined
Sep 30, 2012
Messages
205
Ok that was just stupid of me...
Cheers thanks for pointing that out!

But still the spell isn't behaving as it should be..
Units still get hit again. In some cases all the bounces hit one unit...

Any ideas why this is still the case? I changed some stuff around too.. New dummy unit for every bounce, since also the effect is missing sometimes - however that didn't help rly..

  • WoN
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Lightning
    • Actions
      • Set WoN_Caster = (Triggering unit)
      • Set WoN_Target = (Target unit of ability being cast)
      • Set Dummy_Loc = (Position of WoN_Target)
      • Unit Group - Add WoN_Target to WoN_AlreadyGroup
      • Set WoN_Int = (Level of Chain Lightning for WoN_Caster)
      • Set Loops = (WoN_Int + 2)
      • Set Picked_Unit = WoN_Target
      • For each (Integer A) from 1 to Loops, do (Actions)
        • Loop - Actions
          • Wait until ((Picked_Unit is in WoN_AlreadyGroup) Equal to True), checking every 0.30 seconds
          • Set WoN_Counter = (WoN_Counter + 1)
          • Set WoN_Group = (Units within 600.00 of Dummy_Loc matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of WoN_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching un
          • Set WoN_Final_Group = (Random 1 units from WoN_Group)
          • Unit Group - Pick every unit in WoN_Final_Group and do (Actions)
            • Loop - Actions
              • Set Picked_Unit = (Picked unit)
              • Set Picked_Unit_Loc = (Position of Picked_Unit)
              • Unit - Create 1 Dummy*WoN for (Owner of WoN_Caster) at Picked_Unit_Loc facing Default building facing degrees
              • Set Dummy_Unit = (Last created unit)
              • Set Dummy_Loc = (Position of Dummy_Unit)
              • Unit - Add Chain Lightning (Neutral Hostile) to Dummy_Unit
              • Unit - Add a 2.00 second Generic expiration timer to Dummy_Unit
              • Unit - Order Dummy_Unit to Orc Far Seer - Chain Lightning Picked_Unit
              • Unit - Cause WoN_Caster to damage Picked_Unit, dealing (((((Real(WoN_Int)) - 1.00) x 25.00) + 50.00) x (Power(1.20, (Real(WoN_Counter))))) damage of attack type Spells and damage type Plant
              • Game - Display to (All players) the text: (String((((((Real(WoN_Int)) - 1.00) x 25.00) + 50.00) x (Power(1.20, (Real(WoN_Counter)))))))
              • Unit Group - Add Picked_Unit to WoN_AlreadyGroup
          • Custom script: call DestroyGroup(udg_WoN_Group)
          • Custom script: call DestroyGroup(udg_WoN_Final_Group)
          • Custom script: call RemoveLocation(udg_Picked_Unit_Loc)
      • Custom script: call RemoveLocation(udg_Dummy_Loc)
      • Unit Group - Remove all units from WoN_AlreadyGroup
      • Custom script: call DestroyGroup(udg_WoN_AlreadyGroup)
      • Set WoN_Caster = No unit
      • Set WoN_Target = No unit
      • Set Dummy_Unit = No unit
      • Set Picked_Unit = No unit
      • Set WoN_Counter = 0
Map:
 

Attachments

  • WoNChainLighning.w3x
    23.6 KB · Views: 52
Status
Not open for further replies.
Top