扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 97|回复: 0

[转载发布] 保留事件位置

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    5 小时前
  • 签到天数: 114 天

    连续签到: 4 天

    [LV.6]常住居民II

    2338

    主题

    403

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10607
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13376

    灌水之王

    发表于 2024-4-19 16:39:01 | 显示全部楼层 |阅读模式
    class Game_Map
    alias old_setup setup
    def setup(jiong)
       if @lv_x == nil
         @lv_x = []
         @lv_y = []
         @lv_direction = []
       end
       if @lv_x[jiong]==nil
           @lv_x[jiong]=[]
           @lv_y[jiong]=[]
           @lv_direction[jiong]=[]
       end
       old_setup(jiong)
    end
    def lv_x(one,two)
       return @lv_x[one][two]
    end
    def lv_y(one,two)
       return @lv_y[one][two]
    end
    def lv_x2(one,two,three)
       @lv_x[one][two]=three
    end
    def lv_y2(one,two,three)
       @lv_y[one][two]=three
    end
    def lv_direction(one,two)
       return @lv_direction[one][two]
    end
    def lv_direction2(one,two,three)
       @lv_direction[one][two]=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}
    1. class Game_Mapalias old_setup setupdef setup(jiong)  if @lv_x == nil    @lv_x = []    @lv_y = []    @lv_direction = []  end  if @lv_x[jiong]==nil      @lv_x[jiong]=[]      @lv_y[jiong]=[]      @lv_direction[jiong]=[]  end  old_setup(jiong)enddef lv_x(one,two)  return @lv_x[one][two]enddef lv_y(one,two)  return @lv_y[one][two]enddef lv_x2(one,two,three)  @lv_x[one][two]=threeenddef lv_y2(one,two,three)  @lv_y[one][two]=threeenddef lv_direction(one,two)  return @lv_direction[one][two]enddef lv_direction2(one,two,three)  @lv_direction[one][two]=threeendendclass Game_Eventattr_reader   :idattr_reader   :map_idalias old_update updatedef 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)enddef 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 @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)  end  moveto(@event.x, @event.y)  refreshendend复制代码
    复制代码
    外加一个版本。只要是有"保留之"的名的事件,就会保留。但没有前一个版本的开关
                 本帖来自P1论坛作者「旅」,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=125932  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-3-14 23:14 , Processed in 0.072044 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表