Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Stand/Walk/Run (Disabling Idle)
#1
Wondering if any of you guys would know how to use the CALL SCRIPT command to turn the idle graphic to FALSE in an event.
Not sure how I would format the code... it must be possible to disable it and then enable it once a cut-scene is over.
Code:
#===============================================================================
# Stand/Walk/Run Script --- RMXP 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_speed = 5   # Player speed while running
  Walk_speed = 4  # Player speed while walking
  Run_sprite_suffix = '_run'   # Running Sprite Suffix
  Run_points = 100   # The maximum amount of Run Points
  Run_points_restore = 20   # 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
  # Aliases
  alias syn_map_update update
  #-----------------------------------------------------------------------------
  # Initiate variables
  #-----------------------------------------------------------------------------
  def initialize
    if $game_player.old_character_name == nil
    $game_player.old_character_name = $game_player.character_name
    end
    @wait_time = 0
    @wait_time2 = 0
  end
  #-----------------------------------------------------------------------------
  # Update:: Update the scene
  #-----------------------------------------------------------------------------
  def update
    syn_map_update
    if Input.dir4 == 0
      wait(1, false) if StandWalkRun::Use_idle_sprite
      if $game_player.move_route_forcing == false
        call_idle($game_player.character_name + StandWalkRun::Idle_sprite_suffix, StandWalkRun::Use_anime) if @wait_time == StandWalkRun::Idle_time
        $game_temp.syn_state = "idle"
      end
      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)
  end
  #-----------------------------------------------------------------------------
  # Restore_Run: Restore Run Points
  #-----------------------------------------------------------------------------
  def restore_run
    if $game_player.run_points < $game_player.max_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
  attr_accessor :max_run_points
  alias syn_ch_init initialize
  #-----------------------------------------------------------------------------
  # Initialize Variables
  #-----------------------------------------------------------------------------
  def initialize
    @run_points = StandWalkRun::Run_points
    @max_run_points = @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
  def dash?
    return false if @run_points == 0 and StandWalkRun::Use_run
    return true if Input.press?(Input::A)
  end
  #-----------------------------------------------------------------------------
  # Update:: Update the scene
  #----------------------------------------------------------------------------
  def update
    if dash?
      if Input.dir4 == 0
        $game_player.set_graphic($game_player.old_character_name)
      end
      unless $game_temp.syn_state == "idle"
        set_graphic(@character_name + StandWalkRun::Run_sprite_suffix) if StandWalkRun::Use_run_sprite
        @move_speed = StandWalkRun::Run_speed
        @run_points -= 1
        syn_player_update
      end
    else
      @move_speed = StandWalkRun::Walk_speed
      syn_player_update
    end
  end
  def set_graphic(character_name)
    @tile_id = 0
    @character_name = character_name
  end
end
#-------------------------------------------------------------------------------
#            * This script is not compatible with RPG Maker XP *
#-------------------------------------------------------------------------------
# Written by Synthesize
# Version 2.00
# Requested by Cerulean Sky
#===============================================================================
# Stand/Walk/Run   - RMXP Version
#===============================================================================

Reply }
#2
used call script and put this : Use_idle_sprite = false
if you want an idle movement after you call script : Use_idle_sprite = true
I think ....
Reply }
#3
(05-15-2013, 02:29 AM)daylights Wrote: used call script and put this : Use_idle_sprite = false
if you want an idle movement after you call script : Use_idle_sprite = true
I think ....
I tried this earlier, it did not work, it needs to be a more specific line

Reply }
#4
Errr... not exactly inserting this into a project. Gonna just take a guess. But, I did take a look.

You cannot use the 'Use_idle_sprite' or any other value in the StandWalkRun module. Those are the configurables and are fixed. So, you have to look at it in another way.

Fortunately, he did code a little thing for you. He created the 'set_step_anime' method in Game_Character, which is likely able to be referenced by calling a game event. So try this:

$game_map.events[1].set_step_anime(false) The 1 designates event_ID 1

If it freezes, use 'nil' instead of false in the parenthesis. It's a bug with the Interpreter class... unless you have the easy fix. That's a different topic.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }
#5
Close but no dice!

Reply }
#6
I've been practicing RGSS like crayfish recently, when revisiting this I figured it out instantly.
It's as simple as Call Script "StandWalkRun::Use_anime = false" StandWalkRun is the actual name reference of the script.
Woot zombie posting, just thought I'd share with whoever wanted to use this in their game.

Reply }




Users browsing this thread: