Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Reply to this topicStart new topic
> [RMVX] Stand/Walk/Run
Ty
post Jan 20 2008, 01:26 PM
Post #1


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Script Name: Stand/Walk/Run
Written By: Synthesize
Current Version: V.2.50 Final
Release Date: January 26, 2008
Revised: September 4, 2010

What is this script?
This script allows running and animations for running. It also allows idle stances (Show the sprite when he is not moving).

Features:
- Allows you to have running animations
- Allows you to have idle animations
- Allows you to specify the time before the actor goes idle
- Allows you to have run points
- Allows you to customize how many run points are restored
- Turn everything ON/OFF

Version History:
Version 2.00A
- The script should actually work now =D

Version 1.00A
- First release
- Converted from my RMXP Version


CODE
#===============================================================================
# Stand/Walk/Run Script --- RMVX Version
#===============================================================================
# Written by Synthesize
# Version 2.50
# January 26, 2008 (v1)
#     Revised: March 1, 2008 (v2)
#     Revised: September 4, 2010 (v2.5)
#===============================================================================
# Customization
#-------------------------------------------------------------------------------
module StandWalkRun
  Use_run = true   # Use Run Points?
  Use_run_sprite = true    # Use a Running sprite?
  Run_sprite_suffix = '_run'   # Running Sprite Suffix
  Run_points = 100   # The maximum amount of Run Points
  Run_points_restore = 60   # 1 Run Point is restored in X Frames
  Restore_run_while_walking = true   # Restore points while walking?
  Use_idle_sprite = true   # Use Idle Sprite?
  Idle_sprite_suffix = '_idle'   # idle Sprite Suffix
  Use_anime = true   # Animate your Idle Sprite?
  Idle_time = 240    # Time before sprite is animated
end
#-------------------------------------------------------------------------------
# Scene_Map:: The main functions of the script are here
#-------------------------------------------------------------------------------
class Scene_Map < Scene_Base
  # Aliases
  alias syn_map_update update
  alias syn_map_start start
  #-----------------------------------------------------------------------------
  # Initiate variables
  #-----------------------------------------------------------------------------
  def start
    if $game_player.old_character_name == nil
     $game_player.old_character_name = $game_player.character_name
    end
    @wait_time = 0
    @wait_time2 = 0
    syn_map_start
  end
  #-----------------------------------------------------------------------------
  # Update:: Update the scene
  #-----------------------------------------------------------------------------
  def update
    syn_map_update
    if Input.dir4 == 0
      wait(1, false) if StandWalkRun::Use_idle_sprite
      call_idle($game_player.character_name + StandWalkRun::Idle_sprite_suffix, StandWalkRun::Use_anime) if @wait_time == StandWalkRun::Idle_time
      $game_temp.syn_state = "idle"
      restore_run if StandWalkRun::Use_run
    else
      $game_temp.syn_state = ""
      restore_run if StandWalkRun::Restore_run_while_walking
      call_idle($game_player.old_character_name, false) if $game_player.character_name != $game_player.old_character_name
      @wait_time = 0
    end
    if $game_temp.sprite_changed == true
      $game_player.old_character_name = $game_player.character_name
      $game_temp.sprite_changed = false
    end
  end
  #-----------------------------------------------------------------------------
  # Call_Idle:: Sets and animates the idle Sprite
  #-----------------------------------------------------------------------------
  def call_idle(sprite, anime)
    $game_player.set_step_anime(anime)
    $game_player.set_graphic(sprite, $game_player.character_index)
  end
  #-----------------------------------------------------------------------------
  # Restore_Run: Restore Run Points
  #-----------------------------------------------------------------------------
  def restore_run
    if $game_player.run_points < StandWalkRun::Run_points
      wait(1, true)
      $game_player.run_points += 1 if @wait_time2 == StandWalkRun::Run_points_restore
      @wait_time2 = 0 if @wait_time2 == StandWalkRun::Run_points_restore
    end
  end
  #-----------------------------------------------------------------------------
  # Wait:: Allows Wait Times
  #-----------------------------------------------------------------------------
  def wait(duration, value)
    for i in 0...duration
      @wait_time += 1 if value == false
      @wait_time2 += 1 if value
      break if i >= duration / 2
    end
  end
