Animations are as many frames as you define them to be in the Animations tab.Is it possible to set animations to two frames only through code or otherwise?
First of all, thanks. I want 2 frame animations both in battles and otherwise (characters walking on the map).Animations are as many frames as you define them to be in the Animations tab.
Do you possibly mean sprite motions, as defined in Help -> Contents -> Documentation -> Side-view Character Standards?
If yes, you could either:
- Just paste one of the existing cels over one of the others, and you'll see only two frames
or
- You could look at Sprite_Actor.updateFrame(). Changing instances of 3 to 2 would probably do what you want, but I haven't carefully examined each line and its math. If you only want to affect battle and not, say, the characters walking on the map, you might need to copy contents from that into Sprite_Battler.updateFrame(), which is currently empty.
var min = 600; //10 minutes
var max = 900; //15 minutes
var frames = Math.random() * (max + 1 - min) + min;
this.wait(frames * 60);
$gameSystem.playtime()
SoDoes this wait get reset every time the game is loaded?
What about every time a player transfers maps?
this.wait()
is exactly what the Wait event command calls (I understand you're using a variable for the argument).Thank you so much, Turan!That does reset when changing maps.
"Yes" to the second question. For the third question, that is an option, as long as you don't mind the timer pausing during battle and when the menu is open. However, with that method, the timer would lose a bit of accuracy every time the player changes maps, so I'd recommend using even smaller increments than seconds to minimize the accuracy loss.Code:var min = 600; //10 minutes var max = 900; //15 minutes var frames = Math.random() * (max + 1 - min) + min; this.wait(frames * 60);
Hi guys. I have the above as a common parallel event. The goal is for the game to wait for 10-15 minutes before respawning an event.
Could you help me out please with these two questions:
If yes to the above questions, would I have to increment a variable every second/minute instead to track how much time is left?
- Does this wait get reset every time the game is loaded?
- What about every time a player transfers maps?
$gameSystem.playtime()
to a variable as soon as the event despawns, and then periodically subtract that value from the current value of $gameSystem.playtime()
to determine whether or not enough time has passed in order for the respawn to occur. /* @command specific
* @text Open Character Creator For Actor
* @desc Opens the character creator for a specific actor.
* Enter the actor's ID.
* @arg actor
* @type number
* @text Actor ID
* @desc The ID of the actor you want to call.
*/
PluginManager.registerCommand(pluginName, "specific", args => {
characterBeingEdited = args.actor;
filename = $gameActors.actor(characterBeingEdited).characterName();
SceneManager.push(ShowCharacterCreator);
});
//ShowCharacterCreator calls imageOverlay with an array of character parts pngs.
async function imageOverlay(characterArray) {
//Reading array of images to layer
let imageOne = await Jimp.read(characterArray[1]);
let imageTwo = await Jimp.read(characterArray[2]);
let imageThree = await Jimp.read(characterArray[3]);
let imageFour = await Jimp.read(characterArray[4]);
let imageFive = await Jimp.read(characterArray[5]);
//Reading base image
const imageZero = await Jimp.read(characterArray[0]);
//Layering the images using Jimp node library
imageOne = await imageOne
imageZero.composite(imageOne, 0, 0, {
mode: Jimp.BLEND_SOURCE_OVER
})
imageTwo = await imageTwo
imageZero.composite(imageTwo, 0, 0, {
mode: Jimp.BLEND_SOURCE_OVER
})
imageThree = await imageThree
imageZero.composite(imageThree, 0, 0, {
mode: Jimp.BLEND_SOURCE_OVER
})
imageFour = await imageFour
imageZero.composite(imageFour, 0, 0, {
mode: Jimp.BLEND_SOURCE_OVER
})
imageFive = await imageFive
imageZero.composite(imageFive, 0, 0, {
mode: Jimp.BLEND_SOURCE_OVER
})
//Write to actor's existing spritesheet in img/characters/
url = "img/characters/" + filename + ".png";
await imageZero.writeAsync(url);
//Figure out how to refresh player character at runtime without closing out of the window
//user = $gameActors.actor(characterBeingEdited);
//user.setCharacterImage(filename, 0);
//user.refresh();
//$gameParty.leader().setCharacterImage(filename,0);
//$gamePlayer.refresh();
//ImageManager.clear();
//PIXI.utils.TextureCache = {};
//user.characterName = Bitmap.load(url);
//????????
}
Assuming you're using MZ, you can remove a specific character sheet from cache like this:I've been scouring for hours and can't find a way to actually remove the actor graphic from the cache to force an update. I'm trying to make a character customization plugin that saves to a character sheet, but I have to reboot the game to get the new graphic to load and that doesn't work for a character creator. I've tried clearing the cache, manually loading the bitmap, refreshing the actor, manually setting the image, using the image manager to load the url, everything I can think of. There's no reason the game shouldn't be able to reload one graphic after the initial load if I do something, given that it loaded it in the first place, but I don't know what that something is.
const cache = ImageManager._cache;
const url = "img/characters/" + Utils.encodeURI("Butt") + ".png";
if (cache[url]) {
cache[url].destroy();
delete cache[url];
}
Butt
(on the second line) with the actual filename of the character sheet.Unfortunately, that still didn't update the actor's graphic. I don't really understand why it won't, because it seems like it should, but the actor's graphic remains the cached one even after the cache is cleared, even if I set it to something else and refresh it before clearing the cache.Assuming you're using MZ, you can remove a specific character sheet from cache like this:
Just replaceJavaScript:const cache = ImageManager._cache; const url = "img/characters/" + Utils.encodeURI("Butt") + ".png"; if (cache[url]) { cache[url].destroy(); delete cache[url]; }
Butt
(on the second line) with the actual filename of the character sheet.
<JS Post-Damage>
for (let i=0; i<target.friendsUnit().aliveMembers().length; i++)
{
if (target.friendsUnit().aliveMembers()[i]!=target)
{
target.friendsUnit().aliveMembers()[i].gainHp(0-Math.round(value/10));
target.friendsUnit().aliveMembers()[i].startDamagePopup();
}
}
</JS Post-Damage>
<JS Post-Damage>
$gameTroop.aliveMembers().forEach(enemy => if (enemy!=target)
enemy.gainHp(0-Math.round(value/10)))
$gameTroop.aliveMembers().startDamagePopup();
</JS Post-Damage>
<JS Post-Damage>
{
if (target.result().critical)
AudioManager.playSe({
name: '101-Attack13',
volume: 20,
pitch: 100
});
else
AudioManager.playSe({
name: 'Slash',
volume: 20,
pitch: 100
});
}
</JS Post-Damage>