Project1

标题: 求教一下制作地面机关的问题 [打印本页]

作者: 踢腿水上飘    时间: 2016-7-13 13:11
标题: 求教一下制作地面机关的问题
我想在迷宫里做一个机关,就是每隔几秒在某个地点冒个地刺出来,然后又缩回去,如果冒出来的时候人正好站在上面就会受伤
怎么设置都不行,特地求教一下,怎么弄这个……
作者: duzine    时间: 2016-7-13 15:42
首先你需要這個腳本
然後!

設定兩個事件,一個是並行處理,一個是你的陷阱
並行處理使用腳本 輸入$game_self_switches[[地圖編號 , 陷阱事件編號 , "獨立開關"]] = true
打開你陷阱的獨立開關,假設是獨立開關A  會是令人受傷的尖刺,那麼 輸入 $game_self_switches[[地圖編號 , 陷阱事件編號 , "A"]] = true
假設這是第1張地圖,陷阱是第2個事件,那就 輸入 $game_self_switches[[1 , 2 , "A"]] = true
執行完畢後,接著等待幾秒(看你),再次使用腳本 輸入 $game_self_switches[[地圖編號 , 陷阱事件編號 , "A"]] = false
這樣就會關閉獨立開關A

設定好以後,我們回來看看陷阱,獨立開關A還沒打開時,陷阱不會害人,打開則反之



