08-31-2018, 04:20 AM
(This post was last modified: 08-31-2018, 04:21 AM by DerVVulfman.)
Okay, I got something for you.
The Scene_Menu script is your basic main menu. But it doesn't draw your characters.... It is handled by the Windows_ codes. Or more specifically right now the Window_MenuStatus class. But the Window_MenuStatus class doesn't hold the actual code that draws your character. It's the Window_Base class.
Window_Base is the 'base' class that holds a lot of resuable code that other Windows_ classes can access. And of that code, the one you would be looking at is the draw_actor_graphic method starting at line 108. We call the groups of code within a class as a 'method'. Another way of saying a function or subroutine as they're known in other programming languages.
The default draw_actor_graphic method looks like this:
Now assuming you are using the old Game_Variables, you can use code like this. Bare in mind, the below code takes the current actor's Charactername and includes the value of the game variable itself... IE: If aluxes's character is 001-Fighter01 ... and the value of Game_Variable 1 is 0, the system will look for 001-Fighter010. And if his character is 001-Fighter01 and the value in Game Variable 1 is 23, then it would look for 001-Fighter0123.
Now if you want to keep the default draw_actor_graphic method untouched, you could just add a new method, just so long as it is within Window_Base.
The Scene_Menu script is your basic main menu. But it doesn't draw your characters.... It is handled by the Windows_ codes. Or more specifically right now the Window_MenuStatus class. But the Window_MenuStatus class doesn't hold the actual code that draws your character. It's the Window_Base class.
Window_Base is the 'base' class that holds a lot of resuable code that other Windows_ classes can access. And of that code, the one you would be looking at is the draw_actor_graphic method starting at line 108. We call the groups of code within a class as a 'method'. Another way of saying a function or subroutine as they're known in other programming languages.
The default draw_actor_graphic method looks like this:
Code:
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
Now assuming you are using the old Game_Variables, you can use code like this. Bare in mind, the below code takes the current actor's Charactername and includes the value of the game variable itself... IE: If aluxes's character is 001-Fighter01 ... and the value of Game_Variable 1 is 0, the system will look for 001-Fighter010. And if his character is 001-Fighter01 and the value in Game Variable 1 is 23, then it would look for 001-Fighter0123.
Code:
def draw_actor_graphic(actor, x, y)
# get a value from the Game_Variable matching your hero
pic = $game_variables[actor.id]
# Take the actor's graphic and include the value from the variable
charname = actor.character_name + pic.to_s
# Draw it with the new character name with the suffix
bitmap = RPG::Cache.character(charname, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
Now if you want to keep the default draw_actor_graphic method untouched, you could just add a new method, just so long as it is within Window_Base.