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

[转载发布] (LISA)用VXA制作2D地图的脚本V1.5

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2024-11-27 10:08
  • 签到天数: 108 天

    连续签到: 4 天

    [LV.6]常住居民II

    2219

    主题

    376

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    9661
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    12284

    灌水之王

    发表于 2024-11-21 17:46:17 | 显示全部楼层 |阅读模式
    LISA the Painful 是一款深受老美喜爱的rpg游戏,其作者使用RM的方式让人不得不惊叹
    而原作中的物理系统完全是靠事件复制粘贴而成,过程繁琐,常常让同人作者苦不堪言
    此脚本旨在模仿LISA游戏中的坠落,攀爬以及跳跃等系统,抛砖引玉,为广大(?)热爱LISA的同人作者提供便利
    2020.10.6更新 修改了若干bug
    其实早就写完了,想和游戏一块发布,奈何制作水平着急,还是发了算了
    [Ruby] 纯文本查看 复制代码
    =begin
    LISA物理系统脚本 V1.5
    By 炽天之咸鱼裁决
    修复了成吨bug
    =end
    #使用方法,创建一个并行事件,输入脚本"lisajump(X)",X为玩家奔跑时跳跃的最大距离
    module Jump
      #=============Run/On bike====================================
      #自行车开关ID
      #不需要就写"nil"
      BIKE = nil
      #自行车/奔跑图像
      RUN = ["$Brad bike",0]
      #自行车/奔跑时的跳跃图像
      RUNJUMP = ["$Brad bike",0]
      #自行车/奔跑时的跳崖图像
      LRUNFALL = ["$Brad bike jump L",0]
      RRUNFALL = ["$Brad bike jump R",0]
      #自行车/奔跑时的摔倒图像
      BIKEFALL = ["$Brad fall bike",0]
      #掉落高度 => 伤害
      RLIST = {0 => 0,
              5 => 10}
      #自行车/奔跑时的攀爬图像
      RROPEP = ["$Brad rope bike",0]
      #=================================================================
      #绳子区域编号
      ROPE = [18]
      #爬绳贴图
      ROPEP = ["$Brad rope",0]
      #陆地区域编号
      LAND = [1,2,5,7]
      #跳跃贴图
      PIC = ["$Brad Jump1eye",0]
      #行走贴图
      WALK = ["Brad",2]
      #摔倒贴图
      FALL = ["$Brad fall 1eye",0]
      #掉落高度 => 伤害
      LIST = {0 => 0,
              3 => 10}
      #受到的伤害 => 动画
      EXLIST =  {0 => 1,
              10 => 106}
      #跳跃音效与受伤音效
      FSE = RPG::SE.new("Rustle", 70, 150)
      DSE = RPG::SE.new("Earth5", 70, 150)
      #空变量ID
      V = 66
      #=================================================================
      #空气墙ID
      WALL = [48]
    end
    
    
    
    
    
    
    
    
    
    
    #========================================以下勿动===============================
    class Game_Player < Game_Character
      def move_by_input
        return if !movable? || $game_map.interpreter.running? || $game_variables[Jump::V] == 1
        move_straight(Input.dir4) if Input.dir4 > 0
      end
    end
    
    class Game_Player < Game_Character
      
      def getX
        @x
      end
      
      def getY
        @y
      end
      
    end
    
    
    class Game_Player < Game_Character
      def dash?
        if Jump::BIKE != nil
          if $game_switches[Jump::BIKE] == true
            return true
          else
            return false
          end
        else
          return false if $game_map.disable_dash?
          return false if vehicle
          return Input.press?(:A)
        end
      end
    end
      
      
       
    
    class Game_Interpreter
      attr_accessor :rg
      attr_accessor :bike
      alias lisa_initialize initialize
      def initialize(depth = 0)
        @rg = 0
        @bike = 1
        lisa_initialize(depth = 0)
      end
      
      def rush
        if Input.press?(:A)
          if Jump::BIKE != nil
            if $game_switches[Jump::BIKE] == true
            $game_switches[Jump::BIKE] = false
            end
          end
        end
      end
    
      
      def island(id)
        for n in Jump::LAND
            if n == id
                 return 1
            end
        end
        return 0
      end
      def isrope(id)
        for n in Jump::ROPE
            if n == id
                 return 1
            end
        end
        return 0
      end
      def refresh
        i = [0,0]
        x = $game_player.x
        y = $game_player.y
        id=$game_map.region_id(x, y)
        i[1] = isrope(id)
        i[0] = island(id)
        if i[0] == 1
          if $game_player.direction == 8
            id2=$game_map.region_id(x, y - 1)
            j = isrope(id2)
            if j == 1
              i = [0,1]
            end
          end
        elsif i[1] == 1
          if $game_player.direction == 2
            id2=$game_map.region_id(x, y + 1)
            j = island(id2)
            if j == 1
              i = [1,0]
            end
          end
        end
        if i[1] == 1
          if $game_player.dash?
            p = Jump::RROPEP
          else
            p = Jump::ROPEP
          end
          o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(0)]
          fall_move(o)
        elsif i[0] == 1
          if $game_player.dash?
            p = Jump::RUN
          else
            p = Jump::WALK
          end
          o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(0)]
          fall_move(o)
        end
        @rg = id
      end
      def rope()
        if $game_variables[Jump::V] == 1
          return
        end
        if $game_player.dash?
          b = 1
        else
          b = 0
        end
        refresh if @bike != b
        @bike = b
        i = [0,0]
        x = $game_player.x
        y = $game_player.y
        id=$game_map.region_id(x, y)
        return if id == @rg
        refresh
        @rg = id
      end
       
      
       
      
      
      def lisajump(i)
        return if $game_player.move_route_forcing
        rush
        fall(i)
        jumpupanddown()
        rope()
      end
      
      
      
      def jumpjump(i)
          $game_variables[Jump::V] = 1
          if $game_player.dash?
            p = Jump::RUNJUMP
          else
            p = Jump::PIC
          end
          if $game_player.dash?
            w = Jump::RUN
          else
            w = Jump::WALK
          end
          Jump::FSE.play
          o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(14,[0,-i]),RPG::MoveCommand.new(0)]
          fall_move(o)
          o = [RPG::MoveCommand.new(41,w),RPG::MoveCommand.new(0)]
          fall_move(o)
          $game_variables[Jump::V] = 0
      end
      
      def jumpupanddown()
        if $game_variables[Jump::V] == 1
          return
        end
        i=0
        j=0
        if Input.press?(:UP) and Input.press?(:C)
          x = $game_player.getX
          y = $game_player.getY
          if $game_map.valid?(x, y - 1) == true
            id1=$game_map.region_id(x, y)
            id2=$game_map.region_id(x, y - 1)
    
            for n in Jump::LAND
              if n == id1
                 i = 1
              end
              if n == id2
                 j = 1
              end
            end
            k = i * j
            
            for n in Jump::ROPE
              if n == id1 or n == id2
                k = 0
              end
            end
            
            
            if k == 1
              jumpjump(1)
            end
            
          end
        end
       
        if Input.press?(:DOWN) and Input.press?(:C)
        x = $game_player.getX
        y = $game_player.getY
        if $game_map.valid?(x, y + 1) == true
          id1=$game_map.region_id(x, y)
          id2=$game_map.region_id(x, y + 1)
          for n in Jump::LAND
            if n == id1
                i = 1
            end
            if n == id2
                j = 1
            end
          end
          k = i * j
          if k == 1
            jumpjump(-1)
          end
          end
        end
    
    
      end
      
      
      def fall_move(x)
          point = $game_player
          r = RPG::MoveRoute.new
          r.repeat = false
          r.skippable = true
          r.wait = true
          r.list = x
          point.force_move_route(r)
          if r.wait
            Fiber.yield while point.move_route_forcing
          end
      end
       
       
      def checkdirection(x)
        r = x
        if $game_player.direction == 4
          r = -r
        end
        return r
      end
      
      
      def findpoint(f)
        x = $game_player.getX
        y = $game_player.getY
        r = f
        i = -1
        d = 0
        while true
            i += 1
            j = 1
            while j <= r
              if $game_player.dash?
                t = checkdirection(j)
              else
                t = 0
                j = r
              end
              id = $game_map.region_id(x + t, y + i)
              for n in Jump::LAND
                if n == id
                  return [t,i,0]
                end
              end
              j += 1
            end
            if $game_map.valid?(x + t, y + i) == false
              i = -1
              while true
                i += 1
                id = $game_map.region_id(x, y + i)
                for n in Jump::LAND
                  if n == id
                    return [0,i,0]
                  end
                end
                t = checkdirection(1)
                return [t,i,1] if $game_map.valid?(x, y + i) == false
              end
            end
          end
      end
      
      
      def fall(f)
       
        if $game_variables[Jump::V] == 1
          return
        end
       
        x = $game_player.getX
        y = $game_player.getY
       
        q = 0
        p = $game_map.region_id(x, y)
       
        for n in Jump::LAND
          if n == p
              q=1
          end
        end
       
        for n in Jump::ROPE
          if n == p
            q=1
          end
        end
       
       
        if q == 0
          $game_variables[Jump::V] = 1
          a = findpoint(f)
          r = a[0]
          i = a[1]
          d = a[2]
          
          
          if $game_player.dash?
            if $game_player.direction == 6
              igf = Jump::RRUNFALL
            else
              igf = Jump::LRUNFALL
            end
          else
            igf = Jump::PIC
          end
          
          
          if d == 1
            s = Jump::FSE
            o = [RPG::MoveCommand.new(44,[s]),RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(14,[r,i-1]),RPG::MoveCommand.new(0)]
            fall_move(o)
            SceneManager.goto(Scene_Gameover)
            return
          end
          
          if $game_player.dash?
            lst= Jump::RLIST
          else
            lst= Jump::LIST
          end
          
          f = 0
          dam = 0
          while f < i
            f += 1
            if lst[f] != nil
              dam = lst[f]
            end
          end
          
         
    
          
          
    
          
          if dam!=0 and Jump::EXLIST[dam] != nil
            
            
            o = [RPG::MoveCommand.new(44,[Jump::FSE]),RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(14,[r,i]),RPG::MoveCommand.new(44,[Jump::DSE]),RPG::MoveCommand.new(0)]
            fall_move(o)
    
            
            $game_player.animation_id = Jump::EXLIST[dam]
            
            value = operate_value(1,0,dam)
            iterate_actor_var(0, 0) do |actor|
            next if actor.dead?
              actor.change_hp(value, -dam)
              actor.perform_collapse_effect if actor.dead?
            end
            SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
            
            s = Jump::FSE
            o = [RPG::MoveCommand.new(41,Jump::FALL),RPG::MoveCommand.new(44,[s]),RPG::MoveCommand.new(0)]
            fall_move(o)
            wait(60)
    
    
            
            
          else
            s = Jump::FSE
            o = [RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(44,[s]),RPG::MoveCommand.new(14,[r,i]),RPG::MoveCommand.new(0)]
            fall_move(o)
          end
          refresh
          
          
          
          
          $game_variables[Jump::V] = 0
          
        end
         
      
      
      end
    end
    
    class Game_Map
      def iswall(id)
        for n in Jump::WALL
            if n == id
                 return 1
            end
        end
        return 0
      end
      def isrope(id)
        for n in Jump::ROPE
            if n == id
                return 1
            end
        end
        return 0
      end
      
      alias lisa_passable passable?
      def passable?(x, y, d)
        if d ==4 or d == 6
          id=region_id(x,y)
          i = iswall(id)
          return false if i == 1
        end
        s = $game_player.direction
        if s == 2 or s == 8
          id =region_id(x, y)
          j = isrope(id)
          if j == 1
            return true
          end
          id =region_id(x, y + 1)
          j = isrope(id)
          if j == 1
            return true
          end
          id =region_id(x, y - 1)
          j = isrope(id)
          if j == 1
            return true
          end
          return false
        end
       
    
        lisa_passable(x, y, d)
      end
    end
    




    用区域编号标出绳子与陆地实体即可(大概)
    这玩意运行起来是这种效果

    菜鸟之作,请轻喷


    最后祝您身体健康,再见




    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-1-16 00:48 , Processed in 0.076349 second(s), 60 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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