设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1196|回复: 4
打印 上一主题 下一主题

[有事请教] 血条释放还是刷新异常

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3186
在线时间
1863 小时
注册时间
2010-6-19
帖子
1205
跳转到指定楼层
1
发表于 2023-4-14 11:02:16 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
500星屑
本帖最后由 黑米馒头 于 2023-4-17 13:40 编辑

裂开了,搞了个召还宠物的功能,战斗时候召还宠物时,血条刷新显示异常,这是啥情况。。。

没召还前



召还后



每次召还宠物后,都会留下几个血条,这是刷新的原因还是没释放干净?


下面的脚本也没看到哪里可以控制释放窗口的地方~

我目前用这几条代码控制血条刷新的,角色受伤时血条刷新都正常

    # 打开血条刷新
    $game_temp.enemy_hpsp_refresh = true
    # 刷新图片活动块
    @spriteset.update
    # 关闭血条刷新
    $game_temp.enemy_hpsp_refresh = false


我的逻辑是,收回宠物的时候,释放血条窗口,
但是class Sprite_Battler < RPG::Sprite,里面好像没有释放血条窗口的设定


血条脚本

点评

自己解决了  发表于 2023-4-17 09:38

评分

参与人数 1+1 收起 理由
金芒芒 + 1 塞糖

查看全部评分

Lv4.逐梦者

梦石
0
星屑
6286
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
2
发表于 2023-4-16 13:32:46 | 只看该作者
本帖最后由 金芒芒 于 2023-4-16 13:46 编辑

召唤的宠物 名字  图片  头像 兵种 属性多一样    系统刷新停顿一下 就会乱码 最少也要搞一个图片1,2,3 名字加个赵钱孙李   就差ID不一样了  再两个防卡脚本
防卡脚本1
RUBY 代码复制
  1. #===============================================================================
  2. # Class Antilag Settings
  3. #-------------------------------------------------------------------------------
  4. # 防止事件过多卡机脚本
  5. # 设置CPU线程
  6. #===============================================================================
  7. class Antilag_Settings
  8.  
  9.   attr_accessor :event
  10.   attr_accessor :max_cpu_utilization
  11.   attr_accessor :cpu_tolerance
  12.   #-----------------------------------------------------------------------------
  13.   # 初始化对象
  14.   #-----------------------------------------------------------------------------
  15.   def initialize
  16.     @event = true
  17.     @high_priority = true
  18.     @max_cpu_utilization = 85
  19.     #这个是控制优先级。
  20.     @cpu_tolerance = 20
  21.     @SetPriorityClass = Win32API.new('kernel32', 'SetPriorityClass',
  22.                                      ['p', 'i'], 'i')
  23.     @GetProcessTimes = Win32API.new('kernel32', 'GetProcessTimes',
  24.                                     ['i','p','p','p','p'], 'i')
  25.   end
  26.   #-----------------------------------------------------------------------------
  27.   # 更改优先级 on(true)/off(false)
  28.   #-----------------------------------------------------------------------------
  29.   def high_priority=(value)
  30.     @high_priority = value
  31.  
  32.     if @high_priority
  33.       @SetPriorityClass.call(-1, 0x00000080) # 高质量
  34.       # 设置CPU优先级80为高。110为实时。20为标准。
  35.     else
  36.       @SetPriorityClass.call(-1, 0x00000020) # 标准优先
  37.     end
  38.   end
  39.   #-----------------------------------------------------------------------------
  40.   # 返回现在的CPU使用率
  41.   #-----------------------------------------------------------------------------
  42.   def get_cpu_utilization
  43.     # 使用API获取内核用户调用时间
  44.     creation_time = '0' * 10
  45.     exit_time = '0' * 10
  46.     kernel_time = '0' * 10
  47.     user_time = '0' * 10
  48.     @GetProcessTimes.call(-1, creation_time, exit_time, kernel_time, user_time)
  49.     kernel_time = kernel_time.unpack('l2')
  50.     user_time = user_time.unpack('l2')
  51.     kernel_time = kernel_time[0] + kernel_time[1]
  52.     user_time = user_time[0] + user_time[1]
  53.     # 计算不同的CPU使用率
  54.     if @old_time != nil
  55.       timer_difference = Time.new - @old_timer
  56.       time_difference = kernel_time + user_time - @old_time
  57.       result = time_difference / timer_difference / 100000
  58.     else
  59.       result = $antilag.max_cpu_utilization
  60.     end
  61.     # 节约CPU使用(还是计算)
  62.     @old_timer = Time.new
  63.     @old_time = kernel_time + user_time
  64.     return result
  65.   end
  66. end
  67. $antilag = Antilag_Settings.new
  68. #==============================================================================
  69. # ■ Scene_Map
  70. #------------------------------------------------------------------------------
  71. #  处理地图画面的类。
  72. #==============================================================================
  73. class Scene_Map
  74.   #-----------------------------------------------------------------------------
  75.   # 刷新模块, 增加平滑帧数
  76.   #-----------------------------------------------------------------------------
  77.   alias f0tzis_anti_lag_scene_map_update update
  78.   def update
  79.     f0tzis_anti_lag_scene_map_update
  80.     if Graphics.frame_count % 20 == 0 and $antilag.max_cpu_utilization <= 100
  81.       # 计算CPU最大限度利用和当前的利用率
  82.       abs = $antilag.max_cpu_utilization - $antilag.get_cpu_utilization
  83.       # 如果改变帧速率的差异
  84.       if abs.abs >= $antilag.max_cpu_utilization * $antilag.cpu_tolerance/100.0
  85.         Graphics.frame_rate = [[10, Graphics.frame_rate + abs / 2].max, 40].min
  86.       end
  87.     end
  88.   end
  89. end
  90.  
  91. #咳咳少了几行代码
  92. $antilag.max_cpu_utilization = 85                              
  93. $antilag.cpu_tolerance = 20      
  94. $antilag.high_priority = true   
  95. $antilag.event = true
  96. #自动回滚标准
  97. if $antilag.max_cpu_utilization>=100
  98.   $antilag.max_cpu_utilization=85
  99. end    # 分歧结束。


防卡脚本2
RUBY 代码复制
  1. #==============================================================================
  2. # Módulo AntiLag
  3. #==============================================================================
  4.     module AntiLag
  5.       SPC = Win32API.new("kernel32", "SetPriorityClass", "pi", "i")
  6.       @@high_priority = false
  7.       def self.high_priority ; @@high_priority; end
  8.       def self.high_priority?; @@high_priority; end
  9.       def self.high_priority=(valor)
  10.         return if @@high_priority == valor
  11.         @@high_priority = valor
  12.         if @@high_priority
  13.           SPC.call(-1, 0x80)
  14.           return
  15.         end
  16.         SPC.call(-1, 0x20)
  17.       end
  18.     end
  19.     AntiLag.high_priority = true

点评

你这两个脚本对我没用~  发表于 2023-4-17 09:26
回复

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1237
在线时间
163 小时
注册时间
2019-10-4
帖子
217
3
发表于 2023-4-17 10:43:17 | 只看该作者
这画面也太好看了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 01:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表