赞 | 451 |
VIP | 56 |
好人卡 | 75 |
积分 | 424 |
经验 | 124650 |
最后登录 | 2024-11-27 |
在线时间 | 7603 小时 |
Lv5.捕梦者 (管理员) 老黄鸡
- 梦石
- 0
- 星屑
- 42448
- 在线时间
- 7603 小时
- 注册时间
- 2009-7-6
- 帖子
- 13506
|
回复 xtmhmvbw 的帖子
以下为XP版影子,再声明一次,这里是XP区,等会如果你没有说明我就会扣分+拖走- # 来自:未知
- #========================================================================
- # ■ 设 定 系 统 部 分 ■ #
- #========================================================================
- # 跟随系统部分设定(如果选用了相应的系统请选true,否则选false)
- CATERPILLAR_COMPATIBLE = false # 原版跟随系统兼容开关
- SQUAD_MOVE_COMPATIBLE = false # Near Fantastica的跟随系统兼容开关
- CCOA_CATER_COMPATIBLE = false # Ccoa的跟随系统兼容开关
- TRICKSTER_CATER_COMPATIBLE = false # Trickster的跟随系统兼容开关
-
- # 太阳系统的特别设定
- SUN_WARN = true # 检查是否兼容老版本的太阳系统
- SUN_ANGLE = 45 # 默认太阳系统产生的影子角度
- SUN_OPACITY = 128 # 默认太阳系统产生的影子深度
-
- #========================================================================
- # ■■ 设 定 部 分 结 束 ■■ #
- #========================================================================
-
-
- #==================================================================================
- # ■ Game_Temp
- #------------------------------------------------------------------------------
- # 在没有存档的情况下,处理临时数据的类。这个类的实例请参考 $game_temp 。
- #=================================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :sun_spriteset # 维持太阳阴影的活动块
- end
- #==================================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # 处理同伴的类。包含金钱以及物品的信息。本类的实例请参考 $game_party。
- #==================================================================================
- class Game_Party
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_reader :characters
- end
- #==================================================================================
- # ■ Sprite_Sun
- #------------------------------------------------------------------------------
- # 根据角色的地图位置来处理角色阴影角度的精灵(活动块)类。Game_Character 类的实例
- # 监视、活动块状态的自动变化。
- #==================================================================================
- class Sprite_Sun < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :character
- #--------------------------------------------------------------------------
- # ● 初始化对象
- # viewport : 显示端口
- # character : 角色 (Game_Character)
- # id : 角色ID
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil, id=0)
- super(viewport)
- @character = character
- params=$game_temp.sun_spriteset.sun[id]
- # 默认设置
- self_angle = SUN_ANGLE
- self_opacity = SUN_OPACITY
- # 根据参数的设置
- self_angle = params[0] if params.size > 0
- self_opacity = params[1] if params.size > 1
- @self_angle = self_angle
- @self_opacity = self_opacity
- update
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 在图块ID,文件名或者色相不同于当前的情况下
- if @tile_id != @character.tile_id or
- @character_name != @character.character_name or
- @character_hue != @character.character_hue
- @tile_id = @character.tile_id
- @character_name = @character.character_name
- @character_hue = @character.character_hue
- if @tile_id > 0
- sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
- sy = @tile_id % 256 / 8 % 16 * 32;
- set_number = @tile_id / 256
- self.bitmap = RPG::Cache.system("TileB") if set_number == 0
- self.bitmap = RPG::Cache.system("TileC") if set_number == 1
- self.bitmap = RPG::Cache.system("TileD") if set_number == 2
- self.bitmap = RPG::Cache.system("TileE") if set_number == 3
- self.src_rect.set(0, 0, 32, 32)
- self.ox = 16
- self.oy = 32
- else
- #self.bitmap =RPG::Cache.character(@character_name)#影子参数的对应修改
- self.bitmap = RPG::Cache.character(@character.character_name,
- @character.character_hue)
- sign = @character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- @cw = bitmap.width / 4#影子的完整度设定
- @ch = bitmap.height / 4#影子的完整度设定
- else
- @cw = bitmap.width / 4#影子的完整度设定
- @ch = bitmap.height / 4#影子的完整度设定
- end
- self.ox = @cw / 2
- self.oy = @ch
- end
- end
- # 设置可见状况
- self.visible = (not @character.transparent)
- # 如果画面是角色的情况下
- if @tile_id == 0
- hue = @character.character_hue
- pattern = @character.pattern < 3 ? @character.pattern : 1
- # 矩形本体设定
- sx = (hue % 4 * 3 + pattern) * @cw
- @direct = @character.direction
- if self.angle > 90 or angle < -90
- sy = ( 4 - 2) / 2 * @ch if @direct == 6
- sy = ( 6 - 2) / 2 * @ch if @direct == 4
- sy = (@character.direction - 2) / 2 * @ch if @direct != 4 and @direct != 6
- else
- sy = (hue / 4 * 4 + (@character.direction - 2) / 2) * @ch
- #sy = @character.direction
- end
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- # 设置精灵(活动块)的坐标
- self.x = @character.screen_x#
- self.y = @character.screen_y-5 #
- #self.z = 10#@character.screen_z-1
-
- self.z = @character.screen_z(@ch)-1#
- # 设置不透明度,合成方式和草木深度
- self.opacity = @self_opacity
- # 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
- self.angle = @self_angle.to_i - 90
- self.color = Color.new(0, 0, 0)
- end
- end
- #==================================================================================
- # ■ Sprite_Character
- #------------------------------------------------------------------------------
- # 角色显示用脚本。监视 Game_Character 类的实例、自动变化脚本状态。
- #==================================================================================
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 重命名函数列表
- #--------------------------------------------------------------------------
- alias sun_initialize initialize
- alias sun_update update
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # viewport : 显示端口
- # character : 角色 (Game_Character)
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil)
- #@viewport0 = Viewport.new(0, 0, 544, 416)
- @viewport = Viewport.new(0, 0, 800, 600)#修改影子的行动范围,不做剪切
- viewport.z = 0#战斗清除影子,地图切换清楚影子,改为1则有延迟
- @character = character
- super(viewport)
- @sunlist=[]
- if character.is_a?(Game_Event) and $game_temp.sun_spriteset.sun != []
- params = XPML.XPML_read("Shadow", @character.id, 2)
- if params != nil
- for i in 0...$game_temp.sun_spriteset.sun.size
- @sunlist.push(Sprite_Sun.new(viewport, @character, i))
- end
- end
- end
- if character.is_a?(Game_Player) and $game_temp.sun_spriteset.sun != []
- for i in 0...$game_temp.sun_spriteset.sun.size
- @sunlist.push(Sprite_Sun.new(viewport, $game_player, i))
- end
- #===================================================
- # ● 与人物跟随功能兼容脚本
- #===================================================
- if CATERPILLAR_COMPATIBLE and $game_party.characters != nil
- for member in $game_party.characters
- for i in 0...$game_temp.sun_spriteset.sun.size
- @sunlist.push(Sprite_Sun.new(viewport, member, i))
- end
- end
- end
- if SQUAD_MOVE_COMPATIBLE and $game_allies.values != nil
- for member in $game_allies.values
- for i in 0...$game_temp.sun_spriteset.sun.size
- @sunlist.push(Sprite_Sun.new(viewport, member, i))
- end
- end
- end
- if CCOA_CATER_COMPATIBLE and $game_train.actors != nil
- for member in $game_train.actors
- for i in 0...$game_temp.sun_spriteset.sun.size
- @sunlist.push(Sprite_Sun.new(viewport, member, i))
- end
- end
- end
- if TRICKSTER_CATER_COMPATIBLE and $game_party.followers != nil
- for member in $game_party.followers
- for i in 0...$game_temp.sun_spriteset.sun.size
- @sunlist.push(Sprite_Sun.new(viewport, member, i))
- end
- end
- end
- #===================================================
- # ● 兼容脚本结束
- #===================================================
- end
- # 执行原始函数调用
- sun_initialize(viewport, @character)
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
-
- sun_update
- if @sunlist != []
- for i in [email protected]
- @sunlist[i].update
- end
- end
- end
- end
- #==================================================================================
- # ■ Game_Event
- #------------------------------------------------------------------------------
- # 处理事件的类。条件判断、事件页的切换、并行处理、执行事件功能
- # 在 Game_Map 类的内部使用。
- #==================================================================================
- class Game_Event < Game_Character
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :id
- end
- #==================================================================================
- # ■ Spriteset_Map
- #------------------------------------------------------------------------------
- # 处理地图画面活动块和元件的类。本类在 Scene_Map 类的内部使用。
- #================================================================================
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :sun
- #--------------------------------------------------------------------------
- # ● 重命名函数列表
- #--------------------------------------------------------------------------
- alias sun_initialize initialize
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- @sun = []
- $game_temp.sun_spriteset = self
- warn = false
- for k in $game_map.events.keys.sort
- if ($game_map.events[k].list != nil and
- $game_map.events[k].list[0].code == 108 and
- ($game_map.events[k].list[0].parameters == ["Sun"] or
- $game_map.events[k].list[0].parameters == ["o"]))
- warn = true
- end
- params = XPML.XPML_read("Sun", k, 2)
- $game_temp.sun_spriteset.sun.push(params) if params != nil
- end
- if warn == true and SUN_WARN
- p "警告:在地图上至少有一个事件使用了过去的方法来添加太阳效果"
- end
- # 执行原始函数调用
- sun_initialize
- end
- end
- #==============================================================================
- # ■ module XPML
- #------------------------------------------------------------------------------
- # 本模块用来读取并传递注释中的参数。
- #
- # 使用此模块的主要用途就是检查和读出事件的注释。
- # * 标记的关键字的注明方法:
- # begin 关键字
- # * 注意参数之间必须用关键字隔开。
- # * 调用此函数的方法:
- # XPML_read("关键字",事件ID,读取参数的最大值)
- # * 最后一项可以忽略,默认为整个事件。
- # * 赋值方法:
- # 变量名 参数
- # * 每个变量名和参数各占一行。
- # * 如果指明的关键字在事件里面不存在的话,则返回nil。
- # * 如果两个标记之间没有参数的话,则返回空数组。
- # * 如果参数中有数字参数的话,会自动返回为数字变量。
- # 举例:在一个事件中的注释写入(每个注释写一行,#号后面的不写)
- # begin first # 第一关键字
- # begin second #第二关键字
- # 变量1 1
- # 变量2 two
- # begin third #第三关键字
- # 任何东西 3
- # 然后得出转换结果:
- # p XPML_read("first", event_id) -> [] #第一关键字和第二关键字没有参数
- # p XPML_read("second", event_id) -> [1,"two"] #第二关键字和第三关键字之间有2个参数
- # p XPML_read("third", event_id) -> [3] #第三关键字之间有一个参数
- # p XPML_read("forth", event_id) -> nil #找不到第四关键字则返回nil
- #===================================================
- module XPML
- module_function
- #--------------------------------------------------------------------------
- # ● XPML_read
- # markup : 需要在文件注释里检查的关键字。
- # event_id : 事件ID
- # max_param_number : 读取参数/注释的最大值,0为事件内的所有注释
- #--------------------------------------------------------------------------
- def XPML_read(markup, event_id, max_param_number = 0)
- parameter_list = nil
- event = $game_map.events[event_id]
- return if event.list == nil
- for i in 0...event.list.size
- if event.list[i].code == 108 and
- event.list[i].parameters[0].downcase == "begin " + markup.downcase
- parameter_list = [] if parameter_list == nil
- for j in i + 1...event.list.size
- if event.list[j].code == 108
- parts = event.list[j].parameters[0].split
- if parts.size != 1 and parts[0].downcase != "begin"
- if parts[1].to_i != 0 or parts[1] == "0"
- parameter_list.push(parts[1].to_i)
- else
- parameter_list.push(parts[1])
- end
- else
- return parameter_list
- end
- else
- return parameter_list
- end
- if max_param_number != 0 and j == i + max_param_number
- return parameter_list
- end
- end
- end
- end
- return parameter_list
- end
- end
复制代码 |
|