end  
#-------------------------------------------------------------------------------
# Game_Temp:: Create current state
#-------------------------------------------------------------------------------
class Game_Temp
  attr_accessor :syn_state
  attr_accessor :sprite_changed
  alias syn_temp_init initialize
  def initialize
    @syn_state = ""
    @sprite_changed = false
    syn_temp_init
  end
end
#-------------------------------------------------------------------------------
# Game_Character:: Create the Change_Sprite method
#-------------------------------------------------------------------------------
class Game_Character
  # Attr(s)
  attr_accessor :old_character_name
  attr_accessor :run_points
  alias syn_ch_init initialize
  #-----------------------------------------------------------------------------
  # Initialize Variables
  #-----------------------------------------------------------------------------
  def initialize
    @run_points = StandWalkRun::Run_points
    syn_ch_init
  end
  #-----------------------------------------------------------------------------
  # Set Setp Animation
  #-----------------------------------------------------------------------------
  def set_step_anime(value)
    @step_anime = value
    return @step_anime
  end
end
#-------------------------------------------------------------------------------
# Game_Player:: This handles the dash process
#-------------------------------------------------------------------------------
class Game_Player < Game_Character
  alias syn_player_update update
  alias syn_player_dash dash?
  def dash?
    return false if @run_points == 0 and StandWalkRun::Use_run
    syn_player_dash
  end
  #-----------------------------------------------------------------------------
  # Update:: Update the scene
  #----------------------------------------------------------------------------
  def update
    if dash?
      if Input.dir4 == 0
        $game_player.set_graphic($game_player.old_character_name, $game_player.character_index)
      end
      unless $game_temp.syn_state == "idle"
        set_graphic(@character_name + StandWalkRun::Run_sprite_suffix, 0) if StandWalkRun::Use_run_sprite
        @run_points -= 1
        syn_player_update
      end
    else
      syn_player_update
    end
  end
end
#-------------------------------------------------------------------------------
#            * This script is not compatible with RPG Maker XP *
#-------------------------------------------------------------------------------
# Written by Synthesize
# Version 2.00
# Requested by Cerulean Sky
#===============================================================================
# Stand/Walk/Run   - RMVX Version
#===============================================================================



NOTE:: When you change your sprite apperance, run the following in a 'Call Script' command: $game_temp.sprite_changed = true
This will update your animations instantly to show the sprite change.

DEMO: (OUTDATED!!!!)
http://www.4shared.com/file/37417060/77ae4...andWalkRun.html

This post has been edited by Ty: Feb 10 2011, 06:51 PM


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
HeLLRazor
post Jan 21 2008, 06:27 AM
Post #2


Level 2
Group Icon

Group: Member
Posts: 15
Type: Musician
RM Skill: Beginner




Please u the first person i see sharing a new character player animation script for VX in the world! Don't get this information on all the web: how about the 8 diagonal movement script? i have problems trying to translate it from XP . Its there a way to add this animations in your script? add individual animations to lower_left, lower_right, upper_left, upper_right THANKS
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 21 2008, 11:53 AM
Post #3


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




This script does not animate nothing. it changes the Character Graphic so RMVX animates a different graphic rather then the default sprite. So if you have a running sprite in your character folder, this script will change the player sprite to that sprite, then VX animates that sprite. I didn't see a point making my own animation methods when VX has it's own that works perfectly fine.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
HeLLRazor
post Jan 21 2008, 02:05 PM
Post #4


Level 2
Group Icon

Group: Member
Posts: 15
Type: Musician
RM Skill: Beginner




Got it xD
Go to the top of the page
 
+Quote Post
   
ComicStripGod
post Jan 22 2008, 08:32 AM
Post #5



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




I Copy this script But The script aren't work.What i need to do?
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 22 2008, 09:19 AM
Post #6


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Copy the script and place it above 'Main.' Then once the script is copied, change the settings at the top of the script. If you do not have a running_sprite/idle in your graphics folder you will get a File not found error. Turn Use_run_sprite and Idle_run_sprite OFF if you do not want to use a running/idle animation.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
HeLLRazor
post Jan 24 2008, 06:26 AM
Post #7


