Project1
标题:
有关脚本冲突的问题
[打印本页]
作者:
亮F
时间:
2008-10-25 01:21
标题:
有关脚本冲突的问题
这两个脚本MS有冲突
大家帮忙看下
#==============================================================================
# 本脚本来自www.66rpg.com,使用前请参考制作录像
# 作者:柳柳
#
# 脚本的功能:
#
# 1、设置第二层远景,做遮挡
# 2、设置第三层远景,做通行判定
# 这个通行判定,以图的判定为最高,如果要求某地通行,请把那个地方擦白。
# 本通行判定和录像中讲的方法并不冲突
#==============================================================================
# ■ Spriteset_Map
#------------------------------------------------------------------------------
# 处理地图画面活动块和元件的类。本类在
# Scene_Map 类的内部使用。
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# 生成显示端口
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
# 生成元件地图
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
# 生成远景平面
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
@panorama2 = Plane.new(@viewport1)
@panorama2.z = 3000
# 生成雾平面
@fog = Plane.new(@viewport1)
@fog.z = 3000
# 生成角色活动块
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
# 生成天气
@weather = RPG::Weather.new(@viewport1)
# 生成图片
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
# 生成计时器块
@timer_sprite = Sprite_Timer.new
# 刷新画面
update
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
# 释放元件地图
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles[i].dispose
end
@tilemap.dispose
# 释放远景平面
@panorama.dispose
@panorama2.dispose
# 释放雾平面
@fog.dispose
# 释放角色活动块
for sprite in @character_sprites
sprite.dispose
end
# 释放天候
@weather.dispose
# 释放图片
for sprite in @picture_sprites
sprite.dispose
end
# 释放计时器块
@timer_sprite.dispose
# 释放显示端口
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 远景与现在的情况有差异发情况下
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panarama2.bitmap.dispose
@panorama2.bitmap = nil
@panarama.bitmap = nil
end
if @panorama_name != ""
if $panorama3 != nil
$panorama3.dispose
end
$panorama3 = Sprite.new
$panorama3.bitmap = RPG::Cache.panorama(@panorama_name+"_3", @panorama_hue)
$panorama3.visible = false
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
@panorama2.bitmap = RPG::Cache.panorama(@panorama_name+"_2", @panorama_hue)
end
Graphics.frame_reset
end
# 雾与现在的情况有差异的情况下
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
# 刷新元件地图
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
# 刷新远景平面
@panorama.ox = $game_map.display_x / 4
@panorama.oy = $game_map.display_y / 4
@panorama2.ox = @panorama.ox
@panorama2.oy = @panorama.oy
# 刷新雾平面
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
# 刷新角色活动块
for sprite in @character_sprites
sprite.update
end
# 刷新天候图形
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
# 刷新图片
for sprite in @picture_sprites
sprite.update
end
# 刷新计时器块
@timer_sprite.update
# 设置画面的色调与震动位置
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 设置画面的闪烁色
@viewport3.color = $game_screen.flash_color
# 刷新显示端口
@viewport1.update
@viewport3.update
end
end
#==============================================================================
# 本脚本来自www.66rpg.com,使用前请参考制作录像
#==============================================================================
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 处理地图的类。包含卷动以及可以通行的判断功能。
# 本类的实例请参考 $game_map 。
#==============================================================================
class Game_Map
attr_accessor :map
attr_accessor :map_id
#--------------------------------------------------------------------------
# ● 可以通行判定
# x : X 坐标
# y : Y 坐标
# d : 方向 (0,2,4,6,8,10)
# ※ 0,10 = 全方向不能通行的情况的判定 (跳跃等)
# self_event : 自己 (判定事件可以通行的情况下)
#--------------------------------------------------------------------------
def passable?(x, y, d, self_event = nil)
# 被给予的坐标地图外的情况下
unless valid?(x, y)
# 不能通行
return false
end
martix = [false,false,false,false,false,false,false,false,false]
for panorama_x in 32*x..32*x+10
next if panorama_x %2 == 0
for panorama_y in 32*y..32*y+10
next if panorama_y %2 == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[0] = true
break
end
end
break if martix[0]
end
for panorama_x in 32*x+10..32*x+22
next if panorama_x %2 == 0
for panorama_y in 32*y..32*y+10
next if panorama_y %2 == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[1] = true
break
end
end
break if martix[1]
end
for panorama_x in 32*x+23..32*x+32
next if panorama_x %2 == 0
for panorama_y in 32*y..32*y+10
next if panorama_x %y == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[2] = true
break
end
end
break if martix[2]
end
for panorama_x in 32*x..32*x+10
next if panorama_x %2 == 0
for panorama_y in 32*y+10..32*y+22
next if panorama_y %2 == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[3] = true
break
end
end
break if martix[3]
end
for panorama_x in 32*x+10..32*x+22
next if panorama_x %2 == 0
for panorama_y in 32*y+10..32*y+22
next if panorama_y %2 == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[4] = true
break
end
end
break if martix[4]
end
for panorama_x in 32*x+23..32*x+32
next if panorama_x %2 == 0
for panorama_y in 32*y+10..32*y+22
next if panorama_x %y == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[5] = true
break
end
end
break if martix[5]
end
for panorama_x in 32*x..32*x+10
next if panorama_x %2 == 0
for panorama_y in 32*y+23..32*y+32
next if panorama_y %2 == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[6] = true
break
end
end
break if martix[6]
end
for panorama_x in 32*x+10..32*x+22
next if panorama_x %2 == 0
for panorama_y in 32*y+23..32*y+32
next if panorama_y %2 == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[7] = true
break
end
end
break if martix[7]
end
for panorama_x in 32*x+23..32*x+32
next if panorama_x %2 == 0
for panorama_y in 32*y+23..32*y+32
next if panorama_x %y == 0
color = $panorama3.bitmap.get_pixel(panorama_x,panorama_y)
if color.green.to_i==0
martix[8] = true
break
end
end
break if martix[8]
end
pass_up = true
pass_down = true
pass_left = true
pass_right = true
#---------------------------------------------------------------------
# 注意,如果打算严格要求,则把and前加井号。我测试感觉放松似乎更自然一些,看情况吧。
# 这种算法是把一个小格分为9个格(参考小键盘)
#
# 放松要求是2,4,6,8格决定能否通行
# 而严格要求则是2,4,6,8格并且要求至少附带临近旁一格才能通行
#---------------------------------------------------------------------
if martix[1] and (martix[0] or martix[2])
pass_up = false
end
if martix[3] and (martix[0] or martix[6])
pass_left = false
end
if martix[7] and (martix[6] or martix[8])
pass_down = false
end
if martix[5] and (martix[2] or martix[8])
pass_right = false
end
if martix[4]
pass_up = false
pass_down = false
pass_left = false
pass_right = false
end
pass_up = pass_up== false ? 0 : 1
pass_left = pass_left== false ? 0 : 1
pass_right = pass_right== false ? 0 : 1
pass_down = pass_down== false ? 0 : 1
pass = pass_down * 1 + pass_left * 2 + pass_right * 4 + pass_up * 8
pass = 15-pass
# 方向 (0,2,4,6,8,10) 与障碍物接触 (0,1,2,4,8,0) 后变换
bit = (1 << (d / 2 - 1)) & 0x0f
# 循环全部的事件
for event in events.values
# 自己以外的元件与坐标相同的情况
if event.tile_id >= 0 and event != self_event and
event.x == x and event.y == y and not event.through
# 如果障碍物的接触被设置的情况下
if @passages[event.tile_id] & bit != 0
# 不能通行
return false
# 如果全方向的障碍物的接触被设置的情况下
elsif @passages[event.tile_id] & 0x0f == 0x0f
# 不能通行
return false
# 这以外的优先度为 0 的情况下
elsif @priorities[event.tile_id] == 0
# 可以通行
return true
end
end
end
# 从层按从上到下的顺序调查循环
for i in [2, 1, 0]
# 取得元件 ID
tile_id = data[x, y, i]
# 取得元件 ID 失败
if tile_id == nil
# 不能通行
return false
# 如果障碍物的接触被设置的情况下
elsif @passages[tile_id] & bit != 0
# 不能通行
return false
# 如果全方向的障碍物的接触被设置的情况下
elsif @passages[tile_id] & 0x0f == 0x0f
# 不能通行
return false
# 这以外的优先度为 0 的情况下
elsif @priorities[tile_id] == 0
# 可以通行
#p pass
if pass & bit != 0
return false
elsif pass & 0x0f == 0x0f
return false
end
end
end
# 可以通行
return true
end
end
#==============================================================================
# 本脚本的用途请参考制作录像
#==============================================================================
复制代码
#_______________________________________________________________________________
# MOG_MPW HUD Elena V2.0
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
module MOG
#HUD Position.
STMAPX = 0 # X Pos
STMAPY = 370 # Y Pos
#Disable HUD Switch ID.
STMAPVIS = 1
#Windowskin name.
STMAPSKIN = "001-Blue01"
#Window Opacity.
STMAPOPA = 0
end
$mogscript = {} if $mogscript == nil
$mogscript["mpstelen"] = true
###############
# Window_Base #
###############
class Window_Base < Window
def draw_maphp2(actor, x, y)
back = RPG::Cache.picture("BAR_Meter")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("HP_Meter")
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("HP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 35, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 161, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x + 160, y - 2, 48, 32, actor.hp.to_s, 2)
end
def draw_mapsp2(actor, x, y)
back = RPG::Cache.picture("BAR_Meter")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, back, src_rect)
meter = RPG::Cache.picture("SP_Meter")
cw = meter.width * actor.sp / actor.maxsp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 65, y - ch + 30, meter, src_rect)
text = RPG::Cache.picture("SP_Tx")
cw = text.width
ch = text.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40, y - ch + 30, text, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 161, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x + 160, y - 2, 48, 32, actor.sp.to_s, 2)
end
def draw_mexp(actor, x, y)
actor = $game_party.actors[0]
bitmap2 = RPG::Cache.picture("Exp_Back")
cw = bitmap2.width
ch = bitmap2.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60 , y - ch + 30, bitmap2, src_rect)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
bitmap = RPG::Cache.picture("Exp_Meter")
if actor.level < 99
cw = bitmap.width * rate
else
cw = bitmap.width
end
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 60 , y - ch + 30, bitmap, src_rect)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 55, y + 1, 84, 32, "Exp",0)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 54, y, 84, 32, "Exp",0)
end
def nada
face = RPG::Cache.picture("")
end
def draw_heroface(actor,x,y)
face = RPG::Cache.picture(actor.name + "_face") rescue nada
cw = face.width
ch = face.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, face, src_rect)
end
def draw_actor_statemap(actor, x, y, width = 120)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 1, y + 1, width, 32, text)
self.contents.font.color = Color.new(250,255,255,255)
self.contents.draw_text(x, y, width, 32, text)
end
def draw_actor_levelmap(actor, x, y)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = Color.new(50,255,250,255)
self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv")
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x + 30, y, 24, 32, actor.level.to_s, 1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x + 31, y + 1, 24, 32, actor.level.to_s, 1)
end
end
##############
# Game_Actor #
##############
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#####################
# Window_Status_Map #
#####################
class Window_Sthero < Window_Base
def initialize
super(0, 0, 310, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin(MOG::STMAPSKIN)
self.contents.font.bold = true
self.contents.font.size = 20
self.contents.font.name = "Georgia"
self.opacity = MOG::STMAPOPA
refresh
end
def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_maphp2(actor, 35, 35)
draw_mapsp2(actor, - 40, 60)
draw_heroface(actor, 0, 70)
draw_actor_statemap(actor, 200, 60, 70)
draw_actor_levelmap(actor, 80, 10)
draw_mexp(actor, 100, 10)
end
end
###############
# Game_Player #
###############
class Game_Player < Game_Character
attr_accessor :wref
end
#############
# Scene_Map #
#############
class Scene_Map
alias mog11_main main
def main
@sthero = Window_Sthero.new
@sthero.x = MOG::STMAPX
@sthero.y = MOG::STMAPY
if $game_switches[MOG::STMAPVIS] == false
@sthero.visible = true
else
@sthero.visible = false
end
mog11_main
@sthero.dispose
end
alias mog11_update update
def update
if $game_switches[MOG::STMAPVIS] == false
@sthero.visible = true
else
@sthero.visible = false
end
if $game_player.wref == true
@sthero.refresh
$game_player.wref = false
end
mog11_update
end
end
##############
# Game_Party #
###############
class Game_Party
alias mog11_check_map_slip_damage check_map_slip_damage
def check_map_slip_damage
for actor in @actors
if actor.hp > 0 and actor.slip_damage?
$game_player.wref = true
end
end
mog11_check_map_slip_damage
end
end
###############
# Interpreter #
###############
class Interpreter
alias mog11_command_311 command_311
def command_311
mog11_command_311
$game_player.wref = true
end
alias mog11_command_312 command_312
def command_312
mog11_command_312
$game_player.wref = true
end
alias mog11_command_313 command_313
def command_313
mog11_command_313
$game_player.wref = true
end
alias mog11_command_314 command_314
def command_314
mog11_command_314
$game_player.wref = true
end
alias mog11_command_315 command_315
def command_315
mog11_command_315
$game_player.wref = true
end
end
################
# Game_Battler #
################
class Game_Battler
alias mog11_attack_effect attack_effect
def attack_effect(attacker)
mog11_attack_effect(attacker)
$game_player.wref = true
end
alias mog11_skill_effect skill_effect
def skill_effect(user, skill)
mog11_skill_effect(user, skill)
$game_player.wref = true
end
alias mog11_item_effect item_effect
def item_effect(item)
mog11_item_effect(item)
$game_player.wref = true
end
alias mog11_add_state add_state
def add_state(state_id, force = false)
mog11_add_state(state_id, force = false)
$game_player.wref = true
end
end
复制代码
作者:
亮F
时间:
2008-10-25 22:11
没人么~{/fd}``````
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1