Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

need a couple of edits on a running script

Status
Not open for further replies.
I have this script, that allows the player to run when holding "C" or "Enter".
Now I need the following add-ons.
1.To make it possible, so the script is only active until certain switch (any, as long as I can edit the switch #) is on.
2.To change the character graphic while running so I can use the running character graphics so he actually looks like he's running.
3.Now this may be the hardest part, but it's the last thing I need. Since my hero is going to have a graphic change (after he wears an armor), I need it so after certain switch is on the graphic change is different. This is so when my hero runs AFTER getting the armor his running graphic won't be the unarmored one.

here's the script!

Code:
#==============================================================================
# Game_Player Dash by necrofear
#==============================================================================
class Game_Player
  alias xrxs25_update update
  def update
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      if Input.press?(Input::C)
        @move_speed = 5
      else
        @move_speed = 4
      end
    end
    xrxs25_update
  end
end
 
Use this for the 1 and 2 request:
Code:
class Game_Player
  def initialize
    @not_running_character_name = ""
  end
  alias xrxs25_update update
  def update
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      if Input.press?(Input::C) and $game_switches[1] # Change the 1 for the switch number you want for active/desactive running
        @move_speed = 5
        @not_running_character_name = @character_name
        @character_name = "" # Put here the name of your hero runnig graphic
      else
        @move_speed = 4
        @character_name = @not_running_character_name
      end
    end
    xrxs25_update
  end
end
For the request number 3, I think you can use: Visual Equipment
 

OS

Sponsor

place alias new_init initialize over def initialize, then on the line just before @not_running_character_name = '' place new_init. This should fix your problem. Peace!
 
Sorry, I was very tired when I did this, I think it should work now:
Code:
class Game_Player
  alias game_player_initialize initialize
  def initialize
    game_player_initialize
    @not_running_character_name = ""
    @running_character_name = "" # Put here the name of your hero runnig graphic
  end
  alias xrxs25_update update
  def update
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      if Input.press?(Input::C) and $game_switches[1] # Change the 1 for the switch number you want for active/desactive running
        @move_speed = 5
        @not_running_character_name = @character_name if @character_name != @running_character_name
        @character_name = @running_character_name
      else
        @move_speed = 4
        @character_name = @not_running_character_name
      end
    end
    xrxs25_update
  end
end
 
There is no need to alias initialize. Game_Player does not have it, but Game_Character does. Just call super from the Game_Player like this:
Code:
class Game_Player < Game_Character
  def initialize
    super
    @not_running_character_name = ""
    @running_character_name = "" # Put here the name of your hero runnig graphic
  end
end

super calls The superclass's method of the same name, in this case initialize. OOP in action.
 
i know almost nothing about scripting but the "super" method didn't work. vgvgf's did tho, so it's all cool now. thx everyone


EDIT: actually, no, it isn't all cool now.
is there anyway to be turning on and off the entire script as well? because it's kind of disabling the change hero sprite function...
 
hey guys I solved my problem. so in case ur working on it or something, you may want to stop ^^;
here's what I did...
Code:
class Game_Player
  alias game_player_initialize initialize
  def initialize
  game_player_initialize
  @not_running_character_name = "tori_gaku_05.png"
  @lol_not_running_character_name = "016-Thief01.png"
  @running_character_name = "01.png" 
  @lol_running_character_name = "02.png"  
    end
  alias xrxs25_update update
  def update
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
           if Input.press?(Input::C) and $game_switches[6]
              @move_speed = 5
              if $game_switches[7]
                 @lol_not_running_character_name = @character_name if @character_name != @lol_running_character_name
                 @character_name = @lol_running_character_name
              else
                 @not_running_character_name = @character_name if @character_name != @running_character_name
                 @character_name = @running_character_name
              end
           else
                 @move_speed = 4
            if $game_switches[7]
               @character_name = @lol_not_running_character_name
            else
               @character_name = @not_running_character_name
            end
           end
    end
    xrxs25_update
  end
  end
basically with @lol_running_character and @lol_not_running_character as well as a switch check, I did what I wanted as my number 3 request. I know nothing of scripting language and I edit scripts based on logic more or less, not really understand how it works xD.

i can keep adding @lol_lol_running_character, etc. for more costumes and stuff like that.

thanks a lot everyone! problem now really solved.

sry 4 double post, had to do it in case some1 was workin on this so he could see the update i did
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top