RUBY 代码复制
  1. #-------------------------------------------------------------------------------
  2. # * Khas Self Switches
  3. #-------------------------------------------------------------------------------
  4. # * By Khas Arcthunder
  5. # * Version: 1.0
  6. # * Released on: 11/09/2012
  7. #
  8. # * Blog: [url]http://arcthunder.com/[/url]
  9. # * Forum: [url]http://rgssx.com/[/url]
  10. # * Twitter: [url]http://twitter.com/arcthunder[/url]
  11. # * Youtube: [url]http://youtube.com/user/darkkhas[/url]
  12. #
  13. #-------------------------------------------------------------------------------
  14. # Terms of Use | Termos de Uso
  15. #-------------------------------------------------------------------------------
  16. # * ENGLISH
  17. # Read updated terms of use at [url]http://arcthunder.com/terms[/url]
  18. #
  19. # * PORTUGUES
  20. # Leia os termos atualizados em [url]http://arcthunder.com/termos[/url]
  21. #
  22. #-------------------------------------------------------------------------------
  23. # How to use - English Instructions
  24. #-------------------------------------------------------------------------------
  25. # You can use Call Script with the following commands:
  26. #
  27. # Switch_Core.toggle(event_id,switch)
  28. # Toggle a switch. If it's ON, this command will turn it to OFF. And if it's
  29. # OFF, this command will turn it to ON.
  30. # event_id -> The ID of the event
  31. # switch -> Can be "A", "B", "C" or "D"
  32. #
  33. # Switch_Core.toggle(event_id,switch,map_id)
  34. # Toggle a switch. If it's ON, this command will turn it to OFF. And if it's
  35. # OFF, this command will turn it to ON.
  36. # event_id -> The ID of the event
  37. # switch -> Can be "A", "B", "C" or "D"
  38. # map_id -> ID of the map
  39. #
  40. # Switch_Core.turn_on(event_id,switch)
  41. # Turn ON command.
  42. # event_id -> The ID of the event
  43. # switch -> Can be "A", "B", "C" or "D"
  44. #
  45. # Switch_Core.turn_on(event_id,switch,map_id)
  46. # Turn ON command.
  47. # event_id -> The ID of the event
  48. # switch -> Can be "A", "B", "C" or "D"
  49. # map_id -> ID of the map
  50. #
  51. # Switch_Core.turn_off(event_id,switch)
  52. # Turn OFF command.
  53. # event_id -> The ID of the event
  54. # switch -> Can be "A", "B", "C" or "D"
  55. #
  56. # Switch_Core.turn_off(event_id,switch,map_id)
  57. # Turn OFF command.
  58. # event_id -> The ID of the event
  59. # switch -> Can be "A", "B", "C" or "D"
  60. # map_id -> ID of the map
  61. #
  62. # Switch_Core.set(event_id,switch,value)
  63. # Set command. If value is true, it will be turned ON. If value is false,
  64. # it will be turned OFF.
  65. # event_id -> The ID of the event
  66. # switch -> Can be "A", "B", "C" or "D"
  67. # value -> Can be true or false
  68. #
  69. # Switch_Core.set(event_id,switch,value,map_id)
  70. # Set command. If value is true, it will be turned ON. If value is false,
  71. # it will be turned OFF.
  72. # event_id -> The ID of the event
  73. # switch -> Can be "A", "B", "C" or "D"
  74. # value -> Can be true or false
  75. # map_id -> ID of the map
  76. #
  77. #-------------------------------------------------------------------------------
  78. #
  79. # Switch_Core.toggle_all(event_id)
  80. # Toggle all the event's self switches.
  81. # event_id -> The ID of the event
  82. #
  83. # Switch_Core.toggle_all(event_id,map_id)
  84. # Toggle all the event's self switches.
  85. # event_id -> The ID of the event
  86. # map_id -> ID of the map
  87. #
  88. # Switch_Core.turn_on_all(event_id)
  89. # Turn ON all the event's self switches.
  90. # event_id -> The ID of the event
  91. #
  92. # Switch_Core.turn_on_all(event_id,map_id)
  93. # Turn ON all the event's self switches.
  94. # event_id -> The ID of the event
  95. # map_id -> ID of the map
  96. #
  97. # Switch_Core.turn_off_all(event_id)
  98. # Turn OFF all the event's self switches.
  99. # event_id -> The ID of the event
  100. #
  101. # Switch_Core.turn_off_all(event_id,map_id)
  102. # Turn OFF all the event's self switches.
  103. # event_id -> The ID of the event
  104. # map_id -> ID of the map
  105. #
  106. # Switch_Core.set_all(event_id,value)
  107. # Set all command. If value is true, all self switches will be turned ON. If  
  108. # value is false, all self switches will be turned OFF.
  109. # event_id -> The ID of the event
  110. # value -> Can be true or false
  111. #
  112. # Switch_Core.set_all(event_id,value,map_id)
  113. # Set all command. If value is true, all self switches will be turned ON. If  
  114. # value is false, all self switches will be turned OFF.
  115. # event_id -> The ID of the event
  116. # value -> Can be true or false
  117. # map_id -> ID of the map
  118. #
  119. #-------------------------------------------------------------------------------
  120. # Como usar - Instruções em Português
  121. #-------------------------------------------------------------------------------
  122. # Você pode usar o Chamar Script com os seguintes comandos:
  123. #
  124. # Switch_Core.toggle(event_id,switch)
  125. # Alterna o switch. Se ele estiver ligado, será então desligado. Se ele estiver
  126. # ligado, será então desligado.
  127. # event_id -> O ID do evento
  128. # switch -> Pode ser "A", "B", "C" ou "D"
  129. #
  130. # Switch_Core.toggle(event_id,switch,map_id)
  131. # Alterna o switch. Se ele estiver ligado, será então desligado. Se ele estiver
  132. # ligado, será então desligado.
  133. # event_id -> O ID do evento
  134. # switch -> Pode ser "A", "B", "C" ou "D"
  135. # map_id -> ID do Mapa
  136. #
  137. # Switch_Core.turn_on(event_id,switch)
  138. # Comando que liga o switch.
  139. # event_id -> O ID do evento
  140. # switch -> Pode ser "A", "B", "C" ou "D"
  141. #
  142. # Switch_Core.turn_on(event_id,switch,map_id)
  143. # Comando que liga o switch.
  144. # event_id -> O ID do evento
  145. # switch -> Pode ser "A", "B", "C" ou "D"
  146. # map_id -> ID do Mapa
  147. #
  148. # Switch_Core.turn_off(event_id,switch)
  149. # Comando que desliga o switch.
  150. # event_id -> O ID do evento
  151. # switch -> Pode ser "A", "B", "C" ou "D"
  152. #
  153. # Switch_Core.turn_off(event_id,switch,map_id)
  154. # Comando que desliga o switch.
  155. # event_id -> O ID do evento
  156. # switch -> Pode ser "A", "B", "C" ou "D"
  157. # map_id -> ID do Mapa
  158. #
  159. # Switch_Core.set(event_id,switch,value)
  160. # Comando que ajusta o switch. Se value for true, o switch será ligado. Se
  161. # value for false, o switch será desligado.
  162. # event_id -> O ID do evento
  163. # switch -> Pode ser "A", "B", "C" ou "D"
  164. # value -> Pode ser true ou false
  165. #
  166. # Switch_Core.set(event_id,switch,value,map_id)
  167. # Comando que ajusta o switch. Se value for true, o switch será ligado. Se
  168. # value for false, o switch será desligado.
  169. # event_id -> O ID do evento
  170. # switch -> Pode ser "A", "B", "C" ou "D"
  171. # value -> Pode ser true ou false
  172. # map_id -> ID do Mapa
  173. #
  174. #-------------------------------------------------------------------------------
  175. #
  176. # Switch_Core.toggle_all(event_id)
  177. # Alterna todos os switches locais do evento.
  178. # event_id -> O ID do evento
  179. #
  180. # Switch_Core.toggle_all(event_id,map_id)
  181. # Alterna todos os switches locais do evento.
  182. # event_id -> O ID do evento
  183. # map_id -> ID do Mapa
  184. #
  185. # Switch_Core.turn_on_all(event_id)
  186. # Liga todos os switches do evento.
  187. # event_id -> O ID do evento
  188. #
  189. # Switch_Core.turn_on_all(event_id,map_id)
  190. # Liga todos os switches do evento.
  191. # event_id -> O ID do evento
  192. # map_id -> ID do Mapa
  193. #
  194. # Switch_Core.turn_off_all(event_id)
  195. # Desliga todos os switches do evento.
  196. # event_id -> O ID do evento
  197. #
  198. # Switch_Core.turn_off_all(event_id,map_id)
  199. # Desliga todos os switches do evento.
  200. # event_id -> O ID do evento
  201. # map_id -> ID do Mapa
  202. #
  203. # Switch_Core.set_all(event_id,value)
  204. # Ajusta todos os switches do evento.
  205. # event_id -> O ID do evento
  206. # value -> Pode ser true ou false
  207. #
  208. # Switch_Core.set_all(event_id,value,map_id)
  209. # Ajusta todos os switches do evento.
  210. # event_id -> O ID do evento
  211. # value -> Pode ser true ou false
  212. # map_id -> ID do Mapa
  213. #
  214. #-------------------------------------------------------------------------------
  215. # Script
  216. #-------------------------------------------------------------------------------
  217. module Switch_Core
  218.   Switch_Array = ["A","B","C","D"]
  219.   def self.toggle(ei,si,mi=$game_map.map_id)
  220.     $game_self_switches[[mi,ei,si]] = !$game_self_switches[[mi,ei,si]]
  221.   end
  222.   def self.turn_on(ei,si,mi=$game_map.map_id)
  223.     $game_self_switches[[mi,ei,si]] = true
  224.   end
  225.   def self.turn_off(ei,si,mi=$game_map.map_id)
  226.     $game_self_switches[[mi,ei,si]] = false
  227.   end
  228.   def self.set(ei,si,pi,mi=$game_map.map_id)
  229.     $game_self_switches[[mi,ei,si]] = pi
  230.   end
  231.   def self.toggle_all(ei,mi=$game_map.map_id)
  232.     Switch_Array.each {|key| toggle(ei,key,mi)}
  233.   end
  234.   def self.turn_on_all(ei,mi=$game_map.map_id)
  235.     Switch_Array.each {|key| turn_on(ei,key,mi)}
  236.   end
  237.   def self.turn_off_all(ei,mi=$game_map.map_id)
  238.     Switch_Array.each {|key| turn_off(ei,key,mi)}
  239.   end
  240.   def self.set_all(ei,pi,mi=$game_map.map_id)
  241.     Switch_Array.each {|key| set(ei,key,pi,mi)}
  242.   end
  243. end

作者: 踢腿水上飘    时间: 2016-7-14 07:56
duzine 发表于 2016-7-13 15:42
首先你需要這個腳本
然後!

谢谢啦~~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1