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

[Solved] Multiple problems with my channeling ability

Status
Not open for further replies.
Level 3
Joined
Apr 1, 2017
Messages
47
I’m creating an ability that is kinda like lightning shield but its stationary and with flames. To stop multiple flames stacking on each other I’m using check amount of units that are in range of TempPoint to make sure that there are none, but for some reason flames that are already there don’t get detected and flames continue to stack endlessly.

  • Burn Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit Group - Add (Triggering unit) to PaladinBurnGroup
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 0 of (Key (Triggering unit)) in PaladinBurnHashtable
  • Burn Create flames
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PaladinBurnGroup and do (Actions)
        • Loop - Actions
          • Set Triggerer = (Picked unit)
          • Set OwnerOfTriggerer = (Owner of Triggerer)
          • Set Angle = (Angle + (Random real number between 80.00 and 100.00))
          • Set Distance = (Random real number between 160.00 and 180.00)
          • Set BurnTarget = (Load 0 of (Key (Picked unit)) in PaladinBurnHashtable)
          • Set TempPoint = ((Position of BurnTarget) offset by Distance towards Angle degrees)
          • Unit - Make Triggerer face BurnTarget over 0.00 seconds
          • Unit Group - Pick every unit in (Units within 200.00 of TempPoint matching (((Unit-type of (Matching unit)) Equal to Footman blue) and ((Unit-type of (Matching unit)) Equal to Footman red))) and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to BurnMess
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in BurnMess) Equal to 0
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Random integer number between 1 and 5) Less than or equal to 2
                  • Then - Actions
                    • -------- Blue flame model --------
                    • Unit - Create 1 Footman blue for OwnerOfTriggerer at TempPoint facing Default building facing degrees
                    • Hashtable - Save (Random real number between 10.00 and 30.00) as 0 of (Key (Last created unit)) in PaladinBurnHashtable
                    • Unit Group - Add (Last created unit) to BurnFlamesGroup
                  • Else - Actions
                    • -------- Red flame model --------
                    • Unit - Create 1 Footman red for OwnerOfTriggerer at TempPoint facing Default building facing degrees
                    • Hashtable - Save (Random real number between 10.00 and 30.00) as 0 of (Key (Last created unit)) in PaladinBurnHashtable
                    • Unit Group - Add (Last created unit) to BurnFlamesGroup
              • Else - Actions
  • Burn Kill Flames
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BurnFlamesGroup and do (Actions)
        • Loop - Actions
          • Set BurnFlames = (Picked unit)
          • Custom script: set udg_BurnKey = GetHandleId(udg_BurnFlames)
          • Set BurnTimer = (Load 0 of BurnKey from PaladinBurnHashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BurnTimer Greater than 0.00
            • Then - Actions
              • Hashtable - Save (BurnTimer - 0.50) as 0 of BurnKey in PaladinBurnHashtable
            • Else - Actions
              • Hashtable - Clear all child hashtables of child BurnKey in PaladinBurnHashtable
              • Unit - Kill BurnFlames
              • Unit Group - Remove BurnFlames from BurnFlamesGroup
  • Burn Burn
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BurnFlamesGroup and do (Actions)
        • Loop - Actions
          • Set BurnPickedFlames = (Picked unit)
          • Unit Group - Pick every unit in (Units within 100.00 of (Position of BurnPickedFlames) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Random unit from BurnFlamesGroup) to damage (Picked unit), dealing 20.00 damage of attack type Chaos and damage type Fire
          • Unit Group - Pick every unit in (Units within 150.00 of (Position of BurnPickedFlames) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Random unit from BurnFlamesGroup) to damage (Picked unit), dealing 5.00 damage of attack type Chaos and damage type Fire

And also for some reason the last trigger doesn’t detect when unit stops channeling.

  • Burn Stop
    • Events
      • Unit - A unit Stops casting an ability
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit Group - Remove (Triggering unit) from PaladinBurnGroup
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in PaladinBurnHashtable
      • Custom script: call RemoveLocation(udg_TempPoint)
 
Level 3
Joined
Apr 1, 2017
Messages
47
Never mind, I figured it out. The reason why no unit is selected is because my units had Locust ability and World Editor doesn’t select those with most of the commands. I made a unit without model and shadow, created a fire special effect and a unit to tie that special effect to.

Here are my triggers, I might update them later.

  • Burn Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit Group - Add (Triggering unit) to PaladinBurnGroup
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 0 of (Key (Triggering unit)) in PaladinBurnHashtable
  • Burn Create flames
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PaladinBurnGroup and do (Actions)
        • Loop - Actions
          • Set Triggerer = (Picked unit)
          • Set OwnerOfTriggerer = (Owner of Triggerer)
          • Set Angle = (Angle + (Random real number between 80.00 and 100.00))
          • Set Distance = (Random real number between 160.00 and 180.00)
          • Set BurnTarget = (Load 0 of (Key (Picked unit)) in PaladinBurnHashtable)
          • Set TempPoint = ((Position of BurnTarget) offset by Distance towards Angle degrees)
          • Unit - Make Triggerer face BurnTarget over 0.00 seconds
          • Unit Group - Pick every unit in BurnFlamesGroup and do (Actions)
            • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units within 175.00 of TempPoint matching ((Unit-type of (Matching unit)) Equal to Footman))) Equal to 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random integer number between 1 and 5) Less than or equal to 2
                • Then - Actions
                  • Unit - Create 1 Footman for OwnerOfTriggerer at TempPoint facing Default building facing degrees
                  • Set BurnLastCreated = (Last created unit)
                  • Custom script: set udg_BurnSpecialKey = GetHandleId(udg_BurnLastCreated)
                  • Hashtable - Save (Random real number between 10.00 and 30.00) as 0 of BurnSpecialKey in PaladinBurnHashtable
                  • Special Effect - Create a special effect at TempPoint using Doodads\Cinematic\TownBurningFireEmitterBlue\TownBurningFireEmitterBlue.mdl
                  • Hashtable - Save Handle Of(Last created special effect) as 1 of BurnSpecialKey in PaladinBurnHashtable
                  • Unit Group - Add BurnLastCreated to BurnFlamesGroup
                • Else - Actions
                  • Unit - Create 1 Footman for OwnerOfTriggerer at TempPoint facing Default building facing degrees
                  • Set BurnLastCreated = (Last created unit)
                  • Custom script: set udg_BurnSpecialKey = GetHandleId(udg_BurnLastCreated)
                  • Hashtable - Save (Random real number between 10.00 and 30.00) as 0 of BurnSpecialKey in PaladinBurnHashtable
                  • Special Effect - Create a special effect at TempPoint using Doodads\Cinematic\TownBurningFireEmitter\TownBurningFireEmitter.mdl
                  • Hashtable - Save Handle Of(Last created special effect) as 1 of BurnSpecialKey in PaladinBurnHashtable
                  • Unit Group - Add BurnLastCreated to BurnFlamesGroup
            • Else - Actions
  • Burn Kill Flames
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BurnFlamesGroup and do (Actions)
        • Loop - Actions
          • Set BurnFlames = (Picked unit)
          • Custom script: set udg_BurnKey = GetHandleId(udg_BurnFlames)
          • Set BurnTimer = (Load 0 of BurnKey from PaladinBurnHashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BurnTimer Greater than 0.00
            • Then - Actions
              • Hashtable - Save (BurnTimer - 0.50) as 0 of BurnKey in PaladinBurnHashtable
            • Else - Actions
              • Special Effect - Destroy (Load 1 of BurnKey in PaladinBurnHashtable)
              • Hashtable - Clear all child hashtables of child BurnKey in PaladinBurnHashtable
              • Unit - Remove BurnFlames from the game
              • Unit Group - Remove BurnFlames from BurnFlamesGroup
  • Burn Burn
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BurnFlamesGroup and do (Actions)
        • Loop - Actions
          • Set BurnPickedFlames = (Picked unit)
          • Unit Group - Pick every unit in (Units within 100.00 of (Position of BurnPickedFlames) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Random unit from BurnFlamesGroup) to damage (Picked unit), dealing 20.00 damage of attack type Chaos and damage type Fire
          • Unit Group - Pick every unit in (Units within 150.00 of (Position of BurnPickedFlames) matching (((Matching unit) is A structure) Equal to False)) and do (Actions)
            • Loop - Actions
              • Unit - Cause (Random unit from BurnFlamesGroup) to damage (Picked unit), dealing 5.00 damage of attack type Chaos and damage type Fire
  • Burn Stop
    • Events
      • Unit - A unit Stops casting an ability
      • Unit - A unit Finishes casting an ability
    • Conditions
      • ((Triggering unit) is in PaladinBurnGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from PaladinBurnGroup
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in PaladinBurnHashtable
      • Custom script: call RemoveLocation(udg_TempPoint)
 
Status
Not open for further replies.
Top