HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem With Wait in trigger

11-17-2005, 10:27 PM#1
Thunder_Eye
Ok, I got some wierd problem, first of I'll just show the trigger.
Arcane Intelligence is a buff that holds for 10 sec. Just to everybody that thinks the trigger makes no sense, this is just an test trigger.
Code:
Buffs
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Target unit of ability being cast) has buff Arcane Intelligence ) Equal to True
            Then - Actions
                Unit - Order (Casting unit) to Stop
            Else - Actions
                Wait 1.00 game-time seconds
                Wait until (((Target unit of ability being cast) has buff Arcane Intelligence ) Equal to False), checking every 1.00 seconds
                Unit - Kill (Target unit of ability being cast)

ok the problem is the unit never gets killed, Ive tested some stuff and somehow nothing works. Can someone help me on this one? First of I didnt have that wait 1 sec cause the unit got killed the moment the ability was cast. Ive also had Wait 10,5 and Wait 11 sec instead of "Wait for Condition" but those two dont work either.

What I want it to do:
When the buff goes away, the unit should die.
11-17-2005, 10:52 PM#2
HEZZA
errrr basicaly i think you told it to stop casting if he does it have and wait forever until he does have it, but theres no indication there that someones gonna give it to him =/

upload map i say
11-18-2005, 12:31 AM#3
Vexorian
Target unit of ability being cast acts as a glogal - It won't work correctly after waits - you have to use a local variable or be creative
11-18-2005, 06:13 AM#4
The_AwaKening
Would that same problem also apply to a timer? I have a timer window that is supposed to run down and destroy itself 5 seconds after hitting zero. I used a global variable for the timer (only because I couldn't get it to work without using a variable).

Hell, if you got a second, take a look at it for me. Here it is.
Code:
Deeplord
    Events
        Unit - Seiryuu 0090 <gen> Dies
    Conditions
    Actions
        Wait 10.00 seconds
        Cinematic - Ping minimap for (All players) at (Center of Deeplord <gen>) for 5.00 seconds
        Game - Display to (All players) for 5.00 seconds the text: The Deeplord will s...
        Countdown Timer - Start DeeplordTimer as a One-shot timer that will expire in 90.00 seconds
        Countdown Timer - Create a timer window for DeeplordTimer with title Deeplord
        Wait 90.00 seconds
        Set tempPoint = (Center of Deeplord <gen>)
        Unit - Move Deeplord Revenant 0270 <gen> instantly to tempPoint, facing 310.00 degrees
        Special Effect - Create a special effect at tempPoint using AbilitiesSpellsHumanResurrectResurrectTarget.mdl
        Custom script:   call DestroyEffect( bj_lastCreatedEffect )
        Custom script:   call RemoveLocation(udg_tempPoint)
        Wait 5.00 seconds
        Countdown Timer - Destroy (Last created timer window)
        Custom script:   call DestroyTrigger( GetTriggeringTrigger() )
11-18-2005, 09:19 AM#5
Soultaker
Quote:
Originally Posted by The_AwaKening
Would that same problem also apply to a timer? I have a timer window that is supposed to run down and destroy itself 5 seconds after hitting zero. I used a global variable for the timer (only because I couldn't get it to work without using a variable).

Hell, if you got a second, take a look at it for me. Here it is.
Code:
Deeplord
    Events
        Unit - Seiryuu 0090 <gen> Dies
    Conditions
    Actions
        Wait 10.00 seconds
        Cinematic - Ping minimap for (All players) at (Center of Deeplord <gen>) for 5.00 seconds
        Game - Display to (All players) for 5.00 seconds the text: The Deeplord will s...
        Countdown Timer - Start DeeplordTimer as a One-shot timer that will expire in 90.00 seconds
        Countdown Timer - Create a timer window for DeeplordTimer with title Deeplord
        Wait 90.00 seconds
        Set tempPoint = (Center of Deeplord <gen>)
        Unit - Move Deeplord Revenant 0270 <gen> instantly to tempPoint, facing 310.00 degrees
        Special Effect - Create a special effect at tempPoint using AbilitiesSpellsHumanResurrectResurrectTarget.mdl
        Custom script:   call DestroyEffect( bj_lastCreatedEffect )
        Custom script:   call RemoveLocation(udg_tempPoint)
        Wait 5.00 seconds
        Countdown Timer - Destroy (Last created timer window)
        Custom script:   call DestroyTrigger( GetTriggeringTrigger() )

It would be a lot easier to split it up into two triggers, one starting the timer, and one when it ends.

Also, if you want the Timer Window to stick for 5 seconds, you'll have to set it to a Variable, like DeepLordTimerWindow.

Code:
Countdown Timer - Start DeeplordTimer as a One-shot timer that will expire in 90.00 seconds
Countdown Timer - Create a timer window for DeeplordTimer with title Deeplord
Set DeepLordTimerWindow = (Last created Timerwindow)

And then, after the 5 seconds, just do this:

Code:
        Countdown Timer - Destroy (DeepLordTimerWindow)

-Soultaker
11-18-2005, 09:28 AM#6
Thunder_Eye
So how would I use locals in GUI? -.-

would I have to make it custom text and then add it
or can I just use custom script somehow?

also as I said before, I had to add the Wait 1 game-time cause The unit got killed right when I casted it. So Vex how did that work? It used the wait and still the "Target unit" worked

EDIT:
Ok its works now, thanks to Vex for naming locals it is now solved. This is the trigger now and it works!
Code:
Buffs
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        Set tempTarget = (Target unit of ability being cast)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Target unit of ability being cast) has buff Arcane Intelligence ) Equal to True
            Then - Actions
                Unit - Order (Casting unit) to Stop
            Else - Actions
                Wait 1.00 game-time seconds
                Wait until ((tempTarget has buff Arcane Intelligence ) Equal to False), checking every 1.00 seconds
                Unit - Kill tempTarget
