nmkin_3.lua 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. EntityContainer = {}
  2. EntityContainer[ "Director" ] = {
  3. on_start = function( self )
  4. background2d:autoscroll_to_entity( entity_manager:get_entity( "Cloud" ) )
  5. script:request( Script.ENTITY, "Director", "main", 6 )
  6. return 0
  7. end,
  8. main = function( self )
  9. while true do
  10. if FFVII.Data.progress_game >= 64 then
  11. break
  12. end
  13. if EntityContainer[ "Cloud" ].cloud ~= nil then
  14. local triangle_id = EntityContainer[ "Cloud" ].cloud:get_move_triangle_id()
  15. --[[ Climbing up the 1st ladder ]]
  16. if ( FFVII.Data.moving_linear == false ) and ( triangle_id == 28 ) then
  17. -- The entities have to be slightly "inside" the walkmesh for the above statement to be true
  18. FFVII.Data.moving_linear = true -- This prevents this area from being executed constantly while player is in the walkmesh triangle
  19. script:request( Script.ENTITY, "Cloud", "climb_ladder_1", 6 )
  20. FFVII.Data.moving_linear = false
  21. end
  22. if ( FFVII.Data.moving_jump == false ) and ( triangle_id == 39 ) then
  23. -- The entities have to be slightly "inside" the walkmesh for the above statement to be true
  24. FFVII.Data.moving_jump = true -- This prevents this area from being executed constantly while player is in the walkmesh triangle
  25. script:request( Script.ENTITY, "Cloud", "jumpto_right", 6 )
  26. FFVII.Data.moving_jump = false
  27. end
  28. if ( FFVII.Data.moving_jump == false ) and ( triangle_id == 42 ) then
  29. -- The entities have to be slightly "inside" the walkmesh for the above statement to be true
  30. FFVII.Data.moving_jump = true -- This prevents this area from being executed constantly while player is in the walkmesh triangle
  31. script:request( Script.ENTITY, "Cloud", "jumpto_left", 6 )
  32. FFVII.Data.moving_jump = false
  33. end
  34. end
  35. script:wait( 0 )
  36. end
  37. return 0
  38. end,
  39. }
  40. EntityContainer[ "Cloud" ] = {
  41. cloud = nil,
  42. on_start = function( self )
  43. set_entity_to_character( "Cloud", "Cloud" )
  44. self.cloud = entity_manager:get_entity( "Cloud" )
  45. entity_manager:set_player_entity( "Cloud" )
  46. self.cloud:set_solid( true )
  47. self.cloud:set_visible( true )
  48. return 0
  49. end,
  50. --[[ Main script ]]
  51. main = function( self )
  52. return 0
  53. end,
  54. --[[ Climb up ladder at top of reactor. ]]
  55. climb_ladder_1 = function( self )
  56. --05af (end 05af): temp5_12 = 1;
  57. player_lock( true )
  58. --entity_manager:unset_player_entity()
  59. self.cloud:set_solid( false )
  60. --05b5 (end 05b5): field:menu_lock(true);
  61. --05b7 (end 05b7): music:execute_akao( 20, 40, 15 ); -- play sound
  62. --self.cloud:set_solid_radius( 1 );
  63. --self.cloud:move_to_position( -1.30469, 14.1875 ) -- REIMPLEMENT
  64. --self.cloud:move_to_position( -1.30469, 14.1875 ) --Bad movement (gets stuck on the walkmesh)
  65. --self.cloud:move_sync() -- REIMPLEMENT
  66. --self.cloud:set_solid_radius( 30 );
  67. player_lock( false )
  68. --05ca (end 05ca): field:menu_lock(false);
  69. self.cloud:set_rotation( 90 )
  70. self.cloud:linear_to_position( 1.78125, 14.625, 17.2969, Entity.DOWN_TO_UP, "Climb" ); -- direction needs to be seted to "90" and animation during climbing is "5" with speed "1"
  71. self.cloud:linear_sync()
  72. player_lock( true )
  73. self.cloud:set_rotation( 90 )
  74. self.cloud:move_auto_animation( false )
  75. self.cloud:play_animation_stop( "Jump" )
  76. script:wait( 0.5 ) -- wait to start of jump in animation
  77. self.cloud:jump_to_position( 1.54, 14.87, 17.2969, 0.567 ) -- triangle 24
  78. self.cloud:jump_sync()
  79. script:wait( 0.667 ) -- wait to end of animation
  80. self.cloud:move_auto_animation( true )
  81. --05dd (end 05dd): field:menu_lock(true);
  82. --05df (end 05df): temp6_07 = cl:get_x();
  83. --temp6_09 = cl:get_y();
  84. --temp6_0b = cl:get_z();
  85. --temp6_00 = cl:get_move_triangle_id();
  86. --05e7 (end 05e7): if ( temp6_0b > 1792 ) then continue else jumpto(060e);
  87. --05ef (end 060e): field:pc_lock(true);
  88. --05f1 (end 060e): field:menu_lock(true);
  89. --05f3 (end 060e): cl:set_direction( 180 )
  90. --05f6 (end 060e): cl:play_animation( "4", 0.5, 2.3, 1, true );
  91. --05fb (end 060e): music:execute_akao( 20, 40, 3e ); -- play sound
  92. --0600 (end 060e): cl:jump_to_position( 194, 1925, 7, 0.566667 );
  93. --060b (end 060e): script:wait( 0.666667 )
  94. --060e (end 060e): cl:set_default_animation( "0" ) -- speed=1
  95. -- cl:play_animation( "0" )
  96. --0611 (end 0611): field:pc_lock(false);
  97. --0613 (end 0613): field:menu_lock(false);
  98. --0615 (end 0615): return
  99. self.cloud:set_solid( true )
  100. player_lock( false )
  101. return 0
  102. end,
  103. jumpto_right = function( self )
  104. player_lock( true )
  105. self.cloud:set_solid( false )
  106. self.cloud:set_rotation( 90 )
  107. self.cloud:move_auto_animation( false )
  108. self.cloud:play_animation_stop( "Jump" )
  109. script:wait( 0.5 ) -- wait to start of jump in animation
  110. self.cloud:jump_to_position( 0.386, 14.94, 17.2969, 0.567 ) -- triangle 24
  111. self.cloud:jump_sync()
  112. script:wait( 0.667 ) -- wait to end of animation
  113. self.cloud:move_auto_animation( true )
  114. self.cloud:set_solid( true )
  115. player_lock( false )
  116. return 0
  117. end,
  118. jumpto_left = function( self )
  119. player_lock( true )
  120. self.cloud:set_solid( false )
  121. self.cloud:set_rotation( 90 )
  122. self.cloud:move_auto_animation( false )
  123. self.cloud:play_animation_stop( "Jump" )
  124. script:wait( 0.5 ) -- wait to start of jump in animation
  125. self.cloud:jump_to_position( -2.89844, 15.3047, 16.5391, 0.567 ) -- triangle 24
  126. self.cloud:jump_sync()
  127. script:wait( 0.667 ) -- wait to end of animation
  128. self.cloud:move_auto_animation( true )
  129. self.cloud:set_solid( true )
  130. player_lock( false )
  131. return 0
  132. end,
  133. }
  134. EntityContainer[ "Jessie" ] = {
  135. jessie = nil,
  136. on_start = function( self )
  137. self.jessie = entity_manager:get_entity( "Jessie" )
  138. -- assosiate entity with model (CHAR) argument doesn't matter
  139. self.jessie:set_position( -3.83594, -0.414063, 11.7188 ) -- triangle_id=72
  140. if FFVII.Data.progress_game >= 13 then
  141. self.jessie:set_talkable( false );
  142. self.jessie:set_solid( false )
  143. self.jessie:set_visible( false )
  144. end
  145. self.jessie:set_solid( false )
  146. script:request( Script.ENTITY, "Jessie", "main", 6 )
  147. return 0
  148. end,
  149. --[[ Stop breaking gate for a while and talk. ]]
  150. main = function( self )
  151. if FFVII.Data.progress_game < 13 then
  152. self.jessie:set_move_auto_speed( 2.8125 )
  153. self.jessie:move_to_position( 2.97656, -0.257813 )
  154. self.jessie:move_sync()
  155. self.jessie:move_to_position( 5.17969, 6.03906 )
  156. self.jessie:move_sync()
  157. self.jessie:move_to_position( 6.14063, 6.39063 )
  158. self.jessie:move_sync()
  159. self.jessie:set_move_auto_speed( 3.75 )
  160. FFVII.Data.progress_game = 13
  161. self.jessie:move_to_position( 6.20313, -1 )
  162. self.jessie:move_sync()
  163. self.jessie:set_move_auto_speed( 2.8125 )
  164. self.jessie:move_to_position( -6.375, -1.96875 )
  165. self.jessie:move_sync()
  166. self.jessie:set_talkable( false );
  167. self.jessie:set_solid( false )
  168. self.jessie:set_visible( false )
  169. end
  170. return 0
  171. end,
  172. }
  173. EntityContainer[ "Wedge" ] = {
  174. wedge = nil,
  175. on_start = function( self )
  176. self.wedge = entity_manager:get_entity( "Wedge" )
  177. self.wedge:set_position( 5.94141, 5.875, 5.07031 )
  178. self.wedge:set_rotation( 16.875 )
  179. self.wedge:set_default_animation( "LookAround" )
  180. self.wedge:play_animation( "LookAround" )
  181. if FFVII.Data.progress_game >= 7 then
  182. self.wedge:set_solid( false )
  183. self.wedge:set_visible( false )
  184. else
  185. self.wedge:set_solid( true )
  186. self.wedge:set_visible( true )
  187. end
  188. return 0
  189. end,
  190. scene_part_12 = function( self )
  191. self.wedge:set_move_auto_speed( 1.17187 )
  192. self.wedge:move_to_position( 4.57422, 6.82812 )
  193. self.wedge:move_sync()
  194. self.wedge:move_to_position( 5.29297, 13.1875 )
  195. self.wedge:move_sync()
  196. self.wedge:set_solid( false )
  197. self.wedge:set_visible( false )
  198. return 0
  199. end,
  200. }
  201. EntityContainer[ "DoorLeft" ] = {
  202. door = nil,
  203. on_start = function( self )
  204. self.door = entity_manager:get_entity( "DoorLeft" )
  205. self.door:set_position( 4.25, 7.20703, 5.07031 )
  206. self.door:set_rotation( 354.375 )
  207. if FFVII.Data.progress_game >= 7 then
  208. self.door:set_visible( false )
  209. else
  210. self.door:set_visible( true )
  211. end
  212. self.door:set_solid( false )
  213. return 0
  214. end,
  215. open = function( self )
  216. self.door:offset_to_position( -0.789062, 0, 0, Entity.LINEAR, 1.66667 )
  217. self.door:offset_sync()
  218. self.door:set_visible( false )
  219. return 0
  220. end,
  221. }
  222. EntityContainer[ "DoorRight" ] = {
  223. door = nil,
  224. on_start = function( self )
  225. self.door = entity_manager:get_entity( "DoorRight" )
  226. self.door:set_position( 4.93359, 7.125, 5.07031 )
  227. self.door:set_rotation( 174.375 )
  228. if FFVII.Data.progress_game >= 7 then
  229. self.door:set_visible( false )
  230. else
  231. self.door:set_visible( true )
  232. end
  233. self.door:set_solid( false )
  234. return 0
  235. end,
  236. open = function( self )
  237. self.door:offset_to_position( 0.71875, 0, 0, Entity.LINEAR, 1.66667 )
  238. self.door:offset_sync()
  239. self.door:set_visible( false )
  240. return 0
  241. end,
  242. }
  243. EntityContainer[ "Movie" ] = {
  244. movie_check = false,
  245. on_start = function( self )
  246. while true do
  247. if self.movie_check == true then
  248. --0717 (end 0729): temp6_09 = field:get_movie_frame();
  249. --071a (end 0729): if ( temp6_09 > 30 ) then continue else jumpto(0729);
  250. script:request( Script.ENTITY, "Cloud", "scene_part_16", 6 )
  251. break
  252. end
  253. script:wait( 0 )
  254. end
  255. return 0
  256. end,
  257. }
  258. --[[
  259. fan
  260. script_0:
  261. 072c (end 072c): field:background_clear( "2" ); -- turns off all layer of background animation with given id
  262. 072f (end 072f): return;
  263. 0730 (end 0730): script:wait( 0.1 )
  264. 0733 (end 0733): field:background_on( "2", 0 ); -- turns on layer of background animation with given id
  265. 0737 (end 0737): script:wait( 0.133333 )
  266. 073a (end 073a): field:background_off( "2", 0 ); -- turns off layer of background animation with given id
  267. 073e (end 073e): field:background_on( "2", 1 ); -- turns on layer of background animation with given id
  268. 0742 (end 0742): script:wait( 0.133333 )
  269. 0745 (end 0745): field:background_off( "2", 1 ); -- turns off layer of background animation with given id
  270. 0749 (end 0749): jumpto( 0730 );
  271. light
  272. script_0:
  273. 074b (end 074b): temp5_16 = 66;
  274. 074f (end 074f): return;
  275. 0750 (end 0750): [UNREVERSED] STPAL( 00, 0d, 00, ff );
  276. 0755 (end 0755): if ( temp5_16 < 62 ) then continue else jumpto(0775);
  277. 075b (end 0775): temp5_16 = temp5_16 + 2;
  278. 075f (end 0775): [UNREVERSED] MPPAL2( 00, 55, 50, 00, 10, 16, 16, 16, ff );
  279. 0769 (end 0775): [UNREVERSED] CPPAL( 00, 00, 10, 00 );
  280. 076e (end 0775): [UNREVERSED] LDPAL( 00, 10, 0d, ff );
  281. 0773 (end 0775): jumpto( 0755 );
  282. 0775 (end 0775): if ( temp5_16 > 32 ) then continue else jumpto(0795);
  283. 077b (end 0795): temp5_16 = temp5_16 - 2;
  284. 077f (end 0795): [UNREVERSED] MPPAL2( 00, 55, 50, 00, 10, 16, 16, 16, ff );
  285. 0789 (end 0795): [UNREVERSED] CPPAL( 00, 00, 10, 00 );
  286. 078e (end 0795): [UNREVERSED] LDPAL( 00, 10, 0d, ff );
  287. 0793 (end 0795): jumpto( 0775 );
  288. 0795 (end 0795): jumpto( 0755 );
  289. light2
  290. script_0:
  291. 0797 (end 0797): temp5_17 = 66;
  292. 079b (end 079b): return;
  293. 079c (end 079c): script:wait( 0.666667 )
  294. 079f (end 079f): [UNREVERSED] STPAL( 00, 0e, 20, ff );
  295. 07a4 (end 07a4): if ( temp5_17 < 62 ) then continue else jumpto(07c4);
  296. 07aa (end 07c4): temp5_17 = temp5_17 + 1;
  297. 07ae (end 07c4): [UNREVERSED] MPPAL2( 00, 55, 50, 20, 30, 17, 17, 17, ff );
  298. 07b8 (end 07c4): [UNREVERSED] CPPAL( 00, 20, 30, 00 );
  299. 07bd (end 07c4): [UNREVERSED] LDPAL( 00, 30, 0e, ff );
  300. 07c2 (end 07c4): jumpto( 07a4 );
  301. 07c4 (end 07c4): if ( temp5_17 > 16 ) then continue else jumpto(07e4);
  302. 07ca (end 07e4): temp5_17 = temp5_17 - 1;
  303. 07ce (end 07e4): [UNREVERSED] MPPAL2( 00, 55, 50, 20, 30, 17, 17, 17, ff );
  304. 07d8 (end 07e4): [UNREVERSED] CPPAL( 00, 20, 30, 00 );
  305. 07dd (end 07e4): [UNREVERSED] LDPAL( 00, 30, 0e, ff );
  306. 07e2 (end 07e4): jumpto( 07c4 );
  307. 07e4 (end 07e4): jumpto( 07a4 );
  308. ]]
  309. EntityContainer[ "Gateway0" ] = {
  310. on_start = function( self )
  311. return 0
  312. end,
  313. on_enter_line = function( self, entity )
  314. return 0
  315. end,
  316. on_move_to_line = function( self, entity )
  317. return 0
  318. end,
  319. on_cross_line = function( self, entity )
  320. if entity == "Cloud" then
  321. --load_field_map_request( "ffvii_elevtr1", "Spawn_elevtr1_1f" )
  322. end
  323. return 0
  324. end,
  325. on_leave_line = function( self, entity )
  326. return 0
  327. end,
  328. }
  329. EntityContainer[ "Gateway1" ] = {
  330. on_start = function( self )
  331. return 0
  332. end,
  333. on_enter_line = function( self, entity )
  334. return 0
  335. end,
  336. on_move_to_line = function( self, entity )
  337. return 0
  338. end,
  339. on_cross_line = function( self, entity )
  340. if entity == "Cloud" then
  341. load_field_map_request( "ffvii_nmkin_3", "Spawn_nmkin_2" )
  342. end
  343. return 0
  344. end,
  345. on_leave_line = function( self, entity )
  346. return 0
  347. end,
  348. }