STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
first look at this piece of code:

$gameScreen.showPicture(1,'test1(9x12)', 1, 1366, 700,200,200,0,0);
$gameScreen.movePicture(1,1, 1166, 700, 200, 200, 255,0,20);
$gameScreen.picture(1).setSpritesheetFrame(2);
◆Wait:1
$gameScreen.picture(1).setSpritesheetFrame(3);
◆Wait:1
$gameScreen.picture(1).setSpritesheetFrame(4);
etc

You see, I am looking for a way to make an image be shown during the selection of skills, until there is everything is on the right track although not working at all. but to complement this I want the image to change for another from time to time. But I don't know how I can make it wait before switching to the next image.

I change the images using the command within Yep Sprite Sheet images. In general, the image that I load is a spriteSheet and I make it change from time to time. Outside of battle it works with common event, but when I try to call it inside it does not work, I call it when the skills are being selected. So I opted to do it using js. now the image is displayed but I don't know how to make it wait before showing the next frame
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
427
Reaction score
186
First Language
PT-BR
Primarily Uses
RM2k3
JavaScript:
this.wait(frames)
Only one wait will work in a script call. It's because a script call runs everything at once within that block. The only way to work around with it is having a custom method or set a timeout.

Reference:
RMMV Script Calls
 

STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
And that must be a headache right? I think I will need more help than I thought.
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
859
Reaction score
464
First Language
German
Primarily Uses
RMMV
some stuff needs to be in a seperated code action chain..
stuff like "wait" or "call common events"..
i guess thats because the system reads everything within 1 frame..

therefor i used stuff like export code parts in common events or using switches with an update-function., but i am a noob in JS myself so i probably cant give the best advice..
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
427
Reaction score
186
First Language
PT-BR
Primarily Uses
RM2k3
I'm sorry, but what is the need to put a timer in the middle of the code?
If you are creating a "plugin" and really need some of the code to take longer to run, use this native function:
setTimeout(function(){ alert("Hello World"); }, 3000); //3000ms = 3 Seconds

Example with 3-second intervals at each run.
JavaScript:
setTimeout(function(){
   alert("Hello World");
}, 3000);

setTimeout(function(){
   alert("Hello Moon");
}, 6000);

setTimeout(function(){
   alert("Hello Mars");
}, 9000);
Do not use this within events of Rpg Maker.
 

STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
some stuff needs to be in a seperated code action chain..
stuff like "wait" or "call common events"..
i guess thats because the system reads everything within 1 frame..

therefor i used stuff like export code parts in common events or using switches with an update-function., but i am a noob in JS myself so i probably cant give the best advice..
I was reviewing and I found a post of yours where Caethyril and Andar helped you create several commands in time within a single Scrip call, it does not look easy I admit but I will try to try it seems to be a good option.

I'm sorry, but what is the need to put a timer in the middle of the code?
If you are creating a "plugin" and really need some of the code to take longer to run, use this native function:
setTimeout(function(){ alert("Hello World"); }, 3000); //3000ms = 3 Seconds

Example with 3-second intervals at each run.
JavaScript:
setTimeout(function(){
   alert("Hello World");
}, 3000);

setTimeout(function(){
   alert("Hello Moon");
}, 6000);

setTimeout(function(){
   alert("Hello Mars");
}, 9000);
Do not use this within events of Rpg Maker.
Yes, you are right, right now I am reading a method that should work but it will take a while, it will be a matter of trial and error.
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
427
Reaction score
186
First Language
PT-BR
Primarily Uses
RM2k3
All Javascript commands are executed almost at the same time, so I made this example which is very intuitive.

I particularly prefer to create customized systems for events, such as menus, effects, calculations.
I only use Javascript to access functions that events cannot.
 

STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
well I will leave a link to the post to which I refer in case someone wants to help me, I hope
Dopan Post

I am not a great user of js, so any help is good for me, mine has always been the visual section
First I will get to understand how splice () works. then I will see what magic is necessary to achieve the rest
 
Last edited:

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
859
Reaction score
464
First Language
German
Primarily Uses
RMMV
well I will leave a link to the post to which I refer in case someone wants to help me, I hope
Dopan Post

I am not a great user of js, so any help is good for me, mine has always been the visual section
First I will get to understand how splice () works. then I will see what magic is necessary to achieve the rest
the post you are refferng to, shows a solution that works only within a "game interpreter prototype"-function

i guess what you need are plugin switches that are connected with some update-functions..

so that some stuff only happens when the update function knows that the switch has changed
(instead of let everything happening within 1 frame)

sry i cant give a proper example..

or you could call a common event which is attached to the plugins parameter.. and let "the show img stuff" and "wait stuff" happen in that common event,where the "wait event command" will work correctly..


-> but i think the best would be to explain more detailed what exactly you want to archieve and hope for a pro.JS_user
to help you out with a simpler solution
 
Last edited:

STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
Array splice() Method:
Thanks for the link, I'll try it in the morning; I'm already a bit of a zombie for that

@Dopan You are absolutely right, I will detail it below:

