[RGSS3] Sprite OY getting reset to 0?

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
So I'm trying to fix an issue with Victor's Character control. It is a compatibility issue, so I know he won't even bother looking at it. The problem stems from having events with offsets in their graphics. I have already implemented a patch for the system wherein not all poses of a character need to have the required offset. This worked seamlessly for the player, however now it seems that it isn't so good with events. I setup a small method that is supposed to log when a sprite's OY is changed, however it gives the following output:

[17:11:1.562335000] CHANGING OY FROM 0 TO 48 AT {0148}:1302:in `set_bitmap_position' {0160}:559:in `set_bitmap_position' {0148}:1252:in `set_character_bitmap'[17:11:1.564335000] CHANGING OY FROM 0 TO -24 AT {0160}:569:in `set_bitmap_position' {0148}:1252:in `set_character_bitmap' {0044}:60:in `update_bitmap'[17:11:5.695715000] CHANGING OY FROM 0 TO 96 AT {0148}:1302:in `set_bitmap_position' {0160}:559:in `set_bitmap_position' {0148}:1252:in `set_character_bitmap'[17:11:5.701719000] CHANGING OY FROM 0 TO -24 AT {0160}:569:in `set_bitmap_position' {0148}:1252:in `set_character_bitmap' {0044}:60:in `update_bitmap'One problem I've noticed is that all the responses say that they're changing OY from 0, but none of them say they change OY to 0. It just happens. It can't be caused by the oy method being overwritten, because I used the following, which is an alias (overwriting the method would mean my alias doesn't run, and the OY system would probably break entirely, given that it's a part of a hidden class):

alias aushsifghtnjkrerkw3eqiwjudhedfyjtnrek= oy=def oy=(val) puts "[#{(t = Time.now); "#{t.hour}:#{t.min}:#{t.sec}.#{t.nsec}"}] CHANGING OY FROM #{self.oy} TO #{val} AT \n\t#{caller[0, 3].join("\n\t")}\n" if @character.id == 6 aushsifghtnjkrerkw3eqiwjudhedfyjtnrek = valendThis is located within the Sprite_Character class. In order to illustrate my issue, here's a video of what's happening.


 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Based on your debugging approach, you seem to be assuming the setter method is always used to change the value.


Are there other ways to change the oy value?
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Based on your debugging approach, you seem to be assuming the setter method is always used to change the value.

Are there other ways to change the oy value?
Not as far as I can tell, oy is a property of the hidden Sprite class, so to my knowledge, the only way to change any of those is by using the writer method.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Maybe something to do with these? (like if that commented refresh was made to run, then it will run refresh_characters if the player is moving)

Code:
  #called upon every update  def update_characters    refresh_characters if @map_id != $game_map.map_id    #refresh_characters if $game_player.moving?    @character_sprites.each {|sprite| sprite.update }  end
Code:
  #Here we see that refresh disposes them first, then creates them again  def refresh_characters    dispose_characters    create_characters  end
 
Last edited by a moderator:

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
564
Reaction score
275
First Language
German
Primarily Uses
There is a typo in your code. You have to use self.aushsifghtnjkrerkw3eqiwjudhedfyjtnrek = val or the statement is interpreted as a local variable assignment.
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
There is a typo in your code. You have to use self.aushsifghtnjkrerkw3eqiwjudhedfyjtnrek = val or the statement is interpreted as a local variable assignment.
This was the solution, thank you.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
There is a typo in your code. You have to use self.aushsifghtnjkrerkw3eqiwjudhedfyjtnrek = val or the statement is interpreted as a local variable assignment.
Good catch. It's a common bug :(
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top