How do you call a specific method in a class that has been aliased?

I was wondering how I can manually reinitialize a class within a script. I am trying to call a part of Khas sapphire engine to reinitialize because the normal means of how it works is never used. Pretty much, this class is used to change the graphic of weapon when it is equipped. (and going through the equip menu reinitialize it, unfortunately for me, all my equipping is done through script calls so the weapon graphic does not update).

So, in the script fragment below, how can I rerun initialize or refresh_weapon from a script call.

Code:
...class Spriteset_Map  alias sas_update update  alias sas_initialize initialize  alias sas_dispose dispose  def initialize    @trash = []    $game_map.show_particles    $game_map.show_damage_sprites    $game_map.sas_hud.show    sas_initialize    @weapon_graphic = Sprite.new(@viewport1)    @weapon_graphic.ox = 22    @weapon_graphic.oy = 22    @attacking = false    @attack_timer = 0    @angles = {2=>[80,110,140,170],4=>[340,10,40,70],6=>[290,260,230,200],8=>[290,320,350,20]}    @correction = {2=>[-8,-10],4=>[0,-10],6=>[0,-4],8=>[4,-10]}    @z_values = {2=>120,4=>50,6=>120,8=>50}    refresh_weapon  end    def refresh_weapon    @weapon_bitmap.dispose unless @weapon_bitmap.nil?    @weapon_bitmap = nil    return if $game_party.members.empty?    index = ($game_party.members[0].weapons[0].icon_index rescue nil)    unless index == nil      temp = Cache.system("Iconset")      @weapon_bitmap = Bitmap.new(24,24)      @weapon_bitmap.blt(0,0,temp,Rect.new(index%16*24,index/16*24,24,24))      temp.dispose      temp = nil    end  end...end
I suspect I understood your question wrong, but:


Spriteset_Map is initialized when the map Scene is first loaded...


Your best bet would be to either:


1) Change something on Scene_Map to destroy and recreate the spriteset (methods dispose_spriteset and create_spriteset). You will need to be careful where you call this from.


2) Change scene to another Scene_Map.
I suspect I understood your question wrong, but:

Spriteset_Map is initialized when the map Scene is first loaded...

Your best bet would be to either:

1) Change something on Scene_Map to destroy and recreate the spriteset (methods dispose_spriteset and create_spriteset). You will need to be careful where you call this from.

2) Change scene to another Scene_Map.
You pretty much understand the issue. 😛

1) Crashes no matter where I call it lol.

2) Doesn't seem to run the class

Whenever you open a menu (and in my case, the only menu accessible is the save) it will refresh and change the graphic to what it should be. So maybe creating an empty Scene that closes itself when called? (wonder if that is even possible).
Well, you only need to refresh the graphic? In that case you shouldn't be reinitializing the whole spriteset. That's what I meant with "understood wrong".

Edit:

It's the weapon graphic that you need to refresh?

Add this on the script list:

Code:
class Scene_Map < Scene_Base  attr_reader :spritesetend
and call this:

Code:
SceneManager.scene.spriteset.refresh_weapon if SceneManager.scene.is_a? Scene_Map
That did the trick ^^

2 hours of me messing with the script for it to be fixed with 3 lines of code xD

Thank you for helping me out with that. I was about to go mad. ^^

Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-call-a-specific-method-in-a-class-that-has-been-aliased.43979/