I want to achieve a bust image, but not the classic image that appears and that's what I'm using Yep SpriteSheet Image for. The one that allows you to read a SpriteSheet and make the image change between its frames using this command: $gameScreen.picture(1).setSpritesheetFrame(2);
this causes image one that is read as frames thanks to this plugin to go to frame 2.
I made a common event in parallel process that is triggered when switch 6 is activated. Which shows an animated image of about 50 Frames, pausing a frame between each command
Example:
$gameScreen.picture(1).setSpritesheetFrame(1);
Wait: 1
$gameScreen.picture(1).setSpritesheetFrame(2);
Wait: 1
$gameScreen.picture(1).setSpritesheetFrame(3);
Wait: 1
....Until 50...
But it does not show when it is the actor's turn to choose his abilities using the common event method. So I decided to convert it to js, and here if it is shown and hidden when I order it, with the required fade.
So far, the problem is that I do not know how to make it wait a while before going to the next frame, without interrupting the progress of the game. So I thought that a parallel event would be the best.
The case is that as they explained to me, everything is executed at once and only the last dictated frame appears. For the second there is the problem of making this image change according to the current actor, but I think that for later.
It is good to say that the image must be in Picture and have this structure
imageName (HxV)
H = number of frames Horizontal
V = number of Vertical frames.

Anyway I am looking to use this Yep Plugin to create a BustPlugin or Function, showing real animation bust.

I hope I have explained myself well

s a record of the sprites, in battle, I don't know if it helps but at least it shows what should be displayed. when actor X is selected skills. Of course it does not appear where it should. It only weighs kilobytes
 

Attachments

  • starfallRequest.rar
    430.2 KB · Views: 1
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,414
Reaction score
1,823
First Language
EN
Primarily Uses
RMMZ
Strange that Yanfly's plugin doesn't seem to offer a way to automatically animate a picture! Since you mentioned battle and Parallel events: by default Parallel/Autorun events only run on the map scene, not in battle. So you might need a plugin specifically for this.

The command codes for Wait and Script are 230 and 355; both commands take 1 parameter each: wait time and script as string, respectively. I found this by searching rpg_objects.js for // Wait and // Script.

You could use a loop to generate the appropriate commands and insert those into the interpreter, e.g.
JavaScript:
var i = this._indent;
var p = '$gameScreen.picture(1).setSpritesheetFrame(%1);';
var list = [{ code: 355, indent: i, parameters: [p.format(1)] }];  // set frame 1
for (var n = 2; n <= 10; n++) {  // loop n = 2 to 10
  list.push({ code: 230, indent: i, parameters: [1] });            // wait 1 frame
  list.push({ code: 355, indent: i, parameters: [p.format(n)] });  // set frame n
}
// avoid mutation of original command list!
var next = this._index + 1;
var a = this._list.slice(0, next);
var b = this._list.slice(next);
this._list = a.concat(list, b); // before -> new -> after
Note that this approach makes a copy (slice) of the before and after commands, then connects them (concat) with the new commands and reassigns the entire command list. This is because inserting the new commands in directly (splice) is unsafe: it will alter the event commands for the rest of the play session! :kaoback:

Edit: the above example assumes it's running in the appropriate Game_Interpreter context; if not, you'll need to replace this with a reference to such an object for it to work.

If you're writing a plugin and you want a delay, you can define a frame counter and update it and the associated effects via an appropriate update method, e.g.
JavaScript:
(function(alias) {
  Game_Screen.prototype.updatePictures = function() {
    alias.apply(this, arguments);  // default behaviour
    // then your own code
    [1,2,3].forEach(function(pictureId) {  // for picture IDs 1, 2, and 3...
      var pic = $gameScreen.picture(pictureId);  // get picture
      pic._animationCount = pic._animationCount || 0;  // 0 if not already defined
      if (++pic._animationCount >= 20) {  // every 20 game frames...
        pic._animationCount = 0;  // reset counter
        pic.setSpritesheetFrame((pic.spritesheetFrame() + 1).mod(12));  // next picture frame
      }
    }
  };
})(Game_Screen.prototype.updatePictures);
This is just an example, there may be bugs (hopefully not) and you'll probably want to edit it for your own purposes anyway~
 
Last edited:

STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
Yes, it is something strange that Yep has not put the auto animation option, in it, I will try to see if there is any extension for that plugin. it's a good idea, and thanks again.
Edit-------
Search without results apparently if we can do this this would be the only extension . So I have to do it.
Headaches Welcome be !!
 
Last edited:

STARFALL

Core of the Stars
Veteran
Joined
Jul 6, 2020
Messages
212
Reaction score
54
First Language
spanish
Primarily Uses
RMMV
sorry the double post was accidental, I try to remove it but it was not possible. There is no option for the user to delete a comment of their own?
 
Last edited:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,001
Reaction score
8,896
First Language
English
Primarily Uses
RMMV

@STARFALL , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.


Please just edit your last post to add new information, unless it's been 72 hours.
 

Latest Threads

Latest Posts

Latest Profile Posts

4y195n.png
big image so i posted it as a spoiler
Just a reminder to back your projects up. Do it now! :yamero:
If there was an award for best game dev procrastination, I'd say 'meh, I'll pick it up tomorrow' >_>
Honestly though, I've been staring at the same half-made map for a while now haha! Ahhh, I'm so tired of mapping!
Time to add the support for import/export default RMXP maps. Maybe there will be customized tileset support later. In theory, I can reimplement the entire RMXP inside this RMXP-made game to make more RMXP games. :kaojoy:RMXPFORMATSUPPORT.jpg
Gonna make a story driven game someday in RPG Maker about this diseased character in my head. Will keep you posted, although I was warned by the authorities that posting too much would be considered 'spamming' so I WON'T SPAM. It'll be before I go in anyways. It's gonna be messed up but it won't be explicitly pornographic so don't worry, I'll give all the content warnings. :barf::barf::barf:

Forum statistics

Threads
111,269
Messages
1,059,776
Members
144,566
Latest member
Loltoheaven777
Top