• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Unit group -clear

Status
Not open for further replies.
Level 3
Joined
Aug 30, 2017
Messages
34
Trying to make aoe spell that does 200 damage and + 10 for every unit in point. it works as it should the first time, but i cant clear the unit group and the damage keeps increasing.

  • conditions
  • (Unit-type of (Damage source)) Equal to Sorceress (dummy)
  • actions
  • Unit Group - Pick every unit in (Units within 200.00 of tempoddtargdummy matching (((Triggering unit) is alive) Equal to True)) and do (Unit Group - Add (Picked unit) to tempgroupodd)
  • Event Response - Set Damage of Unit Damaged Event to (((Real((Number of units in tempgroupodd))) x 10.00) + 200.00)
  • Custom script: call RemoveLocation( udg_tempoddtargdummy )
  • Countdown Timer - Start cd as a One-shot timer that will expire in 3.00 seconds
cd timer trigger
  • Time - cd expires
  • Unit Group - Remove all units from tempgroupodd
thought the problem was dead units not being removed from the group so i used the trigger below, but that doesnt work.

  • Unit - A unit Dies
  • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
  • Unit Group - Remove (Triggering unit) from tempgroupodd
attached map below the spell is on the lord garithos tower in murloc workers inventory.
 

Attachments

  • tower d(NEW).w3x
    22.1 KB · Views: 24
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
You really need to be more clear with the triggers you are attempting to post. Use the [trigger][/trigger] tags: How To Post Your Trigger. You're leaking a unit group (how-to: Things That Leak). There's no reason the unit group needs to persist at all, so I don't understand what your issue is; the trigger should be very simple. The ability itself should just deal 200 damage if you want to base it on dispel to still do bonus damage to summons, or you can make it deal no damage and do the check for that manually and amp the damage yourself (what I did below).

I believe the problem you have is checking this condition: matching (((Triggering unit) is alive) Equal to True)) which will always be true because you're erroneously checking Triggering not Matching Unit. Thus it adds dead units to the group.

  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) equal to Overwhelming Odds
  • Actions
    • Set TempPoint = (Target point of spell being cast)
    • Set Caster = (Triggering Unit)
    • Set Owner = (Owner of Caster)
    • Set TempUG = (Units within 200.00 of TempPoint matching (((Matching unit) belongs to an enemy of Owner) equal to true) and (((Matching Unit) is alive) equal to true))
    • Set CountBonus = (10.00 x Real(Number of units in TempUG))
    • Set BaseDmg = 200.00
    • Unit Group - Pick every unit in TempUG and do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • ((Picked unit) is summoned) equal to true
          • Then - Actions
            • Set SummonBonus = (BaseDmg x 1.00)
          • Else - Actions
            • Set SummonBonus = 0.00
        • Unit - Cause Caster to damage (Picked Unit) for ((BaseDmg + SummonBonus) + CountBonus) damage of attack type Spells and damage type Magic
    • Custom script: call DestroyGroup(udg_TempUG) //change the name to match your variable name but keep the udg_ prefix
    • Custom script: call RemoveLocation(udg_TempPoint)
 
Try to check and see if the timer does expire at all with a debug message. If it does, then something else must be going on. Otherwise, something's preventing the timer from expiring either from a restart of said timer, or a thread crash.

Given aforesaid info, I'd try to check other triggers to see if the timer is being used elsewhere.

(Also, this doesn't appear to be MUI.)
 
Level 3
Joined
Aug 30, 2017
Messages
34
thanks for the help guys i think pyro was right and it was me using triggering unit instead of matching.
 
Status
Not open for further replies.
Top