This should work:
JavaScript:
for (const sprite of SceneManager._scene._spriteset._balloonSprites) {
if (sprite._target._character == $gamePlayer) {
SceneManager._scene._spriteset.removeBalloon(sprite);
}
}
This should work:
for (const sprite of SceneManager._scene._spriteset._balloonSprites) {
if (sprite._target._character == $gamePlayer) {
SceneManager._scene._spriteset.removeBalloon(sprite);
}
}
Welcome! Unfortunately, it's not really - the thread title is JavaScript questions (and your post doesn't refer to any JavaScript code), and the first post says:
Ah, okay. Thank you!
$gameParty.leader === $gameActors[1]
I can't help with your code, but I am replying to your message because I saw your list of games. I own Undefeated and wanted to let you know! Cool game!
What are you asking? The only items you can equip on an actor are weapons and armor, so it seems you already know the answer - you give no other explanation of what you're trying to do.
You can't really. The traits are drawn from the JSON database files, so just modifying them via JavaScript during your game won't have a lasting change.
Similar to the answer above, the icons are read from the database when they're referenced. The easiest way to do something like this would be to create duplicate states with the different icons and actually change the state during play.
Actually, that's perfect for me. As I want the change to my traits to be temporary.
This is actually not quite accurate (depending on how you want to define "the database"). The database files are only read one time, when the game first boots up. After that, the contents are all stored in memory, as JavaScript objects, and are read from memory each time they are referenced. This means that you actually can change the properties of those objects in memory, and the changes will persist until the next time the game boots up. At least, this is definitely true for MZ. I'm too lazy to check MV, but I'm reasonably certain it will apply to MV as well.
$dataStates[stateId].iconIndex = newIconId;
stateId with the actual numerical ID of the state, and newIconId with the actual numerical ID of the new icon that you want to use.code, dataId, and value.code represents the type of trait, and the dataId represents the sub-option within that type, and the value represents the intensity. So if you're looking at the traits GUI in your database, the code represents what you selected with a radio button (for example, "Ex-Parameter"), and the dataId represents what you selected in the dropdown box next to that option (for example, "HP Regeneration"), and the value represents whatever you type in the input box (for example, -10%).$dataStates[stateId].traits[index].value = newValue;
$dataStates[4].traits[0].value = -0.2;
This is working. Thanks!
I would just store the original value into a variable, before you overwrite it, and then restore it when you want to. You *could* re-load the states from the States.json file, but that wouldn't be a particularly performance-conscious thing to do.
You are correct. That is how it works in MV also, and it is what I meant. I just presume if someone says they want to change something in their game that it will stay changed 😉
Original thread: https://forums.rpgmakerweb.com/threads/javascript-questions-that-dont-deserve-their-own-thread.46341/