[RGSS3] Invisible Sprites?

● ARCHIVED · READ-ONLY
Started by SoulPour777 19 posts View original ↗
  1. Does anyone know why the battlers seems to be invisible? As far as I declared them well, there seems to be a problem whenever I display them via Sprite_Battler, which should not be the case in terms of the enemy. My aim here is that I have to make the effects for each battler of the enemy (if they are Game_Enemy), they should follow the effect given inside their arrays.

    Can anyone pinpoint which seems to be the error? It should be appearing in the Scene_Battle as far as I can see it, seems to be there's a missing thing here.

    Spoiler
    Code:
    module SOULPOUR_L    BREATH_SPEED = 1    BREATH_EFFECT_ENEMY_ID = [1,2,4,5,7,24,28]      FLOAT_EFFECT_ENEMY_ID = [26]      MOVESIDE_EFFECT_ENEMY_ID = [24,26]    STATES_CANCEL_EFFECT = [7,50,54,60]end  class Game_Battler < Game_BattlerBase  include SOULPOUR_L  #--------------------------------------------------------------------------  # * Alias Listings  # Aliased Methods: add_state(state_id), remove_state(state_id)  #--------------------------------------------------------------------------    alias :soulpour_battlerex_add_state                           :add_state  alias :soulpour_battlerex_remove_state                        :remove_state  #--------------------------------------------------------------------------  # * Add State  #--------------------------------------------------------------------------  def add_state(state_id)    soulpour_battlerex_add_state(state_id)    if self.is_a?(Game_Enemy)      for i in STATES_CANCEL_EFFECT        if @states.include(i)          @breath_effect = false          @float_effect = false          @moveside_effect = false        end      end    end  end  #--------------------------------------------------------------------------  # * Remove State  #--------------------------------------------------------------------------  def remove_state(state_id)    soulpour_battlerex_remove_state(state_id)     if self.is_a?(Game_Enemy)             sce = false        for i in STATES_CANCEL_EFFECT             sce = true if @states.include?(i)        end            if sce == false               @breath_effect = true if BREATH_EFFECT_ENEMY_ID.include?(@enemy_id)            @float_effect = true if FLOAT_EFFECT_ENEMY_ID.include?(@enemy_id)            @moveside_effect = true if MOVESIDE_EFFECT_ENEMY_ID.include?(@enemy_id)                   end        end          end  endclass Game_Enemy  #--------------------------------------------------------------------------  # * Included Modules  #--------------------------------------------------------------------------    include SOULPOUR_L  #--------------------------------------------------------------------------  # * Public Instance Variables  #--------------------------------------------------------------------------  attr_accessor :breath_effect                  # Breath Effect  attr_accessor :float_effect                   # Float Effect  attr_accessor :moveside_effect                # Move Side Effect  #--------------------------------------------------------------------------  # * Alias Listings  # Aliased Methods: initialize(index, enemy_id)  #--------------------------------------------------------------------------    alias :soulpour_battlerex_initialize                            :initialize  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(index, enemy_id)    soulpour_battlerex_initialize(index, enemy_id)    @breath_effect = false    @float_effect = false    @moveside_effect = false    @breath_effect = true if BREATH_EFFECT_ENEMY_ID.include?(@enemy_id)     @float_effect = true if FLOAT_EFFECT_ENEMY_ID.include?(@enemy_id)     @moveside_effect = true if MOVESIDE_EFFECT_ENEMY_ID.include?(@enemy_id)       endendclass Sprite_Battler   include SOULPOUR_L   alias :soulpour_battlerex_initialize                           :initialize   alias :soulpour_battlerex_update                               :update  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(viewport, battler = nil)    soulpour_battlerex_initialize(viewport, battler = nil)    breath_effect_setup(battler)     float_effect_setup(battler)     modeside_effect_setup(battler)       end        #--------------------------------------------------------------------------   # ● Moveside Effect   #--------------------------------------------------------------------------                          def modeside_effect_setup(battler)        @moveside_duration = rand(30)       @moveside_speed = 0   end        #--------------------------------------------------------------------------   # ● Float Effect Setup   #--------------------------------------------------------------------------                         def float_effect_setup(battler)        @float_duration = rand(40)       @float_speed = rand(3)   end      #--------------------------------------------------------------------------   # ● Breath Effect Setup   #--------------------------------------------------------------------------                        def breath_effect_setup(battler)        @breath_phase = 0       @breath_effect = false       @breath_effect_speed = 0       if @battler.is_a?(Game_Enemy) and @battler.breath_effect          initial_breath = 1.00 + (@battler.screen_x * 0.001) - (@battler.screen_y * 0.001)               initial_breath = 1.1 if initial_breath > 1.1          initial_breath = 0.9 if initial_breath < 0.9          self.zoom_y = initial_breath          ex_speed = [[BREATH_SPEED, 1].max, 9].min          speed = ex_speed * 0.001          @breath_effect_speed = speed + (rand(99) * 0.00001)       end       end     #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    soulpour_battlerex_update     if @battler.is_a?(Game_Enemy)         update_breath_effect        update_float_effect        update_move_side_effect     end         end   #--------------------------------------------------------------------------   # ● Update Moveside Effect   #--------------------------------------------------------------------------                      def update_move_side_effect       return if @battler == nil       return unless @battler.moveside_effect       @moveside_speed += 1       return if @moveside_speed < 4       @moveside_speed = 0       @moveside_duration += 1       case @moveside_duration          when 0..10            self.ox += 2          when 11..15            self.ox += 1          when 16..25            self.ox -= 2          when 26..30            self.ox -= 1          else            @moveside_duration = 0       end   end      #--------------------------------------------------------------------------   # ● Update Float Effect   #--------------------------------------------------------------------------                     def update_float_effect       return if @battler == nil       return unless @battler.float_effect       @float_speed += 1       return if @float_speed < 2       @float_speed = 0       @float_duration += 1       case @float_duration          when 0..15            self.oy += 2          when 16..20              self.oy += 1          when 21..35            self.oy -= 2          when 36..40              self.oy -= 1          else              @float_duration = 0       end   end      #--------------------------------------------------------------------------   # ● Update Breaht Effect   #--------------------------------------------------------------------------                    def update_breath_effect        return if @battler == nil       return unless @battler.breath_effect       if @breath_effect_speed == 0             ex_speed = [[BREATH_SPEED, 1].max, 9].min          speed = ex_speed * 0.001                 @breath_effect_speed = speed + (rand(99) * 0.00001)          self.zoom_y = 1 + rand(10) * 0.01       end          if @breath_phase == 0          self.zoom_y += @breath_effect_speed          @breath_phase = 1 if self.zoom_y >= 1.05       else          self.zoom_y -= @breath_effect_speed          @breath_phase = 0 if self.zoom_y <= 1.01       end               end  end 
  2. it is supposed to add a breath effect on your battler right and you say they are invisble?
  3. That's how it should be. But the sprite seems to be not appearing inside the battle scene, considering they were initialized.
  4. Hum I Need to explore more the script before for have a conclusion~
  5. Even so, the traits are to be delivered on the Game_Enemy, that's why I initialized it that way. Even if you tried to make a new class and make Game_Enemy as its superclass, the issue remains, where are my enemy battlers?
  6. Hum everything seem okai but why did you put Battler = nil?

    it is not  supposed to be Battler = @enemy_id ? 
  7. the battler is reinitialized as the battler. In Sprite_Battler, the battler from the arguments is the current @battler instance variable.

    Code:
      #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize(viewport, battler = nil)    super(viewport)    @battler = battler    @battler_visible = false    @effect_type = nil    @effect_duration = 0  end
  8. did you try to retrieve the Nil from the battler Just in case 
  9. It shows an error that way:

    if @battler.is_a?(Game_Enemy) and @battler.breath_effectsince it should return @battler as a Game_Enemy. The @battler = nil is called for because it shows how the battler is a Game_Enemy. I thought having this turned to true helps:

    @battler_visible = falsebut somehow it just returns me the same problem. There must be something I missed out here but I can't locate where. Everything seems to be working, just the battlers not appearing and the supposed effect seems not to be showing there.
  10. Hello there.

    The problem is...

    Spoiler
    def initialize(viewport, battler = nil) soulpour_battlerex_initialize(viewport, battler = nil) Should be

    def initialize(viewport, battler = nil) soulpour_battlerex_initialize(viewport, battler) You don't have to use = nil in a method call. Otherwise, @battler would be initialized as nil and Sprite_Battler would not display anything,
    You still have to add < Sprite_Base and < Game_Battler to the class definitions, and there is a typo in:

    Code:
     if @states.include(i)
  11. Another error seems to have occurred right after I solved that issue, it seems its not reading breath_effect which is clearly initialized as a public instance variable at Soulpour_Behaviors inherited from Game_Battler. The error lies here:

    Code:
    if @battler.is_a?(Game_Enemy) and @battler.breath_effect
  12.  I think you input your ''condition'' of the bad way try to only input if the @battler.effect you will see if this work if this not work it is the is_a who not work
  13. it won't do, other effects would also be questioned although they were initialized. i am having a thought I might have done something wrong here, but still not knowledgeable what that is.
  14. are you sure it is the ''breath'' method who not work I am pretty sure you need to check if the State's method is input correctly (well it is my opinion) but I remember moghunter do a breath method you can check at it for be sure you do the breath method correctly..
  15. the breath method is initialized but it doesn't recognize it. If you remove that, other initialized methods are still going to be called missing.
  16. You should post the whole thing, as you have it currently. With the changes described by Breaking Owl, I see no obvious reason why it shouldn't work.
  17. Try inserting some p statements (print) to show what the variables are at each point, and running the game with the console open. That should tell you whether the script is doing what you THINK it's doing, and where you might be off.


    Also, a copy of one of the battler images you're using might be helpful - for all anyone knows, it could be the sprite and not the script that's at fault.


    In fact, if you do up a quick demo with JUST that script and the game ready to call a battle with whatever settings are needed to illustrate the problem, it would probably not take somebody long to have a look and see if they can figure it out.
  18. Hello mods, a help from another member of the site and some changes I've made was able to solve the problem. For people who might be experiencing such (if ever there is), the approach I was able to do to solve this is to actually create an update method for both ox and oy for each of the animation. Apparently, the only thing I missed here is the ones Breaking Owl mentioned, the nil method I placed on the battlers, and lastly the update_origin which I somehow left out. The include should have a question mark on the last part.

    Shaz, could you please close the thread as I've already been able to do a solution? Thank you.
  19. 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.