I have disabled the control btnWalk "btnWalk.Enabled = false;" which is connected to the SetCursorMode (mode 0). However the button gets enabled automatically every time the character changes room. Is there a way to avoid this? I want the button to stay permanently disabled until i decide to re-enable it.
Having to program the command "if (condition == true) btnWalk.Enabled = false" at room load (Before fade in) would not be a desired solution, meaning i have to add it to the script for every single room individually.
(edit): I am using version AGS 3.1.2 SP1
What version of AGS are you using? I haven't encountered this problem but one way around it is, rather than to disable the button entirely, just go into the runscript call when the button is pressed and do a quick global boolean check that you can set true/false to allow walking. This way you could also have a message pop-up explaining why the person can't walk right now.
Quote from: papste on Fri 26/06/2009 07:30:39meaning i have to add it to the script for every single room individually.
No, you don't:
// global script
function on_event (EventType event, int data) {
if (event == eEventEnterRoomBeforeFadein) {
if (condition) btnWalk.Enabled = false;
}
}
This is a good point, it's because Walk buttons get automatically linked to the "Player character visible" room setting.
The easiest way round it is to change the button from doing a Set Cursor Mode to a Run Script, and then just put some script in it to set the cursor mode to Walk. That way, AGS won't automatically link it to the Player Character Visible setting.