设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 5033|回复: 12

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
635
在线时间
24 小时
注册时间
2020-4-22
帖子
29
发表于 2020-7-11 15:21:37 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 一般通过鸦天狗 于 2020-10-6 19:48 编辑

LISA the Painful 是一款深受老美喜爱的rpg游戏,其作者使用RM的方式让人不得不惊叹
而原作中的物理系统完全是靠事件复制粘贴而成,过程繁琐,常常让同人作者苦不堪言
此脚本旨在模仿LISA游戏中的坠落,攀爬以及跳跃等系统,抛砖引玉,为广大(?)热爱LISA的同人作者提供便利
2020.10.6更新 修改了若干bug
其实早就写完了,想和游戏一块发布,奈何制作水平着急,还是发了算了

  1. =begin
  2. LISA物理系统脚本 V1.5
  3. By 炽天之咸鱼裁决
  4. 修复了成吨bug
  5. =end
  6. #使用方法,创建一个并行事件,输入脚本"lisajump(X)",X为玩家奔跑时跳跃的最大距离
  7. module Jump
  8.   #=============Run/On bike====================================
  9.   #自行车开关ID
  10.   #不需要就写"nil"
  11.   BIKE = nil
  12.   #自行车/奔跑图像
  13.   RUN = ["$Brad bike",0]
  14.   #自行车/奔跑时的跳跃图像
  15.   RUNJUMP = ["$Brad bike",0]
  16.   #自行车/奔跑时的跳崖图像
  17.   LRUNFALL = ["$Brad bike jump L",0]
  18.   RRUNFALL = ["$Brad bike jump R",0]
  19.   #自行车/奔跑时的摔倒图像
  20.   BIKEFALL = ["$Brad fall bike",0]
  21.   #掉落高度 => 伤害
  22.   RLIST = {0 => 0,
  23.           5 => 10}
  24.   #自行车/奔跑时的攀爬图像
  25.   RROPEP = ["$Brad rope bike",0]
  26.   #=================================================================
  27.   #绳子区域编号
  28.   ROPE = [18]
  29.   #爬绳贴图
  30.   ROPEP = ["$Brad rope",0]
  31.   #陆地区域编号
  32.   LAND = [1,2,5,7]
  33.   #跳跃贴图
  34.   PIC = ["$Brad Jump1eye",0]
  35.   #行走贴图
  36.   WALK = ["Brad",2]
  37.   #摔倒贴图
  38.   FALL = ["$Brad fall 1eye",0]
  39.   #掉落高度 => 伤害
  40.   LIST = {0 => 0,
  41.           3 => 10}
  42.   #受到的伤害 => 动画
  43.   EXLIST =  {0 => 1,
  44.           10 => 106}
  45.   #跳跃音效与受伤音效
  46.   FSE = RPG::SE.new("Rustle", 70, 150)
  47.   DSE = RPG::SE.new("Earth5", 70, 150)
  48.   #空变量ID
  49.   V = 66
  50.   #=================================================================
  51.   #空气墙ID
  52.   WALL = [48]
  53. end










  54. #========================================以下勿动===============================
  55. class Game_Player < Game_Character
  56.   def move_by_input
  57.     return if !movable? || $game_map.interpreter.running? || $game_variables[Jump::V] == 1
  58.     move_straight(Input.dir4) if Input.dir4 > 0
  59.   end
  60. end

  61. class Game_Player < Game_Character
  62.   
  63.   def getX
  64.     @x
  65.   end
  66.   
  67.   def getY
  68.     @y
  69.   end
  70.   
  71. end


  72. class Game_Player < Game_Character
  73.   def dash?
  74.     if Jump::BIKE != nil
  75.       if $game_switches[Jump::BIKE] == true
  76.         return true
  77.       else
  78.         return false
  79.       end
  80.     else
  81.       return false if $game_map.disable_dash?
  82.       return false if vehicle
  83.       return Input.press?(:A)
  84.     end
  85.   end
  86. end
  87.   
  88.   
  89.    

  90. class Game_Interpreter
  91.   attr_accessor :rg
  92.   attr_accessor :bike
  93.   alias lisa_initialize initialize
  94.   def initialize(depth = 0)
  95.     @rg = 0
  96.     @bike = 1
  97.     lisa_initialize(depth = 0)
  98.   end
  99.   
  100.   def rush
  101.     if Input.press?(:A)
  102.       if Jump::BIKE != nil
  103.         if $game_switches[Jump::BIKE] == true
  104.         $game_switches[Jump::BIKE] = false
  105.         end
  106.       end
  107.     end
  108.   end

  109.   
  110.   def island(id)
  111.     for n in Jump::LAND
  112.         if n == id
  113.              return 1
  114.         end
  115.     end
  116.     return 0
  117.   end
  118.   def isrope(id)
  119.     for n in Jump::ROPE
  120.         if n == id
  121.              return 1
  122.         end
  123.     end
  124.     return 0
  125.   end
  126.   def refresh
  127.     i = [0,0]
  128.     x = $game_player.x
  129.     y = $game_player.y
  130.     id=$game_map.region_id(x, y)
  131.     i[1] = isrope(id)
  132.     i[0] = island(id)
  133.     if i[0] == 1
  134.       if $game_player.direction == 8
  135.         id2=$game_map.region_id(x, y - 1)
  136.         j = isrope(id2)
  137.         if j == 1
  138.           i = [0,1]
  139.         end
  140.       end
  141.     elsif i[1] == 1
  142.       if $game_player.direction == 2
  143.         id2=$game_map.region_id(x, y + 1)
  144.         j = island(id2)
  145.         if j == 1
  146.           i = [1,0]
  147.         end
  148.       end
  149.     end
  150.     if i[1] == 1
  151.       if $game_player.dash?
  152.         p = Jump::RROPEP
  153.       else
  154.         p = Jump::ROPEP
  155.       end
  156.       o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(0)]
  157.       fall_move(o)
  158.     elsif i[0] == 1
  159.       if $game_player.dash?
  160.         p = Jump::RUN
  161.       else
  162.         p = Jump::WALK
  163.       end
  164.       o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(0)]
  165.       fall_move(o)
  166.     end
  167.     @rg = id
  168.   end
  169.   def rope()
  170.     if $game_variables[Jump::V] == 1
  171.       return
  172.     end
  173.     if $game_player.dash?
  174.       b = 1
  175.     else
  176.       b = 0
  177.     end
  178.     refresh if @bike != b
  179.     @bike = b
  180.     i = [0,0]
  181.     x = $game_player.x
  182.     y = $game_player.y
  183.     id=$game_map.region_id(x, y)
  184.     return if id == @rg
  185.     refresh
  186.     @rg = id
  187.   end
  188.    
  189.   
  190.    
  191.   
  192.   
  193.   def lisajump(i)
  194.     return if $game_player.move_route_forcing
  195.     rush
  196.     fall(i)
  197.     jumpupanddown()
  198.     rope()
  199.   end
  200.   
  201.   
  202.   
  203.   def jumpjump(i)
  204.       $game_variables[Jump::V] = 1
  205.       if $game_player.dash?
  206.         p = Jump::RUNJUMP
  207.       else
  208.         p = Jump::PIC
  209.       end
  210.       if $game_player.dash?
  211.         w = Jump::RUN
  212.       else
  213.         w = Jump::WALK
  214.       end
  215.       Jump::FSE.play
  216.       o = [RPG::MoveCommand.new(41,p),RPG::MoveCommand.new(14,[0,-i]),RPG::MoveCommand.new(0)]
  217.       fall_move(o)
  218.       o = [RPG::MoveCommand.new(41,w),RPG::MoveCommand.new(0)]
  219.       fall_move(o)
  220.       $game_variables[Jump::V] = 0
  221.   end
  222.   
  223.   def jumpupanddown()
  224.     if $game_variables[Jump::V] == 1
  225.       return
  226.     end
  227.     i=0
  228.     j=0
  229.     if Input.press?(:UP) and Input.press?(:C)
  230.       x = $game_player.getX
  231.       y = $game_player.getY
  232.       if $game_map.valid?(x, y - 1) == true
  233.         id1=$game_map.region_id(x, y)
  234.         id2=$game_map.region_id(x, y - 1)

  235.         for n in Jump::LAND
  236.           if n == id1
  237.              i = 1
  238.           end
  239.           if n == id2
  240.              j = 1
  241.           end
  242.         end
  243.         k = i * j
  244.         
  245.         for n in Jump::ROPE
  246.           if n == id1 or n == id2
  247.             k = 0
  248.           end
  249.         end
  250.         
  251.         
  252.         if k == 1
  253.           jumpjump(1)
  254.         end
  255.         
  256.       end
  257.     end
  258.    
  259.     if Input.press?(:DOWN) and Input.press?(:C)
  260.     x = $game_player.getX
  261.     y = $game_player.getY
  262.     if $game_map.valid?(x, y + 1) == true
  263.       id1=$game_map.region_id(x, y)
  264.       id2=$game_map.region_id(x, y + 1)
  265.       for n in Jump::LAND
  266.         if n == id1
  267.             i = 1
  268.         end
  269.         if n == id2
  270.             j = 1
  271.         end
  272.       end
  273.       k = i * j
  274.       if k == 1
  275.         jumpjump(-1)
  276.       end
  277.       end
  278.     end


  279.   end
  280.   
  281.   
  282.   def fall_move(x)
  283.       point = $game_player
  284.       r = RPG::MoveRoute.new
  285.       r.repeat = false
  286.       r.skippable = true
  287.       r.wait = true
  288.       r.list = x
  289.       point.force_move_route(r)
  290.       if r.wait
  291.         Fiber.yield while point.move_route_forcing
  292.       end
  293.   end
  294.    
  295.    
  296.   def checkdirection(x)
  297.     r = x
  298.     if $game_player.direction == 4
  299.       r = -r
  300.     end
  301.     return r
  302.   end
  303.   
  304.   
  305.   def findpoint(f)
  306.     x = $game_player.getX
  307.     y = $game_player.getY
  308.     r = f
  309.     i = -1
  310.     d = 0
  311.     while true
  312.         i += 1
  313.         j = 1
  314.         while j <= r
  315.           if $game_player.dash?
  316.             t = checkdirection(j)
  317.           else
  318.             t = 0
  319.             j = r
  320.           end
  321.           id = $game_map.region_id(x + t, y + i)
  322.           for n in Jump::LAND
  323.             if n == id
  324.               return [t,i,0]
  325.             end
  326.           end
  327.           j += 1
  328.         end
  329.         if $game_map.valid?(x + t, y + i) == false
  330.           i = -1
  331.           while true
  332.             i += 1
  333.             id = $game_map.region_id(x, y + i)
  334.             for n in Jump::LAND
  335.               if n == id
  336.                 return [0,i,0]
  337.               end
  338.             end
  339.             t = checkdirection(1)
  340.             return [t,i,1] if $game_map.valid?(x, y + i) == false
  341.           end
  342.         end
  343.       end
  344.   end
  345.   
  346.   
  347.   def fall(f)
  348.    
  349.     if $game_variables[Jump::V] == 1
  350.       return
  351.     end
  352.    
  353.     x = $game_player.getX
  354.     y = $game_player.getY
  355.    
  356.     q = 0
  357.     p = $game_map.region_id(x, y)
  358.    
  359.     for n in Jump::LAND
  360.       if n == p
  361.           q=1
  362.       end
  363.     end
  364.    
  365.     for n in Jump::ROPE
  366.       if n == p
  367.         q=1
  368.       end
  369.     end
  370.    
  371.    
  372.     if q == 0
  373.       $game_variables[Jump::V] = 1
  374.       a = findpoint(f)
  375.       r = a[0]
  376.       i = a[1]
  377.       d = a[2]
  378.       
  379.       
  380.       if $game_player.dash?
  381.         if $game_player.direction == 6
  382.           igf = Jump::RRUNFALL
  383.         else
  384.           igf = Jump::LRUNFALL
  385.         end
  386.       else
  387.         igf = Jump::PIC
  388.       end
  389.       
  390.       
  391.       if d == 1
  392.         s = Jump::FSE
  393.         o = [RPG::MoveCommand.new(44,[s]),RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(14,[r,i-1]),RPG::MoveCommand.new(0)]
  394.         fall_move(o)
  395.         SceneManager.goto(Scene_Gameover)
  396.         return
  397.       end
  398.       
  399.       if $game_player.dash?
  400.         lst= Jump::RLIST
  401.       else
  402.         lst= Jump::LIST
  403.       end
  404.       
  405.       f = 0
  406.       dam = 0
  407.       while f < i
  408.         f += 1
  409.         if lst[f] != nil
  410.           dam = lst[f]
  411.         end
  412.       end
  413.       
  414.      

  415.       
  416.       

  417.       
  418.       if dam!=0 and Jump::EXLIST[dam] != nil
  419.         
  420.         
  421.         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)]
  422.         fall_move(o)

  423.         
  424.         $game_player.animation_id = Jump::EXLIST[dam]
  425.         
  426.         value = operate_value(1,0,dam)
  427.         iterate_actor_var(0, 0) do |actor|
  428.         next if actor.dead?
  429.           actor.change_hp(value, -dam)
  430.           actor.perform_collapse_effect if actor.dead?
  431.         end
  432.         SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
  433.         
  434.         s = Jump::FSE
  435.         o = [RPG::MoveCommand.new(41,Jump::FALL),RPG::MoveCommand.new(44,[s]),RPG::MoveCommand.new(0)]
  436.         fall_move(o)
  437.         wait(60)


  438.         
  439.         
  440.       else
  441.         s = Jump::FSE
  442.         o = [RPG::MoveCommand.new(41,igf),RPG::MoveCommand.new(44,[s]),RPG::MoveCommand.new(14,[r,i]),RPG::MoveCommand.new(0)]
  443.         fall_move(o)
  444.       end
  445.       refresh
  446.       
  447.       
  448.       
  449.       
  450.       $game_variables[Jump::V] = 0
  451.       
  452.     end
  453.      
  454.   
  455.   
  456.   end
  457. end

  458. class Game_Map
  459.   def iswall(id)
  460.     for n in Jump::WALL
  461.         if n == id
  462.              return 1
  463.         end
  464.     end
  465.     return 0
  466.   end
  467.   def isrope(id)
  468.     for n in Jump::ROPE
  469.         if n == id
  470.             return 1
  471.         end
  472.     end
  473.     return 0
  474.   end
  475.   
  476.   alias lisa_passable passable?
  477.   def passable?(x, y, d)
  478.     if d ==4 or d == 6
  479.       id=region_id(x,y)
  480.       i = iswall(id)
  481.       return false if i == 1
  482.     end
  483.     s = $game_player.direction
  484.     if s == 2 or s == 8
  485.       id =region_id(x, y)
  486.       j = isrope(id)
  487.       if j == 1
  488.         return true
  489.       end
  490.       id =region_id(x, y + 1)
  491.       j = isrope(id)
  492.       if j == 1
  493.         return true
  494.       end
  495.       id =region_id(x, y - 1)
  496.       j = isrope(id)
  497.       if j == 1
  498.         return true
  499.       end
  500.       return false
  501.     end
  502.    

  503.     lisa_passable(x, y, d)
  504.   end
  505. end
