• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Solved] Trigger Shockwave not applying the damage correctly

Status
Not open for further replies.
Level 5
Joined
Feb 18, 2016
Messages
96
I made a trigger version of shockwave ability but for some reason it does not works properly

  • Disparo
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability
    • Actions
      • Set Final = (Target point of ability being cast)
      • Unit - Create 1 Dummy for (Owner of caster) at (Position of caster) facing (Facing of SantaClaus) degrees
      • Set DUMMY = (Last created unit)
      • Trigger - Turn on dam <gen>
      • Unit - Order DUMMY to Move ToFinal
  • dam
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between (Position of DUMMY) and Final) Greater than 50.00
        • Then - Actions
          • Set QGR = (Units within 150.00 of (Position of DUMMY))
          • Unit Group - Pick every unit in QGR and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • -------- Here is the problem} --------
                  • ((Picked unit) belongs to an enemy of (Owner of caster)) Equal to True
                  • ((Picked unit) is in QDMG) Equal to False
                • Then - Actions
                  • Unit - Cause caster to damage (Picked unit), dealing x damage of attack type Normal and damage type Normal
                  • Unit Group - Add (Picked unit) to QDMG
                  • Else - Actions
          • Custom script: call DestroyGroup (udg_QGR)
        • Else - Actions
          • Custom script: call RemoveLocation (udg_Final)
          • Trigger - Run final <gen> (checking conditions)
          • Trigger - Turn off (This trigger)
  • final
    • Events
    • Conditions
    • Actions
      • Custom script: call DestroyGroup (udg_QDMG)
      • Unit - Remove DUMMY from the game
      • Set DUMMY = No unit

The problem is in the periodic trigger.
It stills damaging the units in the QDMG Group causing them x damage every .03 seconds
 
Level 41
Joined
Feb 27, 2007
Messages
5,183
You're destroying the QDMG group after the first cast. On the second cast the group doesn't exist so units can't be added to it so they pass the condition check. Instead of destroying it in final with that custom script, just do
  • Unit Group - Clear QDMG
  • -------- It's one called one of these two things, can't remember which one at the moment --------
  • Unit Group - Remove all units from QDMG
Also instead of using a unit group variable and manually destroying it after you're done, if you know you'll never need the group again you can use a different custom script line to destroy it automatically:
  • -------- Normally you'd do something like this: --------
  • Set GroupVar = Units within....
  • Unit Group - Pick all units in GroupVar and do...
    • Loop - Actions
      • -------- Whatever --------
  • Custom script: call DestroyGroup(udg_GroupVar)
  • -------- --------
  • -------- --------
  • -------- Instead can also do: --------
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick all units within...
    • Loop - Actions
      • -------- Whatever --------
  • -------- nothing more to do! ---------
 
Status
Not open for further replies.
Top