The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: &&&&&&&&&&&&& on April 12, 2013, 05:58:51 AM

Title: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 12, 2013, 05:58:51 AM
(Rpg Maker VX ace)

As I was working on my game, I noticed that, on the world map, the characters dwarfed the buildings. I didn't like how this looked, so I made smaller version of all the sprites.

I was wondering if they was a script that would change the character's sprite when I went to the world map.

Currently I am just manually changing each character's sprite... later into development, I see this becoming really annoying, as I have to change them when exiting a city and then back when entering one. That means every time I created a new character, I'll have to go back to every town/city and add in the new character to the shrinking/growing process... blarg.

tl;dr:bbq
can i mak i so's teh character chaing sprit when they go 2 teh wurld map/?
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: TDS on April 12, 2013, 07:22:20 AM
I'll give a try.

I just need to know if you are you using any naming conventions for the character graphics, like "hero_name" for normal and "hero_name_MINI" for the smaller version or some other type of naming convention.
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: pacdiggity on April 12, 2013, 07:33:33 AM
If I recall correctly, which is unlikely, there should be a way to do this without actually changing files at all; defining the appropriate map ID(s) and altering the way that actor sprites are drawn (I'm sure there's a way to do this, I don't have any RM with me right now though) according to said ID(s). I know I've seen this done before.
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 12, 2013, 10:13:09 AM
Quote from: TDS on April 12, 2013, 07:22:20 AM
I'll give a try.

I just need to know if you are you using any naming conventions for the character graphics, like "hero_name" for normal and "hero_name_MINI" for the smaller version or some other type of naming convention.

Each character has their own charsheet.
Like this ~
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi109.photobucket.com%2Falbums%2Fn52%2Fdreamslayer7%2FCharsheetHaya_zps48bd77db.png&hash=169bdca6b970b0e0a65d97ba8fc837302302ca25) (http://s109.photobucket.com/user/dreamslayer7/media/CharsheetHaya_zps48bd77db.png.html)

I have both default and tiny on the same one.
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: TDS on April 13, 2013, 12:22:04 AM
I see.

If they all follow the same format then something like this should do it.


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_player_map_graphic_change_game_actor_character_index character_index
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def character_index(*args, &block)
    # If Map uses mini characters
    return @character_index + 1 if $game_map.use_mini_character?
    # Run Original Method
    tds_player_map_graphic_change_game_actor_character_index(*args, &block)
  end
end


#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_mini_character_map_graphic_game_map_setup                    setup
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :mini_character_map                   # Mini Character Map Flag
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup(*args, &block)
    # Run Original Method
    tds_mini_character_map_graphic_game_map_setup(*args, &block)
    # Set Mini Character Map Flag
    @mini_character_map = (@map.note =~ /<Player_MINI>/i ? true : false)
  end
  #--------------------------------------------------------------------------
  # * Determine if Mini Character should be used
  #--------------------------------------------------------------------------
  def use_mini_character?
    return @mini_character_map if !@mini_character_map.nil?
    return false
  end
end


Any map that has "<Player_MINI>" on it's note box will automatically use the next index for the character.

Let me know if it works for you and if you want anything added/remove changed.

Have a nice day.
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 13, 2013, 12:43:55 AM
Hmmm, I think I'm doing something wrong here...

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi109.photobucket.com%2Falbums%2Fn52%2Fdreamslayer7%2Fthisisweird_zps09479bda.png&hash=3bebd83f4f15ef82ad5a527b65b307c6df2c4750) (http://s109.photobucket.com/user/dreamslayer7/media/thisisweird_zps09479bda.png.html)

I was going to say "It's not working", but then I went to save, and...

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi109.photobucket.com%2Falbums%2Fn52%2Fdreamslayer7%2Fthisisweird2_zps93357438.png&hash=b0e77e2e069cd9f12b8e1c4f0dfc16f738d07491) (http://s109.photobucket.com/user/dreamslayer7/media/thisisweird2_zps93357438.png.html)


For some reason it's only changing it in the little party snapshot in the save menu.
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: TDS on April 13, 2013, 01:17:18 AM
Is this happening when you load a game and save or when you hit new game?
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 13, 2013, 03:05:41 AM
Both.
It seems to be "working", when I have the "<Player_MINI>" on a map, when I save it shows them tiny. I don't know why it isn't effecting the actual character sprites, and only doing it to the save sprites...

http://youtu.be/5fYBTvtCqjY
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: TDS on April 13, 2013, 03:32:29 AM
Are you using any other scripts and if so if this one at the bottom of all of them?

This should fix the save menu problem.


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_player_map_graphic_change_game_actor_character_index character_index
  #--------------------------------------------------------------------------
  # * Character Index
  #--------------------------------------------------------------------------
  def character_index(*args, &block)
    # If Map uses mini characters
    return @character_index + 1 if $game_map.use_mini_character?
    # Run Original Method
    tds_player_map_graphic_change_game_actor_character_index(*args, &block)
  end
end


#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_mini_character_map_graphic_game_map_setup                    setup
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :mini_character_map                   # Mini Character Map Flag
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup(*args, &block)
    # Run Original Method
    tds_mini_character_map_graphic_game_map_setup(*args, &block)
    # Set Mini Character Map Flag
    @mini_character_map = (@map.note =~ /<Player_MINI>/i ? true : false)
  end
  #--------------------------------------------------------------------------
  # * Determine if Mini Character should be used
  #--------------------------------------------------------------------------
  def use_mini_character?
    return false if !SceneManager.scene_is?(Scene_Map)
    return @mini_character_map if !@mini_character_map.nil?
    return false
  end
end
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 13, 2013, 04:14:51 AM
I have it above all the other scripts. I have 2 scripts, and they change the menu.

I tried creating a completely new game, and it didn't work in it either.
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: TDS on April 13, 2013, 04:37:36 AM
It's supposed to be below all other scripts, as close to the "main process" script as possible.

And are you sure you put the text in the map properties note box?

Like this

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FnEfE2WB.png&hash=481f44205c6b5aebce4f170f9fc69cebfaf1d093)

