Minor script conflict between Napoleon's Minimap and Galv's Character Effects

Status
Not open for further replies.

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Basically there's this bug where, if the mirror effect in Galv's Chracter Effects is active, the character sprite on Napoleon's Minimap will still move in the correct position but will sort of be moonwalking backwards. I was wondering if anyone could kindly provide a fix for this? Thanks!

Napoleon Mini Map:

https://forums.rpgmakerweb.com/index.php?threads/napoleons-minimap.13801/

Galv's Character Effects:

https://www.rpgmakercentral.com/topic/12803-character-effects/

EDIT: I think it has something to do with this in Napeleon's Mini Map:

Code:
def update_player_cursor
    player_character = $game_player.sprite
    return if !player_character || player_character.disposed?
   
    @player_sprite.bitmap.clear
    @player_sprite.bitmap.stretch_blt(Rect.new(0,0,@player_sprite.bitmap.width, @player_sprite.bitmap.height),
                                      player_character.bitmap,
                                      player_character.src_rect,
                                      255)
  end
The player_character.src_rect is probably the culprit due to influence here in Galv's

Code:
def update_src_rect
    if @character.reflect_sprite
      index = @character.reflect_sprite[1]
    else
      index = @character.character_index
    end
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw
    sy = (index / 4 * 4 + (10 - @character.direction - 2) / 2) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
I'm just not sure how to fix it. ^^;

EDIT 2: OK, I managed to create a fix, so I'll request for this thread to be closed.
 
Last edited:

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
@KingHazeel Are you willing to share the fix you made? It may help someone else out in the future.
Well...it's less of an added patch and more of a change to the script itself. And I wasn't sure if posting the script itself was allowed. If it is, then I can share it...though I should warn anyone using it that I have little knowledge of Ruby and this is less an optimal patch and more of a band-aid fixed that simply "works".
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,093
Reaction score
4,792
First Language
english
Primarily Uses
RMMV
Well, posting it would depend on the terms of the scripts, but just explaining what you changed and where without posting the scripts themselves should be fine.
 

KingHazeel

Veteran
Veteran
Joined
Jul 5, 2018
Messages
125
Reaction score
5
First Language
English
Primarily Uses
RMVXA
Very well. In Galv's script, I made a class "Sprite_Mirror_Fix" and the only function inside it is the standard update_src_rect

Code:
class Sprite_Mirror_Fix < Sprite_Character
  def update_src_rect
    if @character.reflect_sprite
      index = @character.reflect_sprite[1]
    else
      index = @character.character_index
    end
    pattern = @character.pattern < 3 ? @character.pattern : 1
    sx = (index % 4 * 3 + pattern) * @cw
    sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end
I put this below the Sprite_Mirror class. And under the "create effects" function, around like 445 or so, the mirror effects are created. I add a call to Sprite_Mirror_Fix every time Sprite_Mirror is called. i.e. replacing this...

@mirror_sprites.push(Sprite_Mirror.new(@viewport1, e)) if e.reflect

with this:

@mirror_sprites.push(Sprite_Mirror.new(@viewport1, e)) && @mirror_sprites.push(Sprite_Mirror_Fix.new(@viewport1, e)) if e.reflect

If I'm understanding this correctly, this means the most recent update for src_rect is the standard one, not a mirrored one. And since the map uses the most recent one, this issue is fixed. Now I'm sure someone with a better understanding of Ruby and the code itself could provide a more....elegant...solution, but this worked for me.
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,384
Reaction score
10,824
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Stuffing three people in a room and thinking they'll study together is so wrong XD I don't get how people do group studies. We just end up gossiping about everything except studying lol
Been parallax mapping nigh all night. :D
2nd character based on the same random inputs
the coffee shop i go to for open mic every friday only has 2 more open mics left and then they're done :'( i'm gonna die!
Everytime someone says Intel "kabylake" I hear either baby lake or ladycake.

Forum statistics

Threads
93,384
Messages
911,876
Members
122,886
Latest member
unisity
Top