Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0

Question

Hi everyone, I'm really stuck on a character movement event. What I want is for a character to move on the spot, then to change walking direction still not moving away from that one spot.

 

So basically the character is walking left, then right, then up etc but all on one square. Can it be done?

 

Thanks!

Share this post


Link to post
Share on other sites

18 answers to this question

Recommended Posts

  • 0

Um, just use the "Turn (direction)" command in the "Set move route" event? I guess a problem you might have is turning instantly, so you would need to put Wait commands between the Turn commands.

Share this post


Link to post
Share on other sites
  • 0

That just rotates the character, I want it so the character is actually animated on the spot. As if it's walking on the spot.

Edited by madanchi

Share this post


Link to post
Share on other sites
  • 0

I think he wants something like pokemon?

So you can turn in place before actually going. Like if im facing up and i want to go left once i press left my character will turn left and a 2nd left press will make the character actually go left.

 

That what your looking for?

Share this post


Link to post
Share on other sites
  • 0

Well if that's all you want "Stop animation" will do. From the event options.

Share this post


Link to post
Share on other sites
  • 0

Thanks everyone I got it working! It was the 'Stop Animation' that got it working thanks. Now all I have to do is figure out the Wait Frames amount before it moves onto the next line of frames (as I have custom drawn character), which I must say is being a real pain... It just doesn't flow. (but it animates very smooth on an actual animating program that I've used at any given fps)

Edited by madanchi

Share this post


Link to post
Share on other sites
  • 0

how many frames for walking is your character? You realize that RPGmaker standard animation for sprites is only 4 frames?

Share this post


Link to post
Share on other sites
  • 0

Oh yeah I know that, all I'm doing is trying to exploit how many I can achieve. 4 frames per line (down, left, right, up). All I need is 8 frames, so I use 2 rows (down, left).

 

So I set moveroute to turn down, wait X frames, turn left, wait X frames, repeat. I've tried from 10-30 frames with Wait Frame. I've also tried in Smooth mode but it just doesn't seem to move onto the next set of frame smoothly. Here's a very small video on what happens.

 

Edit: Youtube killed RMXP's fps, sorry about that, it was fine in rendering. Also the animation looks a bit funky on the 2nd flame animation part.

 

http://www.youtube.com/watch?v=WK3IKuHflBE

Edited by madanchi

Share this post


Link to post
Share on other sites
  • 0

im guessing you need more control over the changing of the frames, i quickly wrote this up to achieve such:

class Game_Character
 attr_reader :frame_amount
 alias init_frames initialize
 def initialize
   init_frames
   @frame_amount = 0
   @frame_count = 0
   @frame_timer = 0
 end
 def change_frames(amount, time=20)
   @frame_amount = amount
   @frame_count = time
 end
 def increase_frame
   @frame_timer = @frame_count if @frame_timer == 0
   @frame_timer -= 1 if @frame_timer > 0
   @pattern = (@pattern + 1) % 4 if @frame_timer == 0
   @frame_amount -= 1 if @frame_timer == 0
 end
 alias update_frames update
 def update
   increase_frame if @frame_amount > 0
   update_frames
 end
end

there is 2 small edits that you will have to make to the default scripts before this works properly,

(1) go into game character 2 script an look up line 21, you will see the following:

# If animation count exceeds maximum value
 # * Maximum value is move speed * 1 taken from basic value 18
 if @anime_count > 18 - @move_speed * 2
 # If stop animation is OFF when stopping
 if not @step_anime and @stop_count > 0
	 # Return to original pattern
	 @pattern = @original_pattern
 # If stop animation is ON when moving
 else
	 # Update pattern
	 @pattern = (@pattern + 1) % 4
 end
 # Clear animation count
 @anime_count = 0
 end

wrap that in this condition:

if @frame_amount == 0
end

 

(2) look up interpreter 1 script, go to line 141 and add the following above the "if @ message_waiting" condition:

for event in $game_map.events.values
 return if $game_player.frame_amount > 0 or
	 event.frame_amount > 0
 end

 

the first edit ensures that the frame will not reset to 0 when the script is running and the second ensures that the event wont proceed until it has finished, so now to use the script:

#script calls
#for the player:
$game_player.change_frames(AMOUNT_OF_FRAMES, FRAME_TIME)
#or for events:
$game_map.events[EVENT_ID].change_frames(AMOUNT_OF_FRAMES, FRAME_TIME)