Because I just tested it with the image you provided and it works just fine.

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FCmD19Ak.png&hash=5f904560cac13cada19a42de1828d1fe5aa7b6b1)
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 13, 2013, 05:10:53 AM
Quote from: TDS on April 13, 2013, 04:37:36 AM
It's supposed to be below all other scripts, as close to the "main process" script as possible.

Sorry, mistype. I have it below all other scripts. Don't know why I said above.


Quote from: TDS on April 13, 2013, 04:37:36 AM
It's supposed to be below all other scripts, as close to the "main process" script as possible.

And are you sure you put the text in the map properties note box?

Like this

[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FnEfE2WB.png&hash=481f44205c6b5aebce4f170f9fc69cebfaf1d093)[spoiler]

Because I just tested it with the image you provided and it works just fine.

[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FCmD19Ak.png&hash=5f904560cac13cada19a42de1828d1fe5aa7b6b1)[/spoiler]

I really don't know what I'm doing wrong. I'm very skilled at screwing things up, but I don't see how I'm screwing this up...

[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi109.photobucket.com%2Falbums%2Fn52%2Fdreamslayer7%2Fpngdotpng2_zps5955e248.png&hash=8d8736c56ae312509d389ac5e04d160c3ceacfda) (http://s109.photobucket.com/user/dreamslayer7/media/pngdotpng2_zps5955e248.png.html)[/spoiler]

[spoiler](https://rmrk.net/proxy.php?request=http%3A%2F%2Fi109.photobucket.com%2Falbums%2Fn52%2Fdreamslayer7%2Fpngdotpng_zps95463598.png&hash=f97d9ebfb4c66b7d94f9c61970f883a7795d36fc) (http://s109.photobucket.com/user/dreamslayer7/media/pngdotpng_zps95463598.png.html)[/spoiler]
Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: TDS on April 13, 2013, 05:51:15 AM
I think I know what is causing the problem.

Try this version and let me know if it works.


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_player_map_graphic_change_game_actor_character_index character_index
  #--------------------------------------------------------------------------
  # * Character Index
  #--------------------------------------------------------------------------
  def character_index(*args, &block)
    # If Map uses mini characters
    return @character_index + 1 if $game_map.use_mini_character?
    # Run Original Method
    tds_player_map_graphic_change_game_actor_character_index(*args, &block)
  end
end


#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Alias Listing
  #-------------------------------------------------------------------------- 
  alias tds_mini_character_map_graphic_game_map_setup                    setup
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :mini_character_map                   # Mini Character Map Flag
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  def setup(*args, &block)
    # Run Original Method
    tds_mini_character_map_graphic_game_map_setup(*args, &block)
    # Set Mini Character Map Flag
    @mini_character_map =  (@map.note =~ /<Player_MINI>/i).nil? ? false : true
    # Refresh Game Player
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # * Determine if Mini Character should be used
  #--------------------------------------------------------------------------
  def use_mini_character?
    return false if !(SceneManager.scene_is?(Scene_Map) or SceneManager.scene_is?(Scene_Title))
    return @mini_character_map if !@mini_character_map.nil?
    return false
  end
end

Title: Re: RMVXA (Script Request) Character sprite on world map
Post by: &&&&&&&&&&&&& on April 13, 2013, 06:03:01 AM
Thank you so much. ^_^

I don't know what y'all did, but it works perfectly.

Thanks for sticking with me.