[Trigger] Trigger Problem

Status
Not open for further replies.
Level 3
Joined
Jan 19, 2017
Messages
32
Hello again fellow hivers. Sorry for interupting but I have another problem.

Let me explain:
1. I am currently creating a custom map epic size (256x256)
2. Due to the large map size, I decided to add a fast travel feature. its a shop where if you buy items, you will be teleported on a specified location on the map.

Let me show you (how I want it to work):

Untitled.png


> This here is the Water Tribe Village.

If I buy the Item below,

asdfasdf.png


I set my triggers to move my hero to a different location.
Ok, so it worked and now the hero is now here:

asfasdffgh.png


So now, my hero is in the "Capital".
Now I want him to return to the Water tribe. the other item should TP him back.

asdfasdf.png


BUT......
he RETURNED to the Capital.

Below is the trigger sequence I used.

jklkhjhjkjk.png


Can somebody explain what happened?
Surely appreciate if somebody did. TIA.
 
Level 3
Joined
Jan 19, 2017
Messages
32
oh, i figured it out already. TY though.

Fixed by changing the condition to a boolean cond. anyway this issue is done, but I have another problem again
:p

posted in another thread

do, waiting causes trouble?
didnt know abt that
 
Last edited by a moderator:
Level 17
Joined
Mar 21, 2011
Messages
1,611
periodic time event or timers. Example:
You have a real variable that is set to 3.00
then you have a trigger with a periodic time event ('every 0.1 seconds of game time' for example)
you discount your variable by that amount:

every 0.1 seconds of game time

set var = var - 0.1
if var == 0.0 --> do actions
 
Level 3
Joined
Jan 19, 2017
Messages
32
uhhhh. ok, I get it.
So instead of "wait"

I use if value of variable.... "like that"?

But what if I need a pause between the Actions?

I dont think the Real variable can help, bc its an event?
 
Level 3
Joined
Jan 19, 2017
Messages
32
I have long triggers and I don't think I can avoid using the wait..

Will it be a problem?
esp. I have a Huge map
 
For such little things you may stay with waits, if accuracy is no priority. It's not the best solution, but easiest.
Just be aware that not always functions give back the wanted values after "waits". Triggering Unit works fine, though.
Event Response Myths

SpecialEffects shoulld be destroy immediatly, though.
With waits, you may leak here, as the variable can be overwritten.
SpecialEffects will play their death animation always, when they are destroyed.
 
Level 3
Joined
Jan 19, 2017
Messages
32
Yes.

Also, for the condition you may want to use an ItemType Comparison.

That's what I used earlier, w/c caused me to create this thread. SO the wait is really a problem huh? But, I'm having a hard time thinking of a round-about solution....



depends. if you are the only player in the game.. probably not.
if someone else teleports right after you, your variable will get overwritten and you leak

Therefore, my map isn't yet ready for multiplayer. But how should i fix this to avoid problems in MP??


Anyway, TY again for answering and imparting your genius. I'll put this mp on hold for now and Imma catch some zzzzz's.

TY TY TY again
 
Last edited:
It is a problem, if the variable is used again to strore a new special effect, during the 4 seconds wait time.
So, if the unit uses an TP during the time, or an other player's unit, then you will get unwanted result.

MUI Triggers with Waits
^This is an alternative solution that will work correcty.
It still uses waits, so is less accurate than periodic timers, but it uses a technique that you don't need a new trigger, but still ensure instanceability. (multiple units may use it)
 
Level 4
Joined
Nov 27, 2012
Messages
85
instead of waits, I have this pasted into the header of the map

JASS:
function cH takes real ci returns nothing
    local real cI
    local real st=TimerGetElapsed(udg_timer_tsa)
    if st<=0 then
        set udg_timer_tsa=CreateTimer()
        call TimerStart(udg_timer_tsa,0xF4240,false,null)
    endif
    if ci>0 then
        loop
            set cI=ci-TimerGetElapsed(udg_timer_tsa)+st
            if cI>bj_POLLED_WAIT_SKIP_THRESHOLD then
                call TriggerSleepAction(.1*cI)
            else
                call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
            endif
            exitwhen cI<=0
        endloop
    endif              
endfunction

and whenever you need a wait, use
  • Custom script: call cH(number of seconds)
 
Level 3
Joined
Jan 19, 2017
Messages
32
it seems like this map wont reach completion if i dontuse jass. my triggers are so complicated that I have a hard time using the gui.
The problem is that I dunno how to use JAss.
:(
 
Level 4
Joined
Nov 27, 2012
Messages
85
not necessary to use jass, but it is very helpful, and eventually much faster.
i was forced to learn it because I inherited a map that was completely in jass, and had only 1 trigger.

anyways, what i said is really simple.

click on your map name (circled in red), this is the map header. Any functions written in here can be called from any trigger in the map.

just paste the whole code I put. anytime you need a wait, use the GUI "Custom Script" and put "call cH(number of seconds to wait)"
 

Attachments

  • Capturssse.PNG
    Capturssse.PNG
    30.1 KB · Views: 48
Level 8
Joined
Jan 28, 2016
Messages
486
You could create a custom ability based off Channel with unit targeting, its visibility disabled so it won't appear on the command card and a channeling time of 4 seconds. When a unit buys the teleport item, add this custom Channel to it and order it to cast on the target Beacon. Once the channeling is over, move the unit to the desired destination and throw in all the special effects you want. The channeling could still be cancelled by stuns and such, but other than that, it should work like a charm! And no need for waits either!

P.S.: Out of curiosity, wouldn't your current system fail if the unit has a full inventory? o_O
 
Level 3
Joined
Jan 19, 2017
Messages
32
yeah.
You could create a custom ability based off Channel with unit targeting, its visibility disabled so it won't appear on the command card and a channeling time of 4 seconds. When a unit buys the teleport item, add this custom Channel to it and order it to cast on the target Beacon. Once the channeling is over, move the unit to the desired destination and throw in all the special effects you want. The channeling could still be cancelled by stuns and such, but other than that, it should work like a charm! And no need for waits either!

P.S.: Out of curiosity, wouldn't your current system fail if the unit has a full inventory? o_O
never thoght of that. actually, you may have a better idea
 
Status
Not open for further replies.
Top