复制代码

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

菜鸟之作,请轻喷


最后祝您身体健康,再见

仅供参考

仅供参考

评分

参与人数 3+3 收起 理由
KB.Driver + 1 好帖,请继续努力
开关关 + 1 牛顿落泪
zyf722 + 1 塞糖

查看全部评分

Lv6.析梦学徒

老鹰

梦石
39
星屑
33308
在线时间
6542 小时
注册时间
2012-5-26
帖子
3176

极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

发表于 2020-7-11 15:35:11 | 显示全部楼层
你可以上传一个范例的gif,这样更清晰一点

一个简单的Gif录制工具:https://www.lanzoux.com/iWfuaeihk2b
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
635
在线时间
24 小时
注册时间
2020-4-22
帖子
29
 楼主| 发表于 2020-7-11 15:52:21 | 显示全部楼层
百里_飞柳 发表于 2020-7-11 15:35
你可以上传一个范例的gif,这样更清晰一点

一个简单的Gif录制工具:https://www.lanzoux.com/iWfuaeihk2b ...

我录了个视频,奈何上传不了
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
686
在线时间
72 小时
注册时间
2012-2-26
帖子
60
发表于 2020-7-13 11:36:41 | 显示全部楼层
哈哈,看到小老头真的笑死了。
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv4.逐梦者 (禁止发言)

