Common event keeps repeating infinitely (Trying to make an Idle animation)

nebula621

Villager
Member
Joined
Jan 6, 2021
Messages
8
Reaction score
6
First Language
Spanish
Primarily Uses
RMMV
Hello!
I'm trying to add a looping idle animation when the player is not pressing a movement key, the graphic changes and reverts back nicely, but when I add the Move Route command, to do the animation, only the first line is executed infinitely, I'm guessing its because it's a Parallel Process that is checking constantly if you are pressing the key but I don't know how to do it any other way !



1636071507747.png
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,290
Reaction score
9,703
First Language
German
Primarily Uses
RMMV
if the automated wait doesn't work for that case, you'll need to enter a manual waitloop.

basically you'll count up a waiting counter variable and only repeat the branch with the move command if the number is high enough (and reset it then)

unfortunately I don't know enough of RM2K(3) to tell you how exactly to do this.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,592
First Language
English
Primarily Uses
RMMZ
Yeah, the problem is that a parallel process event runs every frame, so as soon as you let go of the movement key, it's going to hit the true clause of your if statement for no key again and go right back to the idle pose.

What I would do is set an "idle wait" variable when the player first gets control to a value reflecting how long a period of inactivity you want it to be until the idle animation kicks in, then at the beginning of your parallel process event decrement that variable. Then put the rest of the code in a conditional branch checking for that variable's value being 0, and at the end of the inner code, set the variable back to its initial value.
 

AkiraKotatsuhime

炬燵姫
Veteran
Joined
Jan 2, 2013
Messages
170
Reaction score
130
First Language
DE / ドイツ語
Primarily Uses
N/A
[Wait for all Movement] is waiting for every move-route-process on the map to finish before the code continues, so it would wait longer than you want to do so in the first place if any other object than the player-character is receiving move-related commands that take more time. That's not the right one to use in most cases, same problem goes for [Stop all Movement].

To estimate waiting times of move-routes, add 8 frames of waiting time (see below) for each walk-step on normal speed (1=64, 2=32, 3=16, 4=8, 5=4, 6=2) and dontknowhowmuchtime for decreased frequency.

At next I'm a bit confused why you tell the player-character to take a south-step if nothing is pressed, could it be you just wanted it to force the looking direction to down? Also there is a line that sets a switch ("IDLE") to ON (what's the effect of doing this at all?), but never to OFF. Is that done somewhere else?

The counting-variable suggested above would definitely help creating a working idle-handler since all happening here is instant when you stop pressing buttons and the possibility to use idle should be catched in a switch-condition since it could happen that sometimes you don't want it to appear (like in cutscenes or somewhat). If you remove the unfitting wait-all and stop-all, the event will run approximately thousands of times per second until the event-interpreter gives up executing it. That should be reduced to 60 (once per frame) by adding a [Wait: 0.0s] (0 equals one frame, 1 and above equals n*0.1s) line to the very end.

Everything that follows below is theoretical, incomplete and untested. I'm just adding it for further brainstorm and stuff.

CE [0001:IdleProcess CATCH] - Parallel Process - Switch [0001:IdleAllowed] needed
Code:
<>Variable [0001:IdleCount] = 0
<>Variable [0003:IdleFrame] = -1
<>Switch [0002:IdleNow] = OFF
<>Loop
 <>Get Key Input: [0002:Keys] without waiting
 <>If Variable [0002:Keys] == 0
  <>If Switch [0002:IdleNow]
  <>Variable [0001:IdleCount] += 1
  <>If Variable [0001:IdleCount] >= (Insert duration between last button and idle start in 60FPS)
   <>Switch [0002:IdleNow] = ON
   <>
  : END
  <>
 : ELSE
  <>Variable [0001:IdleCount] = 0
  <>
 : END
 <>If Switch [0001:IdleAllowed] == OFF
  <>Switch [0003:IdleStop] = ON
  <>
 : END
 <>If Switch [0003:IdleStop] = ON
  <>Break Loop
  <>
 : END
 <>Wait: 0.0s
 <>
: Loop End
<>

CE [0002:IdleProcess MAIN] - Parallel Process - Switch [0002:IdleNow] needed
Code:
<>If Switch [0003:IdleStop] == ON
 <>Call CE: [0003:IdleProcess STOP]
 <>Switch [0002:IdleNow] = OFF
 <>
: ELSE
 <>Variable [0003:IdleFrame] += 1
 <>Variable [0003:IdleFrame] %= (Insert duration of complete idle animation in 60FPS)
 <>(Insert additional code for advancing a frame in idle depending on variable status)
 <>
: END
<>Wait: 0.0s
<>

CE [0003:IdleProcess STOP] - Execute on Demand
Code:
<>(Insert the entire process for stopping idle here)
<>Switch [0002:IdleNow] = OFF
<>

~炬燵あ
 

Latest Threads

Latest Posts

Latest Profile Posts

I just bought VN Maker with 75% off, just for the assets.
IGMC is back everyone!
Fun challenge: Guess the name of this enemy!
Watchman.png
Nearly done with the topmost deck of the SS Astrale Symphonie (she's got a name at last!). Still needs a lot of work but at least now it is vaguely recognizable as a ship deck. Working at a snail's pace but it's coming together. :kaopride:
Screenshot-2022-06-30-104933.png
Letting people know I'm debating leaving RM, and thus this forum. I'll continue to keep in touch with any friends I've made here, but between Unity being better suited to my needs and people on here getting increasingly horrible, I think switching my games to Unity might be better for my mental health.

Forum statistics

Threads
123,201
Messages
1,154,859
Members
161,576
Latest member
eddyneo69
Top