Level 2
Group Icon

Group: Member
Posts: 15
Type: Musician
RM Skill: Beginner




So I change this on Game_Player script (line 302 at 315)

CODE
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
case Input.dir8 #linha modificada
when 1; move_lower_left
#when 2; move_down
when 3; move_lower_right
when 4; move_left
when 6; move_right
when 7; move_upper_left
#when 8; move_up
when 9; move_upper_right
end
end


And then change this on your script:

CODE
#======================================================================
======
# * This script is untested *
#============================================================================
# Customization
#----------------------------------------------------------------------------
RUN_MOVE_SPEED = 6 # Speed to run
WALK_MOVE_SPEED = 5 # Speed to walk
USE_RUN_SPRITE = true # Use Animation?
RUN_SPRITE_SUFFIX = '_run' # Animation Suffix
USE_RUN0_SPRITE = true # Use Upper Diagonal Run Animation?
RUN0_SPRITE_SUFFIX = '_run0' # Upper Diagonal Run Animation Suffix
USE_RUN1_SPRITE = true # Use Lower Diagonal Run Animation?
RUN1_SPRITE_SUFFIX = '_run1' # Lower Diagonal Run Animation Suffix
USE_IDLE_SPRITE = true # Use Idle animation?
IDLE_SPRITE_SUFFIX = '_idle' # Animation Suffix
$RUN_ACTIVE = true # Run Active?
DIAG_MOVE_SPEED = 1 #Velocidade em diagonal NÃO FUNCIONA
USE_DIAG_SPRITE = true #Use Animation?
DIAG_SPRITE_SUFFIX = '_diag' #Animation Suffix
USE_DIAG0_SPRITE = true #Use Animation?
DIAG0_SPRITE_SUFFIX = '_diag0' #Animation Suffix

#----------------------------------------------------------------------------
# Scene_Map
#----------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias syn_map_update update
alias syn_map_start start
#--------------------------------------------------------------------------
#Initialize variables
#-------------------------------------------------------------------------
def start
syn_map_start
@game_character = Game_Character.new
@sprite_changed = false
end
#--------------------------------------------------------------------------
# Update
#-------------------------------------------------------------------------
def update
#--------------------------------------------------------------------
# Handles Idle Stance
#--------------------------------------------------------------------
if Input.dir8 == 0
# Sets Idle Sprite Stance
@game_character.change_sprite(IDLE_SPRITE_SUFFIX) if @sprite_changed == false and USE_IDLE_SPRITE == true
@sprite_changed = true if USE_IDLE_SPRITE == true
else
@sprite_changed = false if USE_IDLE_SPRITE == true
@game_character.change_sprite('reset')
end
$game_player.move_speed = WALK_MOVE_SPEED
#--------------------------------------------------------------------
# Handles Run Stance
#--------------------------------------------------------------------
if Input.press?(Input::A) and Input.dir8 == 1
$game_player.move_speed = RUN_MOVE_SPEED if $RUN_ACTIVE == true
@game_character.change_sprite(RUN1_SPRITE_SUFFIX) if @sprite_changed == false and USE_RUN1_SPRITE == true
@sprite_changed = true if USE_RUN1_SPRITE == true
elsif Input.press?(Input::A) and Input.dir8 == 3
$game_player.move_speed = RUN_MOVE_SPEED if $RUN_ACTIVE == true
@game_character.change_sprite(RUN1_SPRITE_SUFFIX) if @sprite_changed == false and USE_RUN1_SPRITE == true
@sprite_changed = true if USE_RUN1_SPRITE == true
elsif Input.press?(Input::A) and Input.dir8 == 4
$game_player.move_speed = RUN_MOVE_SPEED if $RUN_ACTIVE == true
@game_character.change_sprite(RUN_SPRITE_SUFFIX) if @sprite_changed == false and USE_RUN_SPRITE == true
@sprite_changed = true if USE_RUN_SPRITE == true
elsif Input.press?(Input::A) and Input.dir8 == 6
$game_player.move_speed = RUN_MOVE_SPEED if $RUN_ACTIVE == true
@game_character.change_sprite(RUN_SPRITE_SUFFIX) if @sprite_changed == false and USE_RUN_SPRITE == true
@sprite_changed = true if USE_RUN_SPRITE == true
elsif Input.press?(Input::A) and Input.dir8 == 7
$game_player.move_speed = RUN_MOVE_SPEED if $RUN_ACTIVE == true
@game_character.change_sprite(RUN0_SPRITE_SUFFIX) if @sprite_changed == false and USE_RUN0_SPRITE == true
@sprite_changed = true if USE_RUN0_SPRITE == true
elsif Input.press?(Input::A) and Input.dir8 == 9
$game_player.move_speed = RUN_MOVE_SPEED if $RUN_ACTIVE == true
@game_character.change_sprite(RUN0_SPRITE_SUFFIX) if @sprite_changed == false and USE_RUN0_SPRITE == true
@sprite_changed = true if USE_RUN0_SPRITE == true
else
@sprite_changed = false if USE_IDLE_SPRITE == true
@game_character.change_sprite('reset')
end
$game_player.move_speed = WALK_MOVE_SPEED

