md1stin.lua 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. EntityContainer = {}
  2. EntityContainer[ "Director" ] = {
  3. on_start = function( self )
  4. background2d:scroll_to_position( 0, 120, Background2D.NONE, 0 )
  5. if FFVII.Data.progress_game == 0 then
  6. player_lock( true )
  7. --03b2 (end 03d1): fade:black();
  8. background2d:scroll_to_position( 0, 0, Background2D.NONE, 0 )
  9. --03c1 (end 03d1): music:execute_akao( f0, 00000000, 00000000, 00000000, 00000000, 00007100, 00008101 );
  10. --03cf (end 03d1): field:random_encounter_on( false );
  11. end
  12. --03d6 (end 03d6): [UNREVERSED] BTLMD(20, 00);
  13. if FFVII.Data.progress_game > 0 then
  14. --03e1 (end 03e3): music:execute_akao( 10, pointer_to_field_AKAO_0 ); -- play field music
  15. end
  16. --03e3 (end 03e3): [UNREVERSED] FMUSC(00);
  17. --03e5 (end 03e5): field:map_name(0);
  18. if FFVII.Data.progress_game == 0 then
  19. --03f0 (end 04bd): field:movie_set( 53 );
  20. --03f2 (end 04bd): music:execute_akao( c8, 00007000, 00000000, 00000000, 00000000, 00000000, 00000301 );
  21. script:request( Script.ENTITY, "View", "script_3", 6 )
  22. --0404 (end 04bd): field:play_movie();
  23. --0405 (end 04bd): music:execute_akao( c8, 00007fff, 00000000, 00000000, 00000000, 00000000, 00002081 );
  24. --0414 (end 04bd): game:variable_set("menu_appear", 763);
  25. FFVII.set_party( "Cloud", nil, nil );
  26. --041d (end 04bd): [UNREVERSED] MMBLK(00);
  27. --043f (end 04bd): music:execute_akao( 20, 00000040, 00000035 ); -- play sound
  28. script:wait( 1 )
  29. script:request( Script.ENTITY, "Biggs", "action1", 2 )
  30. script:wait( 1.1 )
  31. script:request( Script.ENTITY, "Gu1", "action1", 2 )
  32. script:wait( 1 )
  33. script:request( Script.ENTITY, "Gu0", "action1", 2 )
  34. script:wait( 2 )
  35. --0459 (end 04bd): music:execute_akao( 20, 00000040, 00000039 ); -- play sound
  36. script:request( Script.ENTITY, "Jessie", "action1", 2 )
  37. script:wait( 0.333333 )
  38. script:wait( 2 )
  39. script:request( Script.ENTITY, "Wedge", "action1", 2 )
  40. script:wait( 2.33333 )
  41. script:request( Script.ENTITY, "Barret", "action1", 2 )
  42. script:wait( 2.66667 )
  43. background2d:scroll_to_position( -60, 390, Background2D.SMOOTH, 0.4 )
  44. script:wait( 0.466667 )
  45. script:request( Script.ENTITY, "Cloud", "action1", 2 )
  46. script:wait( 0.0666667 )
  47. --0485 (end 04bd): music:execute_akao( 20, 00000040, 00000037 ); -- play sound
  48. script:wait( 0.733333 )
  49. background2d:scroll_to_position( 30, 105, Background2D.SMOOTH, 0.5 )
  50. script:wait( 0.533333 )
  51. --0499 (end 04bd): music:execute_akao( 20, 00000040, 00000038 ); -- play sound
  52. script:wait( 1.93333 )
  53. message:show_dialog( "3" , "md1stin_00", 40, 20 )
  54. message:sync( "3" )
  55. script:request( Script.ENTITY, "Barret", "action2", 2 )
  56. script:wait( 0.666667 )
  57. FFVII.Data.progress_game = 1
  58. player_lock( false )
  59. end
  60. return 0
  61. end,
  62. on_update = function( self )
  63. if FFVII.Data.progress_game <= 1 then
  64. local triangle_id = EntityContainer[ "Cloud" ].cloud:get_move_triangle_id()
  65. if ( FFVII.Data.progress_game == 1 ) and ( triangle_id == 12 ) then
  66. FFVII.Data.progress_game = 6
  67. player_lock( true )
  68. script:request( Script.ENTITY, "Hei0", "action1", 2 )
  69. script:request_end_sync( Script.ENTITY, "Hei1", "action1", 2 )
  70. --04e2 (end 04ea): field:battle_run( 300 );
  71. player_lock( false )
  72. end
  73. end
  74. return 0
  75. end,
  76. }
  77. EntityContainer[ "Cloud" ] = {
  78. cloud = nil,
  79. on_start = function( self )
  80. set_entity_to_character( "Cloud", "Cloud" );
  81. self.cloud = entity_manager:get_entity( "Cloud" )
  82. if FFVII.Data.progress_game == 0 then
  83. self.cloud:set_position( 28.5547, 214.312, 2.42188 )
  84. self.cloud:set_rotation( 180 )
  85. self.cloud:set_solid( false )
  86. self.cloud:set_visible( false )
  87. else
  88. self.cloud:set_solid( true )
  89. self.cloud:set_visible( true )
  90. end
  91. return 0
  92. end,
  93. action1 = function( self )
  94. self.cloud:set_solid( true )
  95. self.cloud:set_visible( true )
  96. self.cloud:play_animation( "JumpFromTrain" )
  97. self.cloud:animation_sync()
  98. return 0
  99. end,
  100. }
  101. EntityContainer[ "Barret" ] = {
  102. barret = nil,
  103. on_start = function( self )
  104. set_entity_to_character( "Barret", "Barret" );
  105. self.barret = entity_manager:get_entity( "Barret" )
  106. if FFVII.Data.progress_game <= 1 then
  107. self.barret:set_position( 30.6328, 214.758, 2.52344 )
  108. end
  109. self.barret:set_solid( false )
  110. self.barret:set_visible( false )
  111. return 0
  112. end,
  113. --[[ Barret run from train and invite Cloud ]]
  114. action1 = function( self )
  115. self.barret:set_solid( true )
  116. self.barret:set_visible( true )
  117. self.barret:set_move_auto_speed( 2.8125 )
  118. self.barret:move_to_position( 28.1797, 216.5 )
  119. self.barret:move_sync()
  120. self.barret:set_rotation( 164.531 )
  121. self.barret:play_animation_stop( "Invitation", 0, 1.3 )
  122. self.barret:animation_sync()
  123. script:wait( 1.33333 )
  124. self.barret:play_animation_stop( "Invitation", 1.3, 1.6 )
  125. self.barret:animation_sync()
  126. return 0
  127. end,
  128. --[[ Barret run to next field ]]
  129. action2 = function( self )
  130. self.barret:move_to_position( 29.9688, 228.867 )
  131. self.barret:move_sync()
  132. self.barret:move_to_position( 27.9531, 229.375 )
  133. self.barret:move_sync()
  134. self.barret:set_solid( false )
  135. self.barret:set_visible( false )
  136. return 0
  137. end,
  138. }
  139. EntityContainer[ "View" ] = {
  140. on_start = function( self )
  141. return 0
  142. end,
  143. script_3 = function( self )
  144. --[[
  145. 056c (end 056c): temp6_06 = field:get_movie_frame();
  146. 056f (end 056f): if ( temp6_06 > 20 ) then continue else jumpto(0582);
  147. 0577 (end 0582): fade:clear();
  148. 0580 (end 0582): jumpto( 0584 );
  149. 0582 (end 0584): jumpto( 056c );
  150. 0584 (end 0584): temp6_06 = field:get_movie_frame();
  151. 0587 (end 0587): if ( temp6_06 > 664 ) then continue else jumpto(05a4);
  152. 058f (end 05a4): music:execute_akao( 10, pointer_to_field_AKAO_1 ); -- play field music
  153. 0591 (end 05a4): music:lock( true );
  154. 0593 (end 05a4): music:execute_akao( c9, 0000003c, 00007fff, 00000000, 00000000, 00000000, 00000310 );
  155. 05a2 (end 05a4): jumpto( 05a6 );
  156. 05a4 (end 05a6): jumpto( 0584 );
  157. 05a6 (end 05a6): return;
  158. ]]
  159. return 0
  160. end,
  161. }
  162. --[[ 1st army man that attacks Cloud as we approach next field. ]]
  163. EntityContainer[ "Hei0" ] = {
  164. hei0 = nil,
  165. on_start = function( self )
  166. self.hei0 = entity_manager:get_entity( "Hei0" )
  167. self.hei0:set_position( 28.3906, 228.781, 2.86719 )
  168. self.hei0:set_solid( false )
  169. self.hei0:set_visible( false )
  170. return 0
  171. end,
  172. --[[ Army man run from gate to Cloud. ]]
  173. action1 = function( self )
  174. self.hei0:set_visible( true )
  175. self.hei0:set_move_auto_speed( 2.22656 )
  176. self.hei0:move_to_position( 29.6406, 228.656 )
  177. self.hei0:move_sync()
  178. self.hei0:move_to_position( 29.1562, 224.625 )
  179. self.hei0:move_sync()
  180. self.hei0:set_solid( false )
  181. self.hei0:set_visible( false )
  182. return 0
  183. end,
  184. }
  185. --[[ 2nd army man that attacks Cloud as we approach next field. ]]
  186. EntityContainer[ "Hei1" ] = {
  187. hei1 = nil,
  188. on_start = function( self )
  189. self.hei1 = entity_manager:get_entity( "Hei1" )
  190. self.hei1:set_position( 28.3906, 228.781, 2.86719 )
  191. self.hei1:set_solid( false )
  192. self.hei1:set_visible( false )
  193. return 0
  194. end,
  195. --[[ Army man run from gate to Cloud. ]]
  196. action1 = function( self )
  197. self.hei1:set_visible( true )
  198. self.hei1:set_move_auto_speed( 2.34375 )
  199. self.hei1:move_to_position( 30.4453, 228.57 )
  200. self.hei1:move_sync()
  201. self.hei1:move_to_position( 30.2578, 225.312 )
  202. self.hei1:move_sync()
  203. self.hei1:set_solid( false )
  204. self.hei1:set_visible( false )
  205. return 0
  206. end,
  207. }
  208. -- AvM
  209. EntityContainer[ "Biggs" ] = {
  210. biggs = nil,
  211. on_start = function( self )
  212. self.biggs = entity_manager:get_entity( "Biggs" )
  213. self.biggs:set_position( 30, 228, 2.45312 )
  214. self.biggs:set_rotation( 270 )
  215. self.biggs:set_solid( false )
  216. self.biggs:set_visible( false )
  217. return 0
  218. end,
  219. --[[ This is all action that does Biggs. At first he jumps from train, then he
  220. throws guard and a bit later run to next map. ]]
  221. action1 = function( self )
  222. self.biggs:set_visible( true )
  223. self.biggs:play_animation( "JumpFromTrain" )
  224. self.biggs:animation_sync()
  225. script:wait( 0.266667 )
  226. self.biggs:turn_to_direction( 326.25, Entity.CLOSEST, Entity.SMOOTH, 0.333333 )
  227. script:wait( 0.333333 )
  228. self.biggs:play_animation( "Throw" )
  229. self.biggs:animation_sync()
  230. self.biggs:set_rotation( 146.25 )
  231. script:wait( 3.33333 )
  232. self.biggs:set_move_auto_speed( 2.34375 )
  233. self.biggs:move_to_position( 29.9688, 228.867 )
  234. self.biggs:move_sync()
  235. self.biggs:move_to_position( 27.9531, 229.375 )
  236. self.biggs:move_sync()
  237. self.biggs:set_solid( false )
  238. self.biggs:set_visible( false )
  239. return 0
  240. end,
  241. }
  242. -- AvL
  243. EntityContainer[ "Jessie" ] = {
  244. jessie = nil,
  245. on_start = function( self )
  246. self.jessie = entity_manager:get_entity( "Jessie" )
  247. self.jessie:set_position( 31.1406, 220.422, 2.50781 )
  248. self.jessie:set_solid( false )
  249. self.jessie:set_visible( false )
  250. return 0
  251. end,
  252. --[[ This is all action that does Jessie. At first she run from train, then she
  253. kicks guard and a bit later run to next map. ]]
  254. action1 = function( self )
  255. self.jessie:set_visible( true )
  256. self.jessie:set_move_auto_speed( 1.875 )
  257. self.jessie:move_to_position( 28.6875, 220.477 )
  258. self.jessie:move_sync()
  259. self.jessie:set_rotation( 16.875 )
  260. self.jessie:play_animation_stop( "Kick", 0, 0.466667 )
  261. self.jessie:animation_sync()
  262. script:wait( 0.233333 )
  263. --0680 (end 0680): music:execute_akao( 20, 00000040, 0000001c ); -- play sound
  264. script:wait( 0.766667 )
  265. self.jessie:play_animation( "Kick", 0.5, 0.8 )
  266. self.jessie:animation_sync()
  267. self.jessie:set_default_animation( "Idle" )
  268. self.jessie:play_animation( "Idle" )
  269. script:wait( 1.33333 )
  270. self.jessie:move_to_position( 29.9688, 228.867 )
  271. self.jessie:move_sync()
  272. self.jessie:move_to_position( 27.9531, 229.375 )
  273. self.jessie:move_sync()
  274. self.jessie:set_solid( false )
  275. self.jessie:set_visible( false )
  276. return 0
  277. end,
  278. }
  279. -- AvS
  280. EntityContainer[ "Wedge" ] = {
  281. wedge = nil,
  282. on_start = function( self )
  283. self.wedge = entity_manager:get_entity( "Wedge" )
  284. self.wedge:set_position( 29.6406, 221.227, 2.42188 )
  285. self.wedge:set_rotation( 270 )
  286. self.wedge:set_solid( false )
  287. self.wedge:set_visible( false )
  288. return 0
  289. end,
  290. --[[ This is all action that does Wedge. At first he jumps from train, then he
  291. looks around and a bit later run to next map. ]]
  292. action1 = function( self )
  293. self.wedge:set_visible( true )
  294. self.wedge:play_animation( "JumpFromTrain" )
  295. self.wedge:animation_sync()
  296. script:wait( 0.266667 )
  297. self.wedge:turn_to_direction( 326.25, Entity.CLOSEST, Entity.SMOOTH, 0.333333 )
  298. script:wait( 2 )
  299. self.wedge:set_move_auto_speed( 2.34375 )
  300. self.wedge:move_to_position( 29.9688, 228.867 )
  301. self.wedge:move_sync()
  302. self.wedge:move_to_position( 27.9531, 229.375 )
  303. self.wedge:move_sync()
  304. self.wedge:set_solid( false )
  305. self.wedge:set_visible( false )
  306. return 0
  307. end,
  308. }
  309. --[[ One of two guards thas stays on train station at the very beginning.
  310. This one is closest to camera. Jessie takes him off. ]]
  311. EntityContainer[ "Gu0" ] = {
  312. gu0 = nil,
  313. on_start = function( self )
  314. self.gu0 = entity_manager:get_entity( "Gu0" )
  315. self.gu0:set_position( 28.0938, 217.008, 2.42188 )
  316. self.gu0:set_rotation( 90 )
  317. if FFVII.Data.progress_game >= 1 then
  318. self.gu0:set_position( 29.4297, 216.578, 2.42188 )
  319. self.gu0:set_rotation( 191.25 )
  320. self.gu0:set_default_animation( "Dead1" )
  321. self.gu0:play_animation( "Dead1" )
  322. end
  323. self.gu0:set_interactable( true )
  324. self.gu0:set_solid( true )
  325. self.gu0:set_visible( true )
  326. return 0
  327. end,
  328. on_interact = function( self )
  329. player_lock( true )
  330. if FFVII.Data.md1stin_potion_1 == false then
  331. --07c2 (end 07df): music:execute_akao( 20, 00000040, 00000168 ); -- play sound
  332. message:show_dialog( "0", "receive_potion", 83, 10 )
  333. message:sync( "0" )
  334. FFVII.Data.md1stin_potion_1 = true
  335. FFVII.add_item( "Potion", 1 )
  336. elseif FFVII.Data.md1stin_potion_2 == false then
  337. --07e5 (end 0800): music:execute_akao( 20, 00000040, 00000168 ); -- play sound
  338. message:show_dialog( "0", "receive_potion", 83, 10 )
  339. message:sync( "0" )
  340. FFVII.Data.md1stin_potion_2 = true
  341. FFVII.add_item( "Potion", 1 )
  342. end
  343. player_lock( false )
  344. return 0
  345. end,
  346. --[[ This is what Gu0 do.
  347. First Gu0 look to Jessie and then run to her. Jessie kicks Gu0
  348. away and then Gu0 stay on the ground. ]]
  349. action1 = function( self )
  350. self.gu0:set_solid( false )
  351. self.gu0:turn_to_direction( 135, Entity.CLOSEST, Entity.SMOOTH, 0.333333 )
  352. script:wait( 1.06667 )
  353. self.gu0:play_animation( "LookBack" )
  354. self.gu0:animation_sync()
  355. self.gu0:set_move_auto_speed( 1.875 )
  356. script:wait( 0.266667 )
  357. self.gu0:move_to_position( 28.9375, 219.094 )
  358. self.gu0:move_sync()
  359. self.gu0:set_rotation( 191.25 )
  360. self.gu0:play_animation_stop( "Kicked" )
  361. self.gu0:animation_sync()
  362. script:request_end_sync( Script.ENTITY, "Gu1", "activate", 6 )
  363. self.gu0:set_interactable( false )
  364. self.gu0:set_solid( false )
  365. self.gu0:set_visible( false )
  366. return 0
  367. end,
  368. }
  369. --[[ One of two guards thas stays on train station at the very beginning.
  370. This one stay far from camera. Biggs takes him off. ]]
  371. EntityContainer[ "Gu1" ] = {
  372. gu1 = nil,
  373. on_start = function( self )
  374. self.gu1 = entity_manager:get_entity( "Gu1" )
  375. self.gu1:set_position( 28.875, 224.477, 2.42188 )
  376. self.gu1:set_rotation( 90 )
  377. if FFVII.Data.progress_game >= 1 then
  378. self.gu1:set_position( 30.625, 227.812, 2.42969 )
  379. self.gu1:set_rotation( 56.25 )
  380. self.gu1:set_default_animation( "Dead2" )
  381. self.gu1:play_animation( "Dead2" )
  382. end
  383. self.gu1:set_interactable( true )
  384. self.gu1:set_solid( true )
  385. self.gu1:set_visible( true )
  386. return 0
  387. end,
  388. on_interact = function( self )
  389. player_lock( true )
  390. if FFVII.Data.md1stin_potion_1 == false then
  391. --07c2 (end 07df): music:execute_akao( 20, 00000040, 00000168 ); -- play sound
  392. message:show_dialog( "0", "receive_potion", 83, 10 )
  393. message:sync( "0" )
  394. FFVII.Data.md1stin_potion_1 = true
  395. FFVII.add_item( "Potion", 1 )
  396. elseif FFVII.Data.md1stin_potion_2 == false then
  397. --07e5 (end 0800): music:execute_akao( 20, 00000040, 00000168 ); -- play sound
  398. message:show_dialog( "0", "receive_potion", 83, 10 )
  399. message:sync( "0" )
  400. FFVII.Data.md1stin_potion_2 = true
  401. FFVII.add_item( "Potion", 1 )
  402. end
  403. player_lock( false )
  404. return 0
  405. end,
  406. --[[ This is what Gu1 do after Biggs jumps from the train.
  407. First Gu1 look to Biggs and then run to him. Biggs throw Gu1
  408. to the ground and then Gu1 stay on it. ]]
  409. action1 = function( self )
  410. self.gu1:set_solid( false )
  411. self.gu1:play_animation( "LookBack" )
  412. self.gu1:animation_sync()
  413. self.gu1:set_move_auto_speed( 3.75 )
  414. self.gu1:move_to_position( 29.625, 228.375 )
  415. self.gu1:move_sync()
  416. self.gu1:set_rotation( 56.25 )
  417. self.gu1:play_animation_stop( "Throwed" )
  418. self.gu1:animation_sync()
  419. script:request( Script.ENTITY, "GuAdd", "activate", 6 )
  420. self.gu1:set_interactable( false )
  421. self.gu1:set_solid( false )
  422. self.gu1:set_visible( false )
  423. return 0
  424. end,
  425. -- [[ This will activate Gu1 in place of Gu0. Don't know why it is done this way. ]]
  426. activate = function( self )
  427. self.gu1:set_default_animation( "Dead1" )
  428. self.gu1:play_animation( "Dead1" )
  429. self.gu1:set_position( 29.4297, 216.578, 2.42188 )
  430. self.gu1:set_rotation( 191.25 )
  431. self.gu1:set_interactable( true )
  432. self.gu1:set_solid( true )
  433. self.gu1:set_visible( true )
  434. return 0
  435. end,
  436. }
  437. --[[ Additional guard model used when script switch model.
  438. Don't know why it is dome this way. ]]
  439. EntityContainer[ "GuAdd" ] = {
  440. gu_add = nil,
  441. on_start = function( self )
  442. self.gu_add = entity_manager:get_entity( "GuAdd" )
  443. self.gu_add:set_position( 30.625, 227.812, 2.42969 )
  444. self.gu_add:set_rotation( 56.25 )
  445. self.gu_add:set_default_animation( "Dead2" )
  446. self.gu_add:play_animation( "Dead2" )
  447. self.gu_add:set_interactable( false )
  448. self.gu_add:set_solid( false )
  449. self.gu_add:set_visible( false )
  450. return 0
  451. end,
  452. on_interact = function( self )
  453. player_lock( true )
  454. if FFVII.Data.md1stin_potion_1 == false then
  455. --07c2 (end 07df): music:execute_akao( 20, 00000040, 00000168 ); -- play sound
  456. message:show_dialog( "0", "receive_potion", 83, 10 )
  457. message:sync( "0" )
  458. FFVII.Data.md1stin_potion_1 = true
  459. FFVII.add_item( "Potion", 1 )
  460. elseif FFVII.Data.md1stin_potion_2 == false then
  461. --07e5 (end 0800): music:execute_akao( 20, 00000040, 00000168 ); -- play sound
  462. message:show_dialog( "0", "receive_potion", 83, 10 )
  463. message:sync( "0" )
  464. FFVII.Data.md1stin_potion_2 = true
  465. FFVII.add_item( "Potion", 1 )
  466. end
  467. player_lock( false )
  468. return 0
  469. end,
  470. --[[ We activate this entity after deactivation of Gu1.
  471. Don't know why we need to do this, but FFVII handle it this way. ]]
  472. activate = function( self )
  473. self.gu_add:set_interactable( true )
  474. self.gu_add:set_solid( true )
  475. self.gu_add:set_visible( true )
  476. return 0
  477. end,
  478. }
  479. EntityContainer[ "Gateway0" ] = {
  480. on_start = function( self )
  481. return 0
  482. end,
  483. on_enter_line = function( self, entity )
  484. return 0
  485. end,
  486. on_move_to_line = function( self, entity )
  487. return 0
  488. end,
  489. on_cross_line = function( self, entity )
  490. if entity == "Cloud" then
  491. load_field_map_request( "ffvii_md1_1", "Spawn_md1stin" )
  492. end
  493. return 0
  494. end,
  495. on_leave_line = function( self, entity )
  496. return 0
  497. end,
  498. }