梦石
0
星屑
5701
在线时间
922 小时
注册时间
2013-8-29
帖子
1468
发表于 2020-7-13 14:42:25 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
635
在线时间
24 小时
注册时间
2020-4-22
帖子
29
 楼主| 发表于 2020-7-13 15:20:00 | 显示全部楼层
本帖最后由 一般通过鸦天狗 于 2020-7-13 15:25 编辑
chanszeman1018 发表于 2020-7-13 14:42
未跌落谷底就GameOver是什么玩法


默认为掉落至地图边缘判断死亡,某些特殊地图可以不使用脚本,用原版的事件法完成
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
635
在线时间
24 小时
注册时间
2020-4-22
帖子
29
 楼主| 发表于 2020-8-2 16:10:06 | 显示全部楼层
8月2日更新:加入了奔跑/自行车功能,可以自定义玩家跳跃距离
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1249
在线时间
69 小时
注册时间
2019-2-12
帖子
98
发表于 2020-8-2 21:53:44 | 显示全部楼层
怎么说,想来想去这Lisa游戏确实还不错qwq
正想做这种游戏的 就出现这个帖子







爱了爱了,白票了
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
635
在线时间
24 小时
注册时间
2020-4-22
帖子
29
 楼主| 发表于 2020-8-3 23:11:02 | 显示全部楼层
小姐姐一个 发表于 2020-8-2 21:53
怎么说,想来想去这Lisa游戏确实还不错qwq
正想做这种游戏的 就出现这个帖子

Lisa原作已经完结多年,但是其同人创作一直在活跃,老美搞了很多,但是仍然用着原作那种低效的复制粘贴
我也是由于制作游戏过于繁琐于是写了这个,要怪就怪DINGALING当年缝缝补补的制作方式
如果有兴趣可以加群644083671共同分享制作经验
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24047
在线时间
4983 小时
注册时间
2016-3-8
帖子
1613
发表于 2020-8-3 23:29:48 | 显示全部楼层
这个与Arc Engine比较,那个好
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-3-28 21:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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