RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RMVX] Stand/Walk/Run

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 88
Script Name: Stand/Walk/Run
Written By: Synthesize
Current Version: V.2.00A
Release Date: January 26, 2008

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

DEMO:
Triton Server

Spoiler for The Script:
Code: [Select]
#===============================================================================
# Stand/Walk/Run Script --- RMVX Version
#===============================================================================
# Written by Synthesize
# Version 2.00
# January 26, 2008
#===============================================================================
#                       * This script is untested *
#===============================================================================
# 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
  # Save a character set in your Charset folder with the Character set file name + the suffix specified above.
  # As an example, Actor1.png will become Actor1_run.png when running and Actor1_idle.png for standing
  # You may use the same sets for different actors. The way that works, is the character set is changed to
  # the character sprite on the _run/_idle sprite set at the same location as it was on Actor1.png.
  # So for example you use all eight sprites from Actor1, then each of those playable characters will
  # use the same graphic set but each will use a different running/standing animation.
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
    $game_player.old_character_name = $game_player.character_name
    @wait_time = 0
    @wait_time2 = 0
    syn_map_start
  end
  #-----------------------------------------------------------------------------
  # Rewrite Scene_Change to reset sprite
  #-----------------------------------------------------------------------------
  def update_scene_change
    return if $game_player.moving?
    case $game_temp.next_scene
    when "battle"
      call_idle($game_player.old_character_name, false)
      call_battle
    when "shop"
      call_idle($game_player.old_character_name, false)
      call_shop
    when "name"
      call_idle($game_player.old_character_name, false)
      call_name
    when "menu"
      call_idle($game_player.old_character_name, false)
      call_menu
    when "save"
      call_idle($game_player.old_character_name, false)
      call_save
    when "debug"
      call_idle($game_player.old_character_name, false)
      call_debug
    when "gameover"
      call_gameover
    when "title"
      call_title
    else
      $game_temp.next_scene = nil
    end
  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
    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, 0)
  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
  alias syn_temp_init initialize
  def initialize
    @syn_state = ""
    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?
      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
      changed = false
      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
#===============================================================================

Questions? Concerns? Post.
« Last Edit: January 28, 2008, 09:15:06 PM by Synthesize »

**
Rep:
Level 88
Fixed all of the known bugs and added some features. The script should actually work now =D

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
:P

It might be a good idea to write out how the additional animations are saved. Do you save the animation files as <filename> + idle, run? Combine them all into one file? Maybe it's there and I'm just blind though  :D

EDIT::

I just noticed that is set by the user by the idle and run_sprite_suffix constants in the module. I still think it should be made more explicit however.
« Last Edit: January 28, 2008, 03:37:21 PM by modern algebra »

**
Rep:
Level 86
Hell Blade © 2008, All Rights Reserved
Nice script.  ;D







***
Rep:
Level 86
So doas this Script make it so you  can run or walk like in Final Fantasy 7?

*
Rep: +0/-0Level 85
So doas this Script make it so you  can run or walk like in Final Fantasy 7?
You can run by holding shift with RPG Maker VX, by default. (unless you click 'disable dashing' in the map properties of that map)

**
Rep:
Level 84
Hey there. I got a question! I was wondering wouldnt it be better to add support of this script to the catterpillar script?
like when you dash, the other characters following you will have the same effect. The same with the idle. i always wanted that!