Hello, Apologies for making another post right after one was solved, but I've been stuck on this for about an hour and I'm not sure why this is happening.
As per my last post, I noted creating a script that'd change an event's sprite after a counter has gone up a certain amount of times:
The code does work, when it's placed on a normal event. But, when moving it to a common event, the script continues to mostly function but the target event's sprite never changes.
I did color out the sprite sheet to make sure it isn't just switching to an unintended sprite but this doesn't seem to be the case either as the event remains invisible.
so I know that the problem has to be something to do with how common events recognize normal events, I'm assuming the common event doesn't know what "$gameMap.event(16)" actually is.
I also came across a forum post whilst looking for solutions in which the solution described:
again, to re-clarify. the code does work as intended when its not in a common event, I'm not sure why it breaks when inside a common event as I don't get any errors or anything. I'm aware this behavior doesn't require a script but I might as well see ends meet and get this fully functional instead of dropping it entirely.
Your help is appreciated!
As per my last post, I noted creating a script that'd change an event's sprite after a counter has gone up a certain amount of times:
JavaScript:
const loopChange = [[3 , 0],[6 , 1],[9 , 2]];
for (let animal in loopChange){
numTbl = loopChange[animal];
var trueNum = numTbl[0];
if (trueNum == ($gameVariables.value(1))){
let spriteId = numTbl[1]; $gameMap.event(16).setDirection(2); $gameMap.event(16).setImage("Actors1",spriteId); break;
} else if (loopChange.length - 1 != animal) { $gameMap.event(16).setDirection(2); $gameMap.event(16).setImage("",0);
} else {break; }}
The code does work, when it's placed on a normal event. But, when moving it to a common event, the script continues to mostly function but the target event's sprite never changes.
I did color out the sprite sheet to make sure it isn't just switching to an unintended sprite but this doesn't seem to be the case either as the event remains invisible.
so I know that the problem has to be something to do with how common events recognize normal events, I'm assuming the common event doesn't know what "$gameMap.event(16)" actually is.
I also came across a forum post whilst looking for solutions in which the solution described:
so if this were the case, it'd know what map its on and from there refer to the correct event, but this doesn't seem to be happening unless I'm missing something?
again, to re-clarify. the code does work as intended when its not in a common event, I'm not sure why it breaks when inside a common event as I don't get any errors or anything. I'm aware this behavior doesn't require a script but I might as well see ends meet and get this fully functional instead of dropping it entirely.
Your help is appreciated!