Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Animations on Events

SPN

Member

Hey, quick question for you guys. I could've sworn I remembered back in the old days, you could display animations on characters from within the Set Move Route options. It doesn't seem like you can in RMXP.

A lot of games hide items around the world, and have a little shiny graphic as a hint to the player. I have the little shiny animation done up, but I'm having trouble getting it to display (and loop) on a certain event until it's found by the player. The only real easy option I can see to keep all the coding in one event is to use the Call Script option within the event's Autonomous Movement.

That's where you guys come in! What kind of script snippet would I have to put in there to loop an animation on that event? I figure this isn't complicated, but please don't overestimate my Ruby knowledge :)

Thanks!
 

MarkR

Member

In the call script, use the following code:
Code:
self.animation_id = animation_id

And change the animation_id to any animation you want to use.
You should add a wait command after the call script which waits the same amount of frames the animation uses.

So your move route should look like this:
Code:
$>Script: self.animation_id = 1

$>Wait: 16 frame(s)
 
Mark, that will not work. The term 'self' when interpreted is interpreted as 'Game Interpreter'. If you want to manually set the 'animation' of a event, you have to do it with this

Code:
 

get_character(0).animation_id = ANIMATION_ID

 

The (0) says to get the event that is currently being processed. Otherwise it would use the event_id that is specified.. or a -1 is the player.
 

MarkR

Member

Gubid":3qwqwpdy said:
Mark, that will not work. The term 'self' when interpreted is interpreted as 'Game Interpreter'. If you want to manually set the 'animation' of a event, you have to do it with this

Code:
 

get_character(0).animation_id = ANIMATION_ID

 

The (0) says to get the event that is currently being processed. Otherwise it would use the event_id that is specified.. or a -1 is the player.
I agree that your code works if you use the call script command in the List of Event Commands, but when you use a call script in a Move Route it will be executed in the Game_Character class. (Which is btw a great way of adding extra movement commands to your events :D)

To make it more clear: When I say Move Route, I mean the window you get when you press Move Route or Set Move Route. ;)
The call script in a Move Route is executed on line 338 of the Game_Character class.
 

SPN

Member

Yes, yes I did! Thanks a lot, guys. Turns out after some head scratching that animations don't want to display visually on an event with 0 Opacity, but I got it all figured out. You guys were both right, just about different things :P
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top