SCRIPTING HELP

Posts

Pages: 1
How can i delete an image via script???? Currently i am only changing the z to -9999 to hide it, but that produces lag.

Thanks in advance.

EDIT: Welp, the lag was poduced because i was showing the image in a method were everything was being update durphurp.
Dispose the sprite holding the bitmap. Like this (@sprite is just the variable name in this case, replace it by the one you are using):
@sprite.dispose
If you don't intend to use it again before a while, you can also dispose the bitmap itself beforehand.
@sprite.bitmap.dispose
@sprite.dispose
If you are using RMXP, I would also suggest you to take care of the garbage collection between the scenes, because it's not done by default and you can end up with 300 MB of RAM used for old unused shit after a few hours of gameplay.
Yeah, that works, but i am having another problem. I am using Enu Tankentai XP and i am tying to Show images to replace the windows, the problem is the next:

alias update_phase3_skill_select_n01 update_phase3_skill_select
  def update_phase3_skill_select
    @status_window.opacity = 0  if HIDE_WINDOW
    @picture3 = Sprite.new
    @picture3.bitmap = RPG::Cache.picture 'Battle System Skillls'
    @picture3.z = 2101
    if Input.trigger?(Input::C)
      @skill = @skill_window.skill
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      @active_battler.current_action.skill_id = @skill.id
      @skill_window.visible = false
      if @skill.extension.include?("TARGETALL")
        $game_system.se_play($data_system.decision_se)
        start_select_all_battlers
        return
      end
      if (@skill.extension.include?("RANDOMTARGET") and @skill.scope <= 2) or @skill.scope == 2
        $game_system.se_play($data_system.decision_se)
        start_select_all_enemies
        return
      end
      if (@skill.extension.include?("RANDOMTARGET") and @skill.scope > 2) or @skill.scope == 4
        $game_system.se_play($data_system.decision_se)
        start_select_all_actors
        return
      end
    end
    update_phase3_skill_select_n01
  end

After a few seconds after the picture is shown, the game start to lag a lot, until the point it freezes. I think is updating the image every frame. there is a way to not update the image???
URGH... Dude, you're actually creating a new sprite every frame - because this update method is called every frame during the skill selection process.
You should do this inside the start_phase3_skill_select method instead of the update one.
Thats the problem i had, i cant find where this method is called :S

EDIT: Nvm, found it. Thanks =D

Yeah it works perflecty now =D Thanks kread you saved my battle system ^^
Pages: 1