Oh and to Hezza, the thing the trigger makes is it checks the target unit if it has the buff, If it doesnt have it it will wait until the buff dissapears and then kill it. And if it does have it the trigger will stop the caster from casting it again.

Thank you all for your cooperation

EDIT SECOND:
Of course theres a new problem, and that is that I only works on one unit at a time, I can probably work this out with different array anyway so its not really a problem.

EDIT.. Third or what is it?
Ok it looks like this now and I know why it isnt working, can someone help me fix the problem.
Code:
Buffs
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        Set tempTarget[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Target unit of ability being cast) has buff Arcane Intelligence ) Equal to True
            Then - Actions
                Unit - Order (Casting unit) to Stop
            Else - Actions
                Unit - Add Item Hero Stat Bonus (+3 Intelligence) to tempTarget[(Player number of (Owner of (Target unit of ability being cast)))]
                Wait 1.00 game-time seconds
                Wait until ((tempTarget[(Player number of (Owner of (Target unit of ability being cast)))] has buff Arcane Intelligence ) Equal to False), checking every 1.00 seconds
                Unit - Remove Item Hero Stat Bonus (+3 Intelligence) from tempTarget[(Player number of (Owner of (Target unit of ability being cast)))]
11-21-2005, 08:44 PM#7
Soultaker
Quote:
Code:
Buffs
    Events
        Unit - A unit Begins casting an ability
    Conditions
    Actions
        Set tempTarget[(Player number of (Owner of (Target unit of ability being cast)))] = (Target unit of ability being cast)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Target unit of ability being cast) has buff Arcane Intelligence ) Equal to True
            Then - Actions
                Unit - Order (Casting unit) to Stop
            Else - Actions
                Unit - Add Item Hero Stat Bonus (+3 Intelligence) to tempTarget[(Player number of (Owner of (Target unit of ability being cast)))]
                Wait 1.00 game-time seconds
                Wait until ((tempTarget[(Player number of (Owner of (Target unit of ability being cast)))] has buff Arcane Intelligence ) Equal to False), checking every 1.00 seconds
                Unit - Remove Item Hero Stat Bonus (+3 Intelligence) from tempTarget[(Player number of (Owner of (Target unit of ability being cast)))]

Target Unit of ability being cast is removed after a wait action, so you can't use that...

You could use Timers for each player that can cast this buff, or you make Target unit of ability being cast get Custom Value 1.

And then make this trigger:


Code:
Every
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) has buff Arcane Intelligence) Equal to True) and ((Custom value of (Matching unit)) Equal to 1))) and do (Actions)
            Loop - Actions
                Unit - Set the custom value of (Picked unit) to 0
                Unit - Remove Item Intelligence Gain (+2) from (Picked unit)

That should work fine, but if you got a lot of units in your map, it might cause a bit lag...

But you can just use timers if you don't want to do that. :)

-Soultaker