sknam 2 Posted November 14, 2009 Is it possible to have a wait between 2 actions in an activation trigger? ab setunitpos "down"; sleep 10; ab setunitpos "middle" When I tried this, it looks like the game read and executes all actions immediately. Is there syntax to make a pose in the same activation field? Share this post Link to post Share on other sites
Przemek_kondor 13 Posted November 14, 2009 In field "on activation" all sleep commands don't work. Try this: tmp = [] spawn {ab setunitpos "down"; sleep 10; ab setunitpos "middle";} Share this post Link to post Share on other sites
sknam 2 Posted November 15, 2009 (edited) Great ! Thank you Przemek_kondor! I don't understand why the game allow this with a wait command: tmp = [] spawn{... but it works :o Edited November 15, 2009 by SKNAM Share this post Link to post Share on other sites
nomdeplume 0 Posted November 16, 2009 (edited) It works because the trigger code is run as part of a main game thread, and as such it's not allowed for it to "block" execution - otherwise the whole game would stop for the duration of the sleep (or something like that). The "spawn" command creates a new separate thread of execution, so the spawn's code block is run in parallel with other scripts. As a further aid to understanding; if you were to do: player sideChat "hi there"; tmp = [] spawn {ab setunitpos "down"; sleep 10; ab setunitpos "middle";}; player sideChat "bye now"; Then when the trigger is activated, the player would immediately say "hi there" AND "bye now", while the unit 'ab' would go prone and after 10 seconds kneel. Edited November 17, 2009 by some kind of guy Removed suggesting to use nil = ... don't do that! Share this post Link to post Share on other sites