Project1
标题:
请人帮我修改战斗背景脚本. 附上变量开关.以及即时刷新
[打印本页]
作者:
丿梁丶小柒
时间:
2012-8-20 12:31
标题:
请人帮我修改战斗背景脚本. 附上变量开关.以及即时刷新
本帖最后由 丿梁丶小柒 于 2012-8-20 12:32 编辑
这个脚本本是使用地图ID取得战斗样式背景的
我要求的就是 加上取得指定的变量ID 取得样式战斗背景 意思就是 不是取得地图ID 是变量ID
是加上此功能.原本的取得地图ID的功能也要保留 不过当某开关打开的时候是取得变量ID的 不是地图ID
第二就是 想在战斗中 更换背景 就是即时刷新更换战斗背景 当我的变量更换之后 战斗背景也跟着变化
此脚本原帖
http://rpg.blue/forum.php?mod=viewthread&tid=163949
#==============================================================================
# 华丽战斗背景
# 原作BY: modern algbera
# 提供BY:企鹅达达
# 翻译BY:仲秋启明
#==============================================================================
#==============================================================================
# ● 设定
#==============================================================================
module ModernAlgebra
#==============================================================================
# ● 设定
# map_id => [scape_1_id, scape_2_id, ..., scape_n_id] 地图ID=> [背景图ID]
# when scape_id 背景图ID
# parallax_name = "" 背景图名
# z = 0 决定显示位置Z轴
# scroll_x = 0 X轴滚动
# scroll_y = 0 Y轴滚动
# zoom_x = 100 X轴缩放
# zoom_y = 100 Y轴缩放
# opacity = 255 透明度
# blend_type = 0 混合方式:0:普通,1:加法,2: 减法
# color = [r, g, b, a] #(default: [0, 0, 0, 0]) 颜色[红,绿,蓝,通道]
# tone = [r, g, b] #(default: [0, 0, 0])
#==============================================================================
MAP_BATTLE_SCAPES = {
1 => [1]
}
MAP_BATTLE_SCAPES.default = []
AREA_BATTLE_SCAPES = {
1 => [1, 2],
2 => [4, 5]
}
AREA_BATTLE_SCAPES.default = []
BattleScape = Struct.new (:parallax_name, :z, :scroll_x, :scroll_y,
:zoom_x, :zoom_y, :blend_type, :color, :tone, :opacity)
def self.battle_scape (scape_id)
@battle_scapes = [] if @battle_scapes.nil?
return @battle_scapes[scape_id] if @battle_scapes[scape_id] != nil
parallax_name, blend_type, color, tone = "", 0, [0, 0, 0, 0], [0, 0, 0]
z, scroll_x, scroll_y, zoom_x, zoom_y, opacity = 0, 0, 0, 100, 100, 255
case scape_id
when 1
parallax_name = "BlueSky"
z = 50
scroll_x = -10
scroll_y = 5
when 2
parallax_name = "CloudySky"
scroll_x = -5
when 3
parallax_name = "Fog"
z = 150
scroll_x = -10
scroll_y = 5
blend_type = 2
opacity = 100
when 4
parallax_name = "Bridge"
z = 50
zoom_x = 85
zoom_y = 130
when 5
parallax_name = "BlueSky"
scroll_x = 2
end
@battle_scapes[scape_id] = BattleScape.new (parallax_name, z, scroll_x,
scroll_y, (zoom_x / 100.0), (zoom_y / 100.0), blend_type, color, tone, opacity)
return @battle_scapes[scape_id]
end
def self.map_battle_scapes (map_id)
scapes = []
MAP_BATTLE_SCAPES[map_id].each { |scape_id| scapes.push (self.battle_scape (scape_id)) }
return scapes
end
def self.area_battle_scapes (area_id)
scapes = []
AREA_BATTLE_SCAPES[area_id].each { |scape_id| scapes.push (self.battle_scape (scape_id)) }
return scapes
end
end
class Game_Map
def battle_scapes
$data_areas.values.each { |area|
if $game_player.in_area? (area) && !ModernAlgebra.area_battle_scapes (area.id).empty?
return ModernAlgebra.area_battle_scapes (area.id)
end
}
return ModernAlgebra.map_battle_scapes (@map_id)
end
end
class Spriteset_Battle
alias modernalgbr_terraintypes_crtbttlebck_63b5 create_battleback
def create_battleback (*args)
if $BTEST
modernalgbr_terraintypes_crtbttlebck_63b5 (*args)
return
end
@battle_scapes = $game_map.battle_scapes
@battle_planes = []
@battle_planes_xy = []
@battle_scapes.each { |battle_scape|
plane = Plane.new (@viewport1)
plane.z = battle_scape.z
plane.bitmap = Cache.parallax (battle_scape.parallax_name)
plane.zoom_x, plane.zoom_y = battle_scape.zoom_x, battle_scape.zoom_y
plane.blend_type = battle_scape.blend_type
plane.color = Color.new (*battle_scape.color)
plane.tone = Tone.new (*battle_scape.tone)
plane.opacity = battle_scape.opacity
@battle_planes.push (plane)
@battle_planes_xy.push ([0,0])
}
if @battle_planes.empty?
modernalgbr_terraintypes_crtbttlebck_63b5 (*args)
else
Graphics.frame_reset
end
end
alias modrnalgbra_terratas_dspsebkbmp_74bt dispose_battleback_bitmap
def dispose_battleback_bitmap (*args)
modrnalgbra_terratas_dspsebkbmp_74bt (*args) unless @battleback_sprite.nil?
@battle_planes.each { |plane| plane.bitmap.dispose unless plane.bitmap.disposed? }
end
alias modrenalbr_dspsbb_terrintypes_09b6 dispose_battleback
def dispose_battleback (*args)
modrenalbr_dspsbb_terrintypes_09b6 (*args) unless @battleback_sprite.nil?
@battle_planes.each { |plane| plane.dispose }
end
alias modalg_bbckupd_trrantypes_52n5 update_battleback
def update_battleback (*args)
if @battleback_sprite.nil?
@battle_planes.each_index { |i|
x_y = @battle_planes_xy[i]
plane = @battle_planes[i]
scape = @battle_scapes[i]
x_y[0] += (scape.scroll_x * 2)
x_y[1] += (scape.scroll_y * 2)
plane.ox, plane.oy = (x_y[0] / 16), (x_y[1] / 16)
}
else
modalg_bbckupd_trrantypes_52n5 (*args)
end
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1