Removing buff after wait

Erkki2

New Member
Reaction score
0
I have made a spell that is supposed to make target unit asleep for a random time depending on the spell level. Here's my trigger:
Code:
Sleep
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
    Actions
        Custom script:   local unit t = GetSpellTargetUnit()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Ability being cast) Equal to Hypnosis 
                (Random integer number between 1 and 100) Less than or equal to 80
            Then - Actions
                Unit - Create 1 caster for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Hide (Last created unit)
                Unit - Add sleep  to (Last created unit)
                Custom script:   call IssueTargetOrderBJ( GetLastCreatedUnit(), "thunderbolt", t )
                Wait (1.00 + ((Real((Level of Hypnosis  for (Triggering unit)))) x (Random real number between 1.00 and 5.00))) seconds
                Custom script:   call UnitRemoveBuffBJ( 'B00H', t )
            Else - Actions
        Custom script:   set t = null
The problem is that when waiting time is too long, the buff isn't removed. Is there any other option than using wait function? The spell must remain MUI.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
you know there is a GUI actions that removes buffs you dont need to use a custom scripts.
Trigger:
  • Actions
    • Unit - Remove Acid Bomb buff from (Triggering unit)
 

N(O.O)B

New Member
Reaction score
27
Actually, he's using a "Local" variable, which you cannot use in GUI actions, so he needs to use a custom script ;)

On topic:
I've got no idea what's causing it? But perhaps you could try placing the
Code:
Custom script:   set t = null
after the wait? I doubt that's the case but perhaps it's nulling "t" before removing the buff. Btw, you're leaking a point here:
Trigger:
  • Unit - Create 1 caster for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
 

Erkki2

New Member
Reaction score
0
Btw, you're leaking a point here:

Trigger:
Unit - Create 1 caster for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
How can i do that without leak?
And on topic: Thank you, I added wait and now it works.
 

N(O.O)B

New Member
Reaction score
27
Simply:
Trigger:
  • Trigger
    • Events
    • Conditions
    • Actions
      • Set Point = (Position of (Target unit of ability being cast))
      • Unit - Create 1 caster for (Owner of (Casting unit)) at Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Point)
 
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