仙剑之十里坡
标题:
[6r教程整理]传送脚本
[打印本页]
作者:
最爱南宫煌
时间:
2010-7-2 22:29
标题:
[6r教程整理]传送脚本
#==============================================================================
# 本脚本原载于www.66RPG.com,转载和使用请保留此信息
#------------------------------------------------------------------------------
# 自定义内容解释:
# TOWNS[编号]=["地名,可以随便写",开关编号,[传送去的地图id,传送去的地图x,
# 传送去的地图y],角色朝向]
#
# 编号请按照0、1、2、3……顺序往下排布
# 当编号的开关打开的时候,才可以选择这个传送地点
# 角色朝向,2为下,4为左,6为右,8为上,具体可以参考自己数字小键盘的方向和数字关系
# 如果是其他方向请自己改。
#
# 需要制作脚本,请点击66rpg.com最底部的QQ交谈
#
# 使用方法:在需要传送的传送门、传送石、传送羽毛、传送旅店一类的地方使用公共事件:
# 呼叫脚本:$scene = Scene_Teleport.new
#
# 制作者:柳柳
#==============================================================================
TOWNS=[]
TOWNS[0]=["古德城堡东门",1,[1,2,3],2]
TOWNS[1]=["古德城堡西门",2,[1,2,5],4]
TOWNS[2]=["修道院门口",3,[3,3,6],4]
TOWNS[3]=["女神遗迹南口",4,[4,2,6],4]
TOWNS[4]=["圣天城骑士团练兵场",5,[5,2,6],4]
TOWNS[5]=["许愿之塔",6,[6,9,6],4]
#==============================================================================
# ■ Window_Teleport
#------------------------------------------------------------------------------
# 处理传送的窗口
#==============================================================================
class Window_Teleport < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(640,640,64,64)
self.contents = Bitmap.new(width, height)
self.opacity = 180
get_towns
draw_towns
@column_max = 1
end
#--------------------------------------------------------------------------
# ● 获取可到达的城镇和窗口大小
#--------------------------------------------------------------------------
def get_towns
@carol3_towns = []
@width_temp = 0
@cont_use = false
for town in TOWNS
if $game_switches[town[1]]==true
@carol3_towns.push(town)
if contents.text_size(town[0]).width >= @width_temp
@width_temp = contents.text_size(town[0]).width
end
end
end
@item_max = @carol3_towns.size
if @item_max == 0
@carol3_towns[0] = ["没有可以传送的地方",1,[1,1,1]]
@width_temp = contents.text_size(@carol3_towns[0][0]).width
@item_max = 1
@cont_use = true
end
self.width = [@width_temp+32,480].min
self.height = [(@item_max+1)*32,360].min
self.x = (640-self.width)/2
self.y = (480-self.height)/2
self.contents = Bitmap.new(width-32,row_max*32)
end
#--------------------------------------------------------------------------
# ● 描绘城镇名称
#--------------------------------------------------------------------------
def draw_towns
for i in 0...@carol3_towns.size
self.contents.draw_text(0,i*32,@width_temp,32,@carol3_towns[i][0],1)
end
end
#--------------------------------------------------------------------------
# ● 返回的内容
#========================================================================
# ● 地图编号
#--------------------------------------------------------------------------
def map_id
return @carol3_towns[self.index][2][0]
end
#--------------------------------------------------------------------------
# ● 地图x坐标
#--------------------------------------------------------------------------
def map_x
return @carol3_towns[self.index][2][1]
end
#--------------------------------------------------------------------------
# ● 地图y坐标
#--------------------------------------------------------------------------
def map_y
return @carol3_towns[self.index][2][2]
end
#--------------------------------------------------------------------------
# ● 角色朝向
#--------------------------------------------------------------------------
def map_direction
return @carol3_towns[self.index][2][3]
end
#--------------------------------------------------------------------------
# ● 判断是否一个城市都没有
#--------------------------------------------------------------------------
def cant_use?
return @cont_use
end
end
#==============================================================================
# ■ Scene_Teleport
#------------------------------------------------------------------------------
# 处理传送执行的类
#==============================================================================
class Scene_Teleport
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
$game_system.se_play($data_system.decision_se)
@carol3_trans_white = false
@carol3_map_sprite = Spriteset_Map.new
@carol3_teleport_window = Window_Teleport.new
if @carol3_teleport_window.cant_use?
@carol3_teleport_window.index = -1
else
@carol3_teleport_window.index = 0
end
@carol3_teleport_window.active = true
Graphics.transition
loop do
Graphics.update
Input.update
carol3_update
if $scene != self
break
end
end
if @carol3_trans_white==true
@carol3_white_sprite = Sprite.new
@carol3_white_sprite.bitmap = Bitmap.new(640,480)
@carol3_white_sprite.opacity = 0
@carol3_white_sprite.bitmap.fill_rect(0, 0, 640, 480, Color.new(255,255,255,255))
for i in 0..20
@carol3_white_sprite.opacity += 15
@carol3_teleport_window.opacity -= 12
@carol3_teleport_window.contents_opacity -= 12
Graphics.update
end
Graphics.freeze
Graphics.transition(0)
Graphics.update
@carol3_map_sprite.dispose
$game_map.setup($game_temp.player_new_map_id)
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
$game_player.turn_down
$game_player.straighten
$game_map.autoplay
Graphics.frame_reset
for i in 0..20
@carol3_white_sprite.opacity -= 15
Graphics.update
end
@carol3_white_sprite.dispose
@carol3_teleport_window.dispose
Graphics.freeze
else
Graphics.freeze
@carol3_teleport_window.dispose
@carol3_map_sprite.dispose
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def carol3_update
@carol3_teleport_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if @carol3_teleport_window.index == -1
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
else
$game_temp.player_new_map_id = @carol3_teleport_window.map_id
$game_temp.player_new_x = @carol3_teleport_window.map_x
$game_temp.player_new_y = @carol3_teleport_window.map_y
$game_temp.player_new_direction = @carol3_teleport_window.map_direction
$game_temp.player_transferring = true
$game_temp.transition_processing = true
$game_temp.transition_name = ""
$scene = Scene_Map.new
@carol3_trans_white = true
Audio.se_play("Audio/SE/" + "018-Teleport01",100,100)
return
end
end
end
end
复制代码
作者:
最爱南宫煌
时间:
2010-7-2 22:30
解释一下,这个就是在不同的开关打开时触动相同的事件,到达不同的场景。
作者:
BlackFeather
时间:
2010-7-3 05:35
这个不如用事件做
作者:
最爱南宫煌
时间:
2010-7-3 11:36
我也是这么想的,不如来个公共事件里面来几个条件分歧。
作者:
BlackFeather
时间:
2010-7-3 12:50
你这样想的话还发?
欢迎光临 仙剑之十里坡 (http://palslp.com/bbs/)
Powered by Discuz! X2.5