1
Technical forum / How to ALWAYS set Game.Interactive to false when actor performs action?
« on: December 29, 2008, 10:40:48 PM »
Hi all,
When my actor performs an action, I want the game to always turn "Game.Interactive" to false. Instead of entering the false/true lines for every event in every script, I figured I could easily do this in one place by adjusting the onLeftClick event. This may save me lots of redundant lines of code in the future.
Unfortunately, I have a problem.
This is what I do:
The problem is that I don't get back control of the game. Game.Interactive remains false. The funny thing is that when I use the debugger and step through the script, it suddenly DOES work.
The reason why I added the WaitFor(actor) command is that if I don't -- the game gives back control to the player while the actor still has to perform his actions.
What am I doing wrong?
Or perhaps there is a better way of accomplishing my goal?
Thanks!
When my actor performs an action, I want the game to always turn "Game.Interactive" to false. Instead of entering the false/true lines for every event in every script, I figured I could easily do this in one place by adjusting the onLeftClick event. This may save me lots of redundant lines of code in the future.
![Wink ;)](http://www.dead-code.org/forum/Smileys/default/wink.gif)
![Cry :'(](http://www.dead-code.org/forum/Smileys/default/cry.gif)
Code: WME Script
- on "LeftClick"
- {
- if(ActObj!=null) // we did click an object
- {
- //Code cutted away to keep the example simple. We go straight to case 1, which is triggered when the mouse pointer is 1, or "LookAt"
- case 1:
- break;
- //Code cutted away. (The other cases)
- }
- }
The problem is that I don't get back control of the game. Game.Interactive remains false. The funny thing is that when I use the debugger and step through the script, it suddenly DOES work.
The reason why I added the WaitFor(actor) command is that if I don't -- the game gives back control to the player while the actor still has to perform his actions.
What am I doing wrong?
Or perhaps there is a better way of accomplishing my goal?
Thanks!