我海市蜃楼 发表于 2010-6-5 20:34:49

帮忙改个脚本

请高手为这个脚本加一个开关,用的时候开启不用的时候关闭。谢谢!!

#===================================
=========================================
# ■ VX_事件图形刷新简化    —— By 诡异の猫
#============================================================================
#    脚本内容: 只刷新视野内的事件图形,改善大地图事件过多卡机情况.
#============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● 判定图形是否再视野内
#--------------------------------------------------------------------------
def in_view?
    add_x = (self.width-32)*4 + 256
    add_y = self.height*8
    begin_x = $game_map.display_x - add_x
    begin_y = $game_map.display_y - add_y
    end_x = $game_map.display_x + 4352 + add_x
    end_y = $game_map.display_y + 3328 + add_y
    limit_x = $game_map.width * 256 - 256 + add_x
    limit_y = $game_map.height * 256 - 256 + add_y
    char_x = @character.real_x
    char_y = @character.real_y
    if end_x <= limit_x
      return false if char_x < begin_x or char_x > end_x
    end
    if end_y <= limit_y
      return false if char_y < begin_y or char_y > end_y
    end
    if end_x > limit_x and end_y > limit_y
      return false if char_x < begin_x and char_x > end_x - limit_x
      return false if char_y < begin_y and char_y > end_y - limit_y
    end
    return true
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
    super
    if in_view?
      update_bitmap
      self.visible = (not @character.transparent)
      update_src_rect
      self.x = @character.screen_x
      self.y = @character.screen_y
      self.z = @character.screen_z
      self.opacity = @character.opacity
      self.blend_type = @character.blend_type
      self.bush_depth = @character.bush_depth
    end
    update_balloon
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      start_animation(animation)
      @character.animation_id = 0
    end
    if @character.balloon_id != 0
      @balloon_id = @character.balloon_id
      start_balloon
      @character.balloon_id = 0
    end
end
end

secondsen 发表于 2010-6-5 23:11:24

39行

    if in_view?下边插入一句
unless $secondsen_switch

49行
后边插入一个end

用法

事件脚本

$secondsen_switch = true,表示我不需要刷新 屏幕外的事件
$secondsen_switch = false,表示 我需要刷新 屏幕外的事件

我海市蜃楼 发表于 2010-6-7 20:41:00

谢谢

secondsen 发表于 2010-6-7 21:23:51

不用谢,举手之劳而已

我海市蜃楼 发表于 2010-6-14 08:07:42

新的问题有出现的了,当我开启脚本的时候就连屏幕显示的人物都不动了,包括角色在内啊!

secondsen 发表于 2010-6-14 08:36:28

又看了一下。。。我给搞错了。。。。wait 1 MINUTE

secondsen 发表于 2010-6-14 08:36:44

def in_view?
    return true unless $secondsen_switch

j脚本还原在def in_view?后边加上一句就可以了

我海市蜃楼 发表于 2010-6-14 10:49:29

还是不行啊,如果两句都加上的话就会出错,只加上后一句的话那就还是老样子啊。

secondsen 发表于 2010-6-14 10:59:13

就按照我最后说的方法改,前面的不需要了。。。

我测试的情况是,可行的。。。

而且。。我用的是 1024X768 分辨率的。。。而这个视野的范围没有我的分辨率大,一眼就看出来范围外的事件刷不刷新了。。。真的好用

我海市蜃楼 发表于 2010-6-14 12:35:32

可以可以好像我需要的那个开关又不管用了,拜托帮帮啊………………
页: [1] 2
查看完整版本: 帮忙改个脚本