I'm trying to write up a script as a common event, where based on the ID of the actor talking I get a corresponding SE (for testing purposes I set up the SE names as numbers).
However I only get the "Failed!" prompt as a result. Do I need the .speakerName() call elsewhere or I have made some other mistake?
JavaScript:
for (var x = 1; x < $gameActors._data.length; x++) {
if ($gameMessage.speakerName() == $gameActors.actor(x).name()) {
$gameVariables.setValue(8, x.toString());
console.log("This is printed out!");
AudioManager.playSe({name: $gameVariables.value(8), volume: 90, pitch: 100, pan: 0});
} else {
console.log("Failed!");
}
}
However I only get the "Failed!" prompt as a result. Do I need the .speakerName() call elsewhere or I have made some other mistake?