| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 5 |
| 经验 | |
| 最后登录 | 2026-7-27 |
| 在线时间 | 871 小时 |
- 梦石
- 0
- 星屑
- 462
- 在线时间
- 871 小时
- 注册时间
- 2014-5-5
- 回帖
- 914
|
发表于 2014-5-24 18:51:31
|
显示全部楼层
- =begin
- *******************************************************************************
- ===============================================================================
- ★ 停止时动画 ★
- ---------------------------------------------------------------------------
- by -> 芯☆淡茹水
- ===============================================================================
- ● 使用方法:复制该脚本,插入到 main 前。
- ===============================================================================
- ● 行走图的制作和命名:
-
- 和默认行走图类似,只是多了四方向的停止动画。
- 从上到下依次为:停止动画(面向下,面向左,面向右,面向上);行走动画
- (面向下,面向左,面向右,面向上)。做好的素材按上面顺序拼接好即可。
-
- 行走图命名:拥有 停止动画 的行走图,在命名时,名字前加一个符号“$”
- 即可。
-
- 名字前没有“$”符号的行走图文件,为默认行走图(基础版四方向)。
-
- 详见范例的行走图制作和命名。
- ===============================================================================
- ● 冲突的可能:按键加速;队伍跟随。
- ===============================================================================
- =end
- #=============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- attr_reader :standby
- #---------------------------
- alias add_initialize_xdrs initialize
- def initialize
- add_initialize_xdrs
- @standby = 0
- end
- #--------------------------------------------------------------------------
- def update_move
- if @standby > 0
- if @direction <= @standby / 2
- @direction = @direction + @standby / 2
- end
- end
- # 移动速度转换为地图坐标系的移动距离
- distance = 2 ** @move_speed
- # 理论坐标在实际坐标下方的情况下
- if @y * 128 > @real_y
- # 向下移动
- @real_y = [@real_y + distance, @y * 128].min
- end
- # 理论坐标在实际坐标左方的情况下
- if @x * 128 < @real_x
- # 向左移动
- @real_x = [@real_x - distance, @x * 128].max
- end
- # 理论坐标在实际坐标右方的情况下
- if @x * 128 > @real_x
- # 向右移动
- @real_x = [@real_x + distance, @x * 128].min
- end
- # 理论坐标在实际坐标上方的情况下
- if @y * 128 < @real_y
- # 向上移动
- @real_y = [@real_y - distance, @y * 128].max
- end
- # 移动时动画为 ON 的情况下
- if @walk_anime
- # 动画计数增加 1.5
- @anime_count += 1.5
- # 移动时动画为 OFF、停止时动画为 ON 的情况下
- elsif @step_anime
- # 动画计数增加 1
- @anime_count += 1
- end
- end
- #--------------------------------------------------------------------------
- def update_stop
- if @standby > 0
- @direction = @direction - 8 if @direction > @standby / 2
- @anime_count += 1
- if @anime_count > (18 - @move_speed * 2)
- @pattern = (@pattern + 1) % 4
- @anime_count = 0
- end
- else
- # 停止时动画为 ON 的情况下
- if @step_anime
- # 动画计数增加 1
- @anime_count += 1
- # 停止时动画为 OFF 并且、现在的图像与原来的不同的情况下
- elsif @pattern != @original_pattern
- # 动画计数增加 1.5
- @anime_count += 1.5
- end
- end
- # 事件执行待机中并且不是锁定状态的情况下
- # ※锁定、处理成立刻停止执行中的事件
- unless @starting or lock?
- # 停止计数增加 1
- @stop_count += 1
- end
- end
- end
- #=============================================================================
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------
- def refresh
- # 初始化本地变量 new_page
- new_page = nil
- # 无法暂时消失的情况下
- unless @erased
- # 从编号大的事件页按顺序调查
- for page in @event.pages.reverse
- # 可以参考事件条件 c
- c = page.condition
- # 确认开关条件 1
- if c.switch1_valid
- if $game_switches[c.switch1_id] == false
- next
- end
- end
- # 确认开关条件 2
- if c.switch2_valid
- if $game_switches[c.switch2_id] == false
- next
- end
- end
- # 确认变量条件
- if c.variable_valid
- if $game_variables[c.variable_id] < c.variable_value
- next
- end
- end
- # 确认独立开关条件
- if c.self_switch_valid
- key = [@map_id, @event.id, c.self_switch_ch]
- if $game_self_switches[key] != true
- next
- end
- end
- # 设置本地变量 new_page
- new_page = page
- # 跳出循环
- break
- end
- end
- # 与上次同一事件页的情况下
- if new_page == @page
- # 过程结束
- return
- end
- # @page 设置为现在的事件页
- @page = new_page
- # 清除启动中标志
- clear_starting
- # 没有满足条件的页面的时候
- if @page == nil
- # 设置各实例变量
- @tile_id = 0
- @character_name = ""
- @character_hue = 0
- @move_type = 0
- @through = true
- @trigger = nil
- @list = nil
- @interpreter = nil
- # 过程结束
- return
- end
- # 设置各实例变量
- @tile_id = @page.graphic.tile_id
- @character_name = @page.graphic.character_name
- @character_hue = @page.graphic.character_hue
- sign = @character_name[/^[\!\$]./]
- @standby = (sign != nil and sign.include?('$')) ? 16 : 0
- if @original_direction != @page.graphic.direction
- @direction = @page.graphic.direction
- @original_direction = @direction
- @prelock_direction = 0
- end
- if @original_pattern != @page.graphic.pattern
- @pattern = @page.graphic.pattern
- @original_pattern = @pattern
- end
- [url=home.php?mod=space&uid=316553]@opacity[/url] = @page.graphic.opacity
- @blend_type = @page.graphic.blend_type
- @move_type = @page.move_type
- @move_speed = @page.move_speed
- @move_frequency = @page.move_frequency
- @move_route = @page.move_route
- @move_route_index = 0
- @move_route_forcing = false
- @walk_anime = @page.walk_anime
- @step_anime = @page.step_anime
- @direction_fix = @page.direction_fix
- @through = @page.through
- @always_on_top = @page.always_on_top
- @trigger = @page.trigger
- @list = @page.list
- @interpreter = nil
- # 目标是 [并行处理] 的情况下
- if @trigger == 4
- # 生成并行处理用解释器
- @interpreter = Interpreter.new
- end
- # 自动事件启动判定
- check_event_trigger_auto
- end
- end
- #==============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- def refresh
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 清除角色的文件名及对像
- @character_name = ""
- @character_hue = 0
- # 分支结束
- return
- end
- # 获取带头的角色
- actor = $game_party.actors[0]
- # 设置角色的文件名及对像
- @character_name = actor.character_name
- @character_hue = actor.character_hue
- sign = @character_name[/^[\!\$]./]
- @standby = (sign != nil and sign.include?('$')) ? 16 : 0
- # 初始化不透明度和合成方式
- @opacity = 255
- @blend_type = 0
- end
- end
- #==============================================================================
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- def update
- super
- # 元件 ID、文件名、色相与现在的情况存在差异的情况下
- if @tile_id != @character.tile_id or
- @character_name != @character.character_name or
- @character_hue != @character.character_hue
- # 记忆元件 ID 与文件名、色相
- @tile_id = @character.tile_id
- @character_name = @character.character_name
- @character_hue = @character.character_hue
- # 元件 ID 为有效值的情况下
- if @tile_id >= 384
- self.bitmap = RPG::Cache.tile($game_map.tileset_name,
- @tile_id, @character.character_hue)
- self.src_rect.set(0, 0, 32, 32)
- self.ox = 16
- self.oy = 32
- # 元件 ID 为无效值的情况下
- else
- self.bitmap = RPG::Cache.character(@character.character_name,
- @character.character_hue)
- @cw = bitmap.width / 4
- @ch = @character.standby > 0 ? bitmap.height / 8 : bitmap.height / 4
- self.ox = @cw / 2
- self.oy = @ch
- end
- end
- # 设置可视状态
- self.visible = (not @character.transparent)
- # 图形是角色的情况下
- if @tile_id == 0
- # 设置传送目标的矩形
- sx = @character.pattern * @cw
- sy = (@character.direction - 2) / 2 * @ch
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- # 设置脚本的坐标
- self.x = @character.screen_x
- self.y = @character.screen_y
- self.z = @character.screen_z(@ch)
- # 设置不透明度、合成方式、茂密
- self.opacity = @character.opacity
- self.blend_type = @character.blend_type
- self.bush_depth = @character.bush_depth
- # 动画
- if @character.animation_id != 0
- animation = $data_animations[@character.animation_id]
- animation(animation, true)
- @character.animation_id = 0
- end
- end
- end
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- def draw_actor_graphic(actor, x, y)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- sign = actor.character_name[/^[\!\$]./]
- cw = bitmap.width / 4
- n = (sign != nil and sign.include?('$')) ? 8 : 4
- ch = bitmap.height / n
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- end
- #==============================================================================
复制代码 按照附件的行走图拼合,名字前加个$就可以实现待机了
脚本来自@芯☆淡茹水 |
-
|