[RGSS3] Sprite OY getting reset to 0?

● ARCHIVED · READ-ONLY
Started by Zalerinian 7 posts View original ↗
  1. 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.


  2. 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?
  3. Tsukihime said:
    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.
  4. 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
  5. There is a typo in your code. You have to use self.aushsifghtnjkrerkw3eqiwjudhedfyjtnrek = val or the statement is interpreted as a local variable assignment.
  6. Another Fen said:
    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.
  7. Another Fen said:
    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 :(