Hi,
I tried to create myself a "switch toggle" function, as I couldn't find something like that in the built-in commands, and it seems easy to implement.
I created a new function in the gameSwitches class, and it looks like this:
however when I test it, it looks like the switch is turned ON, but reverts instantly to OFF, though the process is called once.
Is there something I did wrong ?
EDIT : I found the problem, it was my fault : I had a second page on the event ^^' sorry for posting
I tried to create myself a "switch toggle" function, as I couldn't find something like that in the built-in commands, and it seems easy to implement.
I created a new function in the gameSwitches class, and it looks like this:
Code:
Game_Switches.prototype.toggle = function(switchId) {
if (this.value(switchId)) {
this.setValue(switchId, false);
} else {
this.setValue(switchId, true);
}
};
however when I test it, it looks like the switch is turned ON, but reverts instantly to OFF, though the process is called once.
Is there something I did wrong ?
EDIT : I found the problem, it was my fault : I had a second page on the event ^^' sorry for posting