#--------------------------------------------------------------------
# Handles Diagonal Stance
#--------------------------------------------------------------------

if Input.dir8 == 1
# Sets Lower_Right Sprite Stance
@game_character.change_sprite(DIAG_SPRITE_SUFFIX) if @sprite_changed == false and USE_DIAG_SPRITE == true
@sprite_changed = true if USE_DIAG_SPRITE == true
elsif Input.dir8 == 3
# Sets Lower_Right Sprite Stance
@game_character.change_sprite(DIAG_SPRITE_SUFFIX) if @sprite_changed == false and USE_DIAG_SPRITE == true
@sprite_changed = true if USE_DIAG_SPRITE == true
elsif Input.dir8 == 7
# Sets Upper_Left Sprite Stance
@game_character.change_sprite(DIAG0_SPRITE_SUFFIX) if @sprite_changed == false and USE_DIAG0_SPRITE == true
@sprite_changed = true if USE_DIAG0_SPRITE == true
elsif Input.dir8 == 9
# Sets Upper_Right Sprite Stance
@game_character.change_sprite(DIAG0_SPRITE_SUFFIX) if @sprite_changed == false and USE_DIAG0_SPRITE == true
@sprite_changed = true if USE_DIAG0_SPRITE == true
end
syn_map_update
end
end
#---------------------------------------------------------------------------
# Game_Character
#---------------------------------------------------------------------------
class Game_Character
attr_accessor :character_name
attr_accessor :move_speed
def change_sprite(name)
if name == 'reset'
$game_player.character_name = @old_character_name
else
@old_character_name = $game_player.character_name
$game_player.character_name += name
end
end
end


This simple uses individual frames if the suffix files exists in character folder (Actor1_run0, Actor1_run1, Actor1_diag, Actor1_diag0) BUT messes the things up so why can i use the up / down space in charset to other animations? like add more frames to left movement instead use it in down / up or at less use it to run in diagonal / walk in diagonal . I need cut off the up/down frame movements and use it for other directions Can Someone Help Please???????????????

This post has been edited by HeLLRazor: Jan 26 2008, 04:38 AM
Go to the top of the page
 
+Quote Post
   
Koru-chan
post Jan 27 2008, 01:09 AM
Post #8


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Event Designer
RM Skill: Advanced




Okay, I have an issue. I have run/idle sprites in my character folder (all named Actor1_run.png, Actor2_run.png, etc). I copied the script above Main. But I get this error.

http://i172.photobucket.com/albums/w4/koru-sama/error.png

Why is this happening? It's an error with this script and Game_Character, obviously, on line 234. I'm not a programmer and know nothing of ruby, though.


__________________________



PM me if you want your own graph, please do NOT take and alter for your own.
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 27 2008, 01:56 AM
Post #9


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




