Hi, I was wondering if it's possible to give this run script a sound when your at 50% and another sound when you deplete your stamina to warn people how much stamina you have left without having any hud as this script doesn't have anything showing how much stamina you got left.
#===============================================================================
# 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 = false # Use a Running sprite?
Run_speed = 4 # Player speed while running
Walk_speed = 3 # Player speed while walking
Run_sprite_suffix = '_run' # Running Sprite Suffix
Run_points = 300 # The maximum amount of Run Points
Run_points_restore = 1 # 1 Run Point is restored in X Frames
Restore_run_while_walking = false # Restore points while walking?
Use_idle_sprite = false # Use Idle Sprite?
Idle_sprite_suffix = '_idle' # idle Sprite Suffix
Use_anime = true # Animate your Idle Sprite?
Idle_time = 40 # 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
alias syn_player_refresh refresh
alias syn_player_move_type_custom move_type_custom
def dash?
return false if @run_points == 0 and StandWalkRun::Use_run
return true if Input.press?(Input::A)
end
def refresh
syn_player_refresh
self.old_character_name = @character_name
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
#--------------------------------------------------------------------------
# * Move Type : Custom
#--------------------------------------------------------------------------
def move_type_custom
old_ch_name = @character_name
syn_player_move_type_custom
if old_ch_name != @character_name # Change Graphic
self.old_character_name = @character_name
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 - RMXP Version
#===============================================================================
Also I was wondering in what line can I edit the amount of stamina you regen as currently it regens 1 stamina per x frames but since i made it regen only when standing still 1 stamina per x frames can be a tad long if you have say 300 stamina.
Thanks
tell me if this works like you want
#===============================================================================
# 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 = false # Use a Running sprite?
Run_speed = 4 # Player speed while running
Walk_speed = 3 # Player speed while walking
Run_sprite_suffix = '_run' # Running Sprite Suffix
Run_points = 300 # The maximum amount of Run Points
Run_restore_points = 1 # The amount of points received at Run_points_restore frames
Run_points_restore = 1 # Run_restore_points is restored in X Frames
Restore_run_while_walking = false # Restore points while walking?
Use_idle_sprite = false # Use Idle Sprite?
Idle_sprite_suffix = '_idle' # idle Sprite Suffix
Use_anime = true # Animate your Idle Sprite?
Idle_time = 40 # Time before sprite is animated
def self.sound(percent)
case percent
#when 100 then RPG::AudioFile.new(name, volume, pitch)
else
return nil
end
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 += StandWalkRun::Run_restore_points 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
alias syn_player_refresh refresh
alias syn_player_move_type_custom move_type_custom
def dash?
return false if @run_points == 0 and StandWalkRun::Use_run
return true if Input.press?(Input::A)
end
def refresh
syn_player_refresh
self.old_character_name = @character_name
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
se = StandWalkRun.sound(StandWalkRun::Run_points/@run_points)
$game_system.se_play(se) if se != nil
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
#--------------------------------------------------------------------------
# * Move Type : Custom
#--------------------------------------------------------------------------
def move_type_custom
old_ch_name = @character_name
syn_player_move_type_custom
if old_ch_name != @character_name # Change Graphic
self.old_character_name = @character_name
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 - RMXP Version
#===============================================================================
When I put:
def self.sound(percent)
case percent
#when 100 then RPG::AudioFile.new(name, volume, pitch)
when 50 then RPG::AudioFile.new('Breathing', 90, 0)
else
when 0 then RPG::AudioFile.new('Heavy Breathing', 100, 0)
else
return nil
end
end
I get a syntax error on the 2nd when so I had to try with when 50 only. I had to add another end at the end of the script and afterwards when I play tested I got this error:
Line 42: Name Error occurred.
undefined method 'update' for class 'StandWalkRun::Scene_Map'
Also I forgot to mention the sounds are in the SE folder.
Thanks for the help :)
Quote
def self.sound(percent)
case percent
#when 100 then RPG::AudioFile.new(name, volume, pitch)
when 50 then RPG::AudioFile.new('Breathing', 90, 0)
else
when 0 then RPG::AudioFile.new('Heavy Breathing', 100, 0)
else
return nil
end
end
Edited that part to this:
def self.sound(percent)
case percent
#when 100 then RPG::AudioFile.new(name, volume, pitch)
when 50
return RPG::AudioFile.new('Breathing', 90, 0)
when 0
return RPG::AudioFile.new('Heavy Breathing', 100, 0)
end
return nil
end
end
Made it work but then I got a different error on this line:
se = StandWalkRun.sound(StandWalkRun::Run_points/@run_points)
Error:
ZeroDivisionError occurred.
divided by 0.
(Same error happen with your version)
I only managed to make it "work" once, it was kinda nice tough for some reason before the sound started the game froze for a second and when I had enough stamina again the sound instantly stopped instead of slowly fading unless this was intentional.
Ps. I was wondering if the sound plays only when it reaches 50% and stops or it's 50% or less? I should have been more specific in my first post as I want the latter >_<
try it now i did the percentage calculation wrong and forgot the returns
#===============================================================================
# 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 = false # Use a Running sprite?
Run_speed = 4 # Player speed while running
Walk_speed = 3 # Player speed while walking
Run_sprite_suffix = '_run' # Running Sprite Suffix
Run_points = 300 # The maximum amount of Run Points
Run_restore_points = 1 # The amount of points recieived at Run_points_restore frames
Run_points_restore = 1 # 1 Run Point is restored in X Frames
Restore_run_while_walking = false # Restore points while walking?
Use_idle_sprite = false # Use Idle Sprite?
Idle_sprite_suffix = '_idle' # idle Sprite Suffix
Use_anime = true # Animate your Idle Sprite?
Idle_time = 40 # Time before sprite is animated
def self.sound(percent)
case percent
#when 100 then return RPG::AudioFile.new(name, volume, pitch)
else
return nil
end
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 += StandWalkRun::Run_restore_points 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
alias syn_player_refresh refresh
alias syn_player_move_type_custom move_type_custom
def dash?
return false if @run_points == 0 and StandWalkRun::Use_run
return true if Input.press?(Input::A)
end
def refresh
syn_player_refresh
self.old_character_name = @character_name
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
rate = (StandWalkRun::Run_points > 0 ? @run_points.to_f / StandWalkRun::Run_points : 0)
se = StandWalkRun.sound(rate*100)
$game_system.se_play(se) if se != nil
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
#--------------------------------------------------------------------------
# * Move Type : Custom
#--------------------------------------------------------------------------
def move_type_custom
old_ch_name = @character_name
syn_player_move_type_custom
if old_ch_name != @character_name # Change Graphic
self.old_character_name = @character_name
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 - RMXP Version
#===============================================================================
Hm.. now the character's stamina never ends so no chance on testing the sounds when it's 50% and 0 :/
no wounder i apparently removed the line that subtracted the stanima
#===============================================================================
# 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 = false # Use a Running sprite?
Run_speed = 4 # Player speed while running
Walk_speed = 3 # Player speed while walking
Run_sprite_suffix = '_run' # Running Sprite Suffix
Run_points = 300 # The maximum amount of Run Points
Run_restore_points = 1 # The amount of points recieived at Run_points_restore frames
Run_points_restore = 1 # 1 Run Point is restored in X Frames
Restore_run_while_walking = false # Restore points while walking?
Use_idle_sprite = false # Use Idle Sprite?
Idle_sprite_suffix = '_idle' # idle Sprite Suffix
Use_anime = true # Animate your Idle Sprite?
Idle_time = 40 # Time before sprite is animated
def self.sound(percent)
case percent
#when 100 then return RPG::AudioFile.new(name, volume, pitch)
else
return nil
end
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 += StandWalkRun::Run_restore_points 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
alias syn_player_refresh refresh
alias syn_player_move_type_custom move_type_custom
def dash?
return false if @run_points == 0 and StandWalkRun::Use_run
return true if Input.press?(Input::A)
end
def refresh
syn_player_refresh
self.old_character_name = @character_name
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
rate = (StandWalkRun::Run_points > 0 ? @run_points.to_f / StandWalkRun::Run_points : 0)
se = StandWalkRun.sound(rate*100)
$game_system.se_play(se) if se != nil
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
#--------------------------------------------------------------------------
# * Move Type : Custom
#--------------------------------------------------------------------------
def move_type_custom
old_ch_name = @character_name
syn_player_move_type_custom
if old_ch_name != @character_name # Change Graphic
self.old_character_name = @character_name
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 - RMXP Version
#===============================================================================
It works, thanks :)
Say would it be hard to make the sound loop until you stop to get some stamina?
Also I'm not entirely sure about this but say you deplete all your stamina and the heavy breathing sound plays, I rest a little and instead of the breath sound playing no sound happens. Is the when 50 meaning when the stamina is at 50% or when it's 50% or less? that might solve it on doing this thing I think.
Sorry that I'm nit picking if it's too time consuming leave it like this.
Thanks again +1
Would it take too much work to make the sound continue instead of playing once? (Maybe moving it from SE folder to some other folder)
Also what about depleting your stamina, heavy breath starts, you rest a little and instead of breathing sound playing nothing plays? Is it because the when 50% checks exactly if it's at 50%? or something else?
Thanks
def self.sound(percent)
case percent
#when 100 then RPG::AudioFile.new(name, volume, pitch)
when 11..50
return RPG::AudioFile.new('Breathing', 90, 0)
when 0..10
return RPG::AudioFile.new('Heavy Breathing', 100, 0)
end
return nil
end
end
Not sure if it works but whenever I try to run and stamina reaches the value to start the sound the sound keeps on playing over and over even though the sound just started and hasn't end yet.
If you keep on holding shift to run the fps goes down to 5-10 until you hold the shift button.