Hey, want to make chanelling ability which runs while LMB pressed, i used while loop with a set of actions. How do i stop this ability when LMB is up, I'm rly bad in programming :). The problem is that i have 2 wait actions in this set so execution takes some time and i need to break it before next while chek. So i need to use if-then-break after each of my actions in this trigger or there is a better way?
sorry for such code i have russian version of editor don't know how actions named in english exactly.
it's pretty basic stuff but i want to be sure i'm doing it right want to hear some advice from someone who is familiar with triggers or programmer.
Can't you make If then else periodic? It doesn't have to be insanely repetitive.. 0,5 would suffice I guess (depending on how accurate you want it to be)
it will stop that trigger from doing anything untill the LMB is down again so it will stop that loop. if you need it for each player you need more triggers
Or to avoid multiple periodic triggers running constantly in the background you could make an event when LMB is down, check which player's it is and then turn on periodic trigger to check if LMB is still pressed down, if not ("Else" part) turn periodic trigger off
If you really want the spell to stop even if its still executing you need to put a check after each wait within the while loop and make it break manually.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey, want to make chanelling ability which runs while LMB pressed, i used while loop with a set of actions. How do i stop this ability when LMB is up, I'm rly bad in programming :). The problem is that i have 2 wait actions in this set so execution takes some time and i need to break it before next while chek. So i need to use if-then-break after each of my actions in this trigger or there is a better way?
Im not exactly sure what you are trying to achieve, maybe post some code here.
I think i understood your problem roughly, but i need more details.
While LMB is down
play anim --
wait 0.23 sec
create effect_1 at point from unit
wait 0.5 sec
create effect_2 at point from unit
When LMB is up i want to break this loop
sorry for such code i have russian version of editor don't know how actions named in english exactly. it's pretty basic stuff but i want to be sure i'm doing it right want to hear some advice from someone who is familiar with triggers or programmer.
make a second trigger -
EVENT- when player presses LMB up
ACTION- stop trigger (whatever that is)
Can't you make If then else periodic? It doesn't have to be insanely repetitive.. 0,5 would suffice I guess (depending on how accurate you want it to be)
Periodically check
If LMB down - do your stuff
Else - stop action
stop trigger will stop it for all players or what? cuz this triger can use any player and any unit
@abvdzh: Go
it will stop that trigger from doing anything untill the LMB is down again so it will stop that loop. if you need it for each player you need more triggers
Or to avoid multiple periodic triggers running constantly in the background you could make an event when LMB is down, check which player's it is and then turn on periodic trigger to check if LMB is still pressed down, if not ("Else" part) turn periodic trigger off
Okay ;/ .Not sure if i heard answer i want but anyway thx a lot guys.
If you really want the spell to stop even if its still executing you need to put a check after each wait within the while loop and make it break manually.