保留事件位置
class Game_Mapalias old_setup setup
def setup(jiong)
if @lv_x == nil
@lv_x = []
@lv_y = []
@lv_direction = []
end
if @lv_x==nil
@lv_x=[]
@lv_y=[]
@lv_direction=[]
end
old_setup(jiong)
end
def lv_x(one,two)
return @lv_x
end
def lv_y(one,two)
return @lv_y
end
def lv_x2(one,two,three)
@lv_x=three
end
def lv_y2(one,two,three)
@lv_y=three
end
def lv_direction(one,two)
return @lv_direction
end
def lv_direction2(one,two,three)
@lv_direction=three
end
end
class Game_Event
attr_reader :id
attr_reader :map_id
alias old_update update
def update
old_update
$game_map.lv_x2(@map_id,@id,self.x)
$game_map.lv_y2(@map_id,@id,self.y)
$game_map.lv_direction2(@map_id,@id,self.direction)
end
def initialize(map_id, event)
super()
@map_id = map_id
@event = event
@id = @event.id
@erased = false
@starting = false
@through = true
if $game_map.lv_x(@map_id,@id)!=nil and !$game_temp.lv_switches
@event.x = $game_map.lv_x(@map_id,@id)
@event.y = $game_map.lv_y(@map_id,@id)
@direction = $game_map.lv_direction(@map_id,@id)
end
moveto(@event.x, @event.y)
refresh
end
end
class Game_Temp
attr_accessor :lv_switches
end
支持读档。如果不想要的时候,可以利用 事件中的 【脚本】 功能,
$game_temp.lv_switches = true
又想要时,
$game_temp.lv_switches = false
发出来骗分{/hx}
class Game_Mapalias old_setup setupdef setup(jiong)if @lv_x == nil @lv_x = [] @lv_y = [] @lv_direction = []endif @lv_x==nil @lv_x=[] @lv_y=[] @lv_direction=[]endold_setup(jiong)enddef lv_x(one,two)return @lv_xenddef lv_y(one,two)return @lv_yenddef lv_x2(one,two,three)@lv_x=threeenddef lv_y2(one,two,three)@lv_y=threeenddef lv_direction(one,two)return @lv_directionenddef lv_direction2(one,two,three)@lv_direction=threeendendclass Game_Eventattr_reader :idattr_reader :map_idalias old_update updatedef updateold_update$game_map.lv_x2(@map_id,@id,self.x)$game_map.lv_y2(@map_id,@id,self.y)$game_map.lv_direction2(@map_id,@id,self.direction)enddef initialize(map_id, event)super()@map_id = map_id@event = event@id = @event.id@erased = false@starting = false@through = trueif $game_map.lv_x(@map_id,@id)!=nil and @event.name =~ "保留之" @event.x = $game_map.lv_x(@map_id,@id) @event.y = $game_map.lv_y(@map_id,@id) @direction = $game_map.lv_direction(@map_id,@id)endmoveto(@event.x, @event.y)refreshendend复制代码
外加一个版本。只要是有"保留之"的名的事件,就会保留。但没有前一个版本的开关
本帖来自P1论坛作者「旅」,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=125932若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]