- Joined
- Oct 20, 2015
- Messages
- 2,824
- Reaction score
- 1,883
- First Language
- Spanish
- Primarily Uses
- RMVXA
I need to partially redefine Spriteset_Map from the default script to insert a custom call to a different function, while at the same time NOT interfering with a plugin that also redefines it.
here's how it is structured:
-Spriteset_Map
-Battle Plugin
-my plugin
Battle Plugin has it's own initialize block, as expected:
my plugin requires a new instruction to be injected in between the original ones, so I copied the original block as it was, effectively restoring it to it's original structure.
now, this overrides the battle spriteset's initialize, which needs to be run because:
which goes to:
and since it never runs:
Spriteset.cursor.x -> NoMethod

is there any way to "inject" the line I need, without modifying the structure too much, while still having the battle plugin run last?
like, can I override a top script with a bottom script while having another one in the middle not notice the difference?
here's how it is structured:
-Spriteset_Map
-Battle Plugin
-my plugin
Battle Plugin has it's own initialize block, as expected:
Code:
class Spriteset_Map
...
alias original_init initialize
def initialize(*args)
original_init(*args)
if $game_party.in_battle
<new instructions>
...
end
end
end
my plugin requires a new instruction to be injected in between the original ones, so I copied the original block as it was, effectively restoring it to it's original structure.
Code:
class Spriteset_Map
def initialize
create_viewports
create_tilemap
create_parallax
create_characters
create_shadow
create_weather
create_pictures
create_lighting if Lighting::ENABLE_LIGHTING #my edit, because, reasons.
create_timer
update(true)
end
...
...
end
now, this overrides the battle spriteset's initialize, which needs to be run because:
Code:
...
if $game_party.in_battle
...
create_cursor
...
end
...
which goes to:
Code:
def create_cursor
@cursor = Battle_Cursor.new
end
and since it never runs:
Spriteset.cursor.x -> NoMethod

is there any way to "inject" the line I need, without modifying the structure too much, while still having the battle plugin run last?
like, can I override a top script with a bottom script while having another one in the middle not notice the difference?
Last edited: