I'm trying to figure out how to set Yanfly's Self Variables using script calls from other events. I currently have this script that turns off a self switch for every event that has the name "evtEncounter".
I tried looking through the .js file for Yanfly's Self Switch and Variables, but my understanding of JavaScript is still pretty rough. I put this together, but it doesn't work.
Can anyone point me in the right direction?
Code:
$gameMap.events().reduce(function(a, c) { var e = c.event(); if (e.name === "evtEncounter") a.push(e.id); return a; }, []).forEach(eventId => $gameSelfSwitches.setValue([$gameMap._mapId, eventId, 'A'], false))
I tried looking through the .js file for Yanfly's Self Switch and Variables, but my understanding of JavaScript is still pretty rough. I put this together, but it doesn't work.
Code:
$gameMap.events().reduce(function(a, c) { var e = c.event(); if (e.name === "evtEncounter") a.push(e.id); return a; }, []).forEach(eventId => $gameSelfSwitches.setValue([$gameMap._mapId, eventId, 'SELF VARIABLE' + 61], 0))
Can anyone point me in the right direction?