simply change AMOUNT_OF_FRAMES to the amount of times it will change frame, and FRAME_TIME to the amount of time it takes to procceed to the frame(just like the wait frames command)

hope this helps, it will definatly give you more control over the timing of the frames :)

also you dont have to add the FRAME_TIME in, if you dont it will throw a default of 20

Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

there is 2 small edits that you will have to make to the default scripts before this works properly,

(1) go into game character 2 script an look up line 21, you will see the following:

# If animation count exceeds maximum value
 # * Maximum value is move speed * 1 taken from basic value 18
 if @anime_count > 18 - @move_speed * 2
 # If stop animation is OFF when stopping
 if not @step_anime and @stop_count > 0
	 # Return to original pattern
	 @pattern = @original_pattern
 # If stop animation is ON when moving
 else
	 # Update pattern
	 @pattern = (@pattern + 1) % 4
 end
 # Clear animation count
 @anime_count = 0
 end

wrap that in this condition:

if @frame_amount == 0
end

 

Wow thanks for the script help! Can't wait to try it, but I must be doing something wrong. I get this error when running, "SyntaxError occurred while running script." Maybe I've done the step above incorrectly somehow. Where exactly should I insert it? Or doesn't it matter.

Edited by madanchi

Share this post


Link to post
Share on other sites
  • 0

it would be good to know exactly witch script snipet you are getting the error from, for the snippet you replyed to, it should be replaced to look like so:

if @frame_amount == 0

 # If animation count exceeds maximum value
 # * Maximum value is move speed * 1 taken from basic value 18
 if @anime_count > 18 - @move_speed * 2
   # If stop animation is OFF when stopping
   if not @step_anime and @stop_count > 0
     # Return to original pattern
     @pattern = @original_pattern
     # If stop animation is ON when moving
   else
     # Update pattern
     @pattern = (@pattern + 1) % 4
   end
 # Clear animation count
 @anime_count = 0
 end
end

for the first code snippet i posted, place it anywhere below defaults and above main

Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

Ok I started a new game because the old one had a custom script added which I forgot about. Error is below:

 

 

Script 'Interpreter 1' line 142: NoMethodError occured.

 

undefined method 'frame_amount' for #<Game_Player.0x3d6e6d0>

 

 

 

So now in the fresh game, it gives me error at line 142 in Interpreter 1. This is what I have below

 

 for event in $game_map.events.values
	 return if $game_player.frame_amount > 0 or
			 event.frame_amount > 0
	 end
 # If waiting for message to end
 if @message_waiting
 return
 end

Edited by madanchi

Share this post


Link to post
Share on other sites
  • 0

the only reason i can think you would get that error is if your not adding the first script in, here a demo i got it working in to help, i marked the edited scripts, copy over and replace all the scripts to your project

http://www.mediafire.com/?mq9xvgg73z9deml

Share this post


Link to post
Share on other sites
  • 0

Yeah that works perfect now, no errors but where do I put the last part? I tried in putting it as an actual script and in Event using the 'Script' button on page 3 but both give me error. I'm total noob when it comes to coding/ scripting, big time.

 

This:

#script calls
#for the player:
$game_player.change_frames(AMOUNT_OF_FRAMES, FRAME_TIME)
#or for events:
$game_map.events[EVENT_ID].change_frames(AMOUNT_OF_FRAMES, FRAME_TIME)

Edited by madanchi

Share this post


Link to post
Share on other sites
  • 0

if you look at the demo i upladed yoy will see exactly how to use the script calls, basicly use :

$game_player.change_frames(AMOUNT, TIME)

when changing the players frames, and :

$game_map.events[iD].change_frames(AMOUNT, TIME)

to change an events frames, fore event relpace ID in the brackets [] to the id of the target event, then replace AMOUNT to the amount of frames to run through, and TIME to the frame time it takes to proceed through them

Share this post


Link to post
Share on other sites
  • 0

Oh yeah sorry my bad I wasn't thinking clearly nor using my eyes. But I'd like to give you a very big thank you, it works seemlessly and is brilliant for what I was after! My frames now animate propperly and I can adjust frame control even more which is amazing! I thank you so much :D

 

One question, how do I get two events animating at the same time? I use the Loop button to repeat the animation.

Share this post


Link to post
Share on other sites
  • 0

either create a new event to manage it or add a new line in the same script call, adding a new line means that it runs both script calls in that one script call

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...