Collision on/off

Ncrackz

New Member
Reaction score
2
Hello, i've recently made a spell that would heal allies around you and will give them the ability to walk through unpassable terrain for 8 seconds, i'm not sure what I did wrong if someone could look at this, please help
Thank you.

Code:
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Light's Grace 
    Actions
        Set Grace_Pnt = (Position of (Triggering unit))
        Set Grace_Unit = (Units within 450.00 of Grace_Pnt matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True))
        Unit Group - Pick every unit in Grace_Unit and do (Actions)
            Loop - Actions
                Set Grace_Pick = (Position of (Picked unit))
                Unit - Turn collision for (Picked unit) Off
                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 375.00)
                Special Effect - Create a special effect at Grace_Pick using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
                Wait 8.00 seconds
                Unit - Turn collision for (Picked unit) On
        Custom script:   call RemoveLocation (udg_Grace_Pnt)
        Custom script:   call RemoveLocation (udg_Grace_Pick)
        Custom script:   call DestroyGroup (udg_Grace_Unit)
        Special Effect - Destroy (Last created special effect)
 

RaiJin

New Member
Reaction score
40
dont use a wait inside the loop

and put

Code:
Custom script:   call RemoveLocation (udg_Grace_Pick)

inside the loop . or else you won't be able to get rid of all teh leakss

what u do is.. make a unit array.. then get an integer to count how many picked units there are. after that u wait 8 seconds (outside of loop) and then u run another loop to turn off the collision
 

Ncrackz

New Member
Reaction score
2
hmmm, i'm not sure how to do that unit array and how do I make it count integers? Sorry i'm not that good a this =p
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Do you want this MUI? If not then you can move the wait outside the loop, then after the wait make another loop through the unit group, turning the collision on again.
 

Ncrackz

New Member
Reaction score
2
Well it's not a MUI ability so i guess, I don't really want it to be :p, Oooo Misread post, umm I want the same units that had the collision off, to be turned back on. As if one teleports then i use the skill THAT person will have collision off forever lol. Ahh not sure if this is correct..

Code:
Lights grace
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Light's Grace 
    Actions
        Set Grace_Pnt = (Position of (Triggering unit))
        Set Grace_Unit = (Units within 450.00 of Grace_Pnt matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True))
        Unit Group - Pick every unit in Grace_Unit and do (Actions)
            Loop - Actions
                Set Integer[1] = (Number of units in Grace_Unit)
                Set Grace_Pick = (Position of (Picked unit))
                Set Unit_Grace[1] = (Picked unit)
                Unit - Turn collision for Unit_Grace[1] Off
                Unit - Set life of Unit_Grace[1] to ((Life of Unit_Grace[1]) + 375.00)
                Special Effect - Create a special effect at Grace_Pick using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
                Special Effect - Destroy (Last created special effect)
                Custom script:   call RemoveLocation (udg_Grace_Pnt)
                Custom script:   call RemoveLocation (udg_Grace_Pick)
                Custom script:   call DestroyGroup (udg_Grace_Unit)
        Wait 8.00 seconds
        Unit Group - Pick every unit in Grace_Unit and do (Actions)
            Loop - Actions
                Unit - Turn collision for Unit_Grace[1] On
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top