• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Unit Group Removing Problem

Status
Not open for further replies.
Level 7
Joined
Jul 20, 2009
Messages
295
Hello,

I'm trying to create a trigger so that every unit that casts a spell and as long as it is casting it, a special effect appears at their position up until they finish casting.
These are the triggers:
  • Start Casting
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to Casting_Group
      • Trigger - Run Casting GFX Check <gen> (checking conditions)
  • Finish Casting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from Casting_Group
      • Trigger - Run Casting GFX Check <gen> (checking conditions)
  • Casting GFX Check
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Casting_Group) Greater than 0
        • Then - Actions
          • Trigger - Turn on Casting GFX <gen>
        • Else - Actions
          • Trigger - Turn off Casting GFX <gen>
  • Casting GFX
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in Casting_Group and do (Actions)
        • Loop - Actions
          • Set TempLocation = (Position of (Picked unit))
          • Special Effect - Create a special effect at TempLocation using war3mapImported\Mana Refresh.mdx
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation(udg_TempLocation)
Problem:
The special effect only appears once and that's it, as if the trigger no longer works. The problem is with the Custom Script 'set bj_wantDestroyGroup' but I need it to remove leaks though Im not sure how to use it correctly.
Help me out please, thank you.
 
the problem is that it isnt MUI.
if u do something like this u never need to destroy ur group. only if u continue to create it every time. if u just add ur unit then do stuff with unit and remove unit it will work fine.

this can be changed into one trigger and be MUI. if the spec effect is only to be displayed once when a unit casts the ability then just show the spec effect when unit starts the effect.
 
Level 5
Joined
May 6, 2013
Messages
125
if u do something like this u never need to destroy ur group. only if u continue to create it every time

Thats the important part. You reuse the group, so there is no need to destroy it. You do, however, destroy it, and after it's gone, you cant pick the units inside of it anymore (because its gone).

Apart from that, its perfectly fine, its mui, and no, you can not put it into 1 trigger.
 
Level 7
Joined
Jul 20, 2009
Messages
295
So you guys are saying that I do not need to destroy the group? In other words, I remove Custom Script 'set bj_wantDestroyGroup'?
Also, I do need the special effect to keep showing until the caster finishes from casting e.g. there is casting time on spells.

Great, thanks a lot guys, that was very helpful and understandable.
 
Status
Not open for further replies.
Top