@Koru-Chan: Thanks for reporting, I am working on a fix right now.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Koru-chan
post Jan 27 2008, 02:09 AM
Post #10


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Event Designer
RM Skill: Advanced




Found the issue I think. The issue is when the run/idle sprites are disabled. When I set them to false (I don't want different sprites for running/idle), it kept shutting down. Now that I set them to true again it isn't giving me that error.


__________________________



PM me if you want your own graph, please do NOT take and alter for your own.
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 27 2008, 04:55 AM
Post #11


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




QUOTE (Koru-chan @ Jan 27 2008, 02:16 AM) *
Found the issue I think. The issue is when the run/idle sprites are disabled. When I set them to false (I don't want different sprites for running/idle), it kept shutting down. Now that I set them to true again it isn't giving me that error.


The error happens when the script resets the sprite but there is no sprite to reset. Like, if the reset method is called before the @old_character_name variable could be set, then the script resets the character_name to the old_character_name. But since their is no old character to set since animations were turned OFF, the game errors. Bad scripting on my part, but I made this script before I had VX, so something like this is to be expected. I am working on version 2.0.0 that will work and will hopefully be released tomorrow.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Koru-chan
post Jan 27 2008, 09:12 AM
Post #12


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Event Designer
RM Skill: Advanced




That's fine, you had it described up front that this script was so far untested for VX. It's just a part of making a script from XP into a VX script. It works wonderfully considering that. Now that I set it right it works perfectly.

EDIT: Oh man you're going to hate me. I found another error. This happened after I went into the menu and exited the menu.



"File Graphics/Characters/People4_idle_idle cannot be found."

So now it's asking me for idles of my idle images. ^^()

This post has been edited by Koru-chan: Jan 27 2008, 11:15 AM


__________________________



PM me if you want your own graph, please do NOT take and alter for your own.
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 27 2008, 10:02 PM
Post #13


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




QUOTE (Koru-chan @ Jan 27 2008, 09:19 AM) *
That's fine, you had it described up front that this script was so far untested for VX. It's just a part of making a script from XP into a VX script. It works wonderfully considering that. Now that I set it right it works perfectly.

EDIT: Oh man you're going to hate me. I found another error. This happened after I went into the menu and exited the menu.



"File Graphics/Characters/People4_idle_idle cannot be found."

So now it's asking me for idles of my idle images. ^^()


I discovered that after I was looking at the previous error your posted. Unfortunately, I am going to be busy for most of the week, so I won't be able to make fixes until the weekend. The script has been taken down for the meantime.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 28 2008, 12:03 AM
Post #14


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Double Post. I didn't want to have to worry about it later, so I fixed up all of the know bugs plus added a few features. Refer to the first post.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Koru-chan
post Jan 28 2008, 04:21 PM
Post #15


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Event Designer
RM Skill: Advanced




Synthesis = <3!


__________________________



PM me if you want your own graph, please do NOT take and alter for your own.
Go to the top of the page
 
+Quote Post
   
Ty
post Jan 28 2008, 05:06 PM
Post #16


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




QUOTE (Koru-chan @ Jan 28 2008, 04:28 PM) *
Synthesis = <3!


I agree with that statement.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Ty
post Mar 1 2008, 06:49 PM
Post #17


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Script has been revised, should work smoother and faster now ^^


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Someonation
post Mar 2 2008, 04:32 AM
Post #18


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: None
RM Skill: Beginner




I can't download the demo......
i got into the site....but when i download it get into a site and the download won't open.....please help
Thanks in advance
Eyal
Go to the top of the page
 
+Quote Post
   
Ty
post Mar 2 2008, 05:03 AM
Post #19


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




You need javascript enabled, wait a few seconds, then the download link will appear


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
andani
post Mar 2 2008, 04:33 PM
Post #20


Level 4
Group Icon

Group: Member
Posts: 47
Type: Event Designer
RM Skill: Skilled




Pretty cool script you have there Synthesize, thanks for all your hard work


__________________________





My name's Andani. I am a very blunt person who says what they feel. I usually do not reveal my thoughts except when I feel obliged.

-Andani Yunatta Kappenluthe
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 11:10 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker