elevtr1.lua 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. EntityContainer = {}
  2. EntityContainer[ "Director" ] = {
  3. on_start = function( self )
  4. background2d:autoscroll_to_entity( entity_manager:get_entity( "Cloud" ) )
  5. --0358 (end 0358): [UNREVERSED] BTLMD(20, 00);
  6. --035b (end 035b): music:execute_akao( 10, pointer_to_field_AKAO_0 ); -- play field music
  7. --035d (end 035d): field:map_name(2);
  8. while true do
  9. if FFVII.Data.progress_game >= 64 then -- previously 13
  10. break
  11. end
  12. if EntityContainer[ "Cloud" ].cloud ~= nil then
  13. local triangle_id = EntityContainer[ "Cloud" ].cloud:get_move_triangle_id()
  14. --[[ Going down. ]]
  15. if ( FFVII.Script.is_executing == false ) and ( triangle_id == 8 ) and ( FFVII.Data.elevtr1_floor == 1 ) then
  16. -- The entities have to be slightly "inside" the walkmesh for the above statement to be true
  17. FFVII.Script.is_executing = true
  18. player_lock( true )
  19. script:request_end_sync( Script.ENTITY, "Cloud", "press_button", 6 )
  20. if FFVII.Data.progress_game < 12 then
  21. FFVII.Data.progress_game = 12
  22. script:request_end_sync( Script.ENTITY, "Barret", "talk_about_planet", 6 )
  23. script:request_end_sync( Script.ENTITY, "Jessie", "leave_elevator", 6 )
  24. end
  25. script:request_end_sync( Script.ENTITY, "Cloud", "walk_away_from_button", 6 )
  26. FFVII.Data.elevtr1_floor = 0 -- This must be set when not in triangle 8
  27. player_lock( false )
  28. end
  29. --[[ Going up. ]]
  30. if ( FFVII.Script.is_executing == false ) and ( triangle_id == 8 ) and ( FFVII.Data.elevtr1_floor == 0 ) then
  31. -- The entities have to be slightly "inside" the walkmesh for the above statement to be true
  32. FFVII.Script.is_executing = true
  33. player_lock( true )
  34. script:request_end_sync( Script.ENTITY, "Cloud", "press_button", 6 )
  35. if FFVII.Data.progress_game < 12 then
  36. FFVII.Data.progress_game = 12
  37. script:request_end_sync( Script.ENTITY, "Barret", "talk_about_planet", 6 )
  38. script:request_end_sync( Script.ENTITY, "Jessie", "leave_elevator", 6 )
  39. end
  40. script:request_end_sync( Script.ENTITY, "Cloud", "walk_away_from_button", 6 )
  41. FFVII.Data.elevtr1_floor = 1 -- This must be set when not in triangle 8
  42. player_lock( false )
  43. end
  44. FFVII.Script.is_executing = false
  45. end
  46. script:wait( 0 )
  47. end
  48. return 0
  49. end,
  50. }
  51. EntityContainer[ "Elevator" ] = {
  52. on_start = function( self )
  53. return 0
  54. end,
  55. }
  56. EntityContainer[ "Cloud" ] = {
  57. cloud = nil,
  58. on_start = function( self )
  59. set_entity_to_character( "Cloud", "Cloud" );
  60. self.cloud = entity_manager:get_entity( "Cloud" )
  61. self.cloud:set_solid( true )
  62. self.cloud:set_visible( true )
  63. script:request( Script.ENTITY, "Cloud", "enter_elevator", 6 )
  64. return 0
  65. end,
  66. script_0 = function( self )
  67. --0425 (end 0425): -- assosiate entity with model (CHAR) argument doesn't matter
  68. --0427 (end 0427): set_entity_to_character( "cl", 0 );
  69. --0429 (end 0429): return
  70. --042a (end 042a): jumpto( 042a );
  71. return 0
  72. end,
  73. --[[ Enter the elevator. ]]
  74. enter_elevator = function( self )
  75. player_lock( true )
  76. self.cloud:set_move_auto_speed( 1.0 )
  77. self.cloud:move_to_position( -0.484375, 0 )
  78. self.cloud:move_sync()
  79. player_lock( false )
  80. return 0
  81. end,
  82. --[[ Face the control box and slam the elevator button. ]]
  83. press_button = function( self )
  84. self.cloud:move_to_position( 0.671875, 0.5 )
  85. self.cloud:move_sync()
  86. self.cloud:turn_to_direction( 180, Entity.CLOSEST, Entity.SMOOTH, 0.333333 )
  87. self.cloud:turn_sync()
  88. script:wait( 0.133333 )
  89. self.cloud:play_animation_stop( "ButtonPressUp", 0 , -1 ) -- speed=1
  90. self.cloud:animation_sync()
  91. self.cloud:play_animation( "ButtonPressDown", 0 , -1 ) -- speed=1
  92. self.cloud:animation_sync()
  93. script:wait( 0.5 )
  94. if FFVII.Data.progress_game <= 12 then
  95. script:request( Script.ENTITY, "Jessie", "stop_showing_button", 6 )
  96. end
  97. --0443 (end 0443): music:execute_akao( 20, 40, 33 ); -- play sound
  98. --if ( !(game:variable_get( "act1_1_flags1" ) & (1 << 0)) ) then continue else jumpto(0458);
  99. -- field:background_off( "2", 1 ); -- turns off layer of background animation with given id
  100. -- field:background_on( "2", 2 ); -- turns on layer of background animation with given id
  101. --end
  102. --0456 (end 0458): jumpto( 0460 );
  103. --field:background_off( "2", 2 ); -- turns off layer of background animation with given id
  104. --field:background_on( "2", 1 ); -- turns on layer of background animation with given id
  105. -- set window parameters (id = 0, x = 150, y = 100, width = 86, height = 25);
  106. --message:show_text_wait(0, 45, x, y);
  107. --self.cloud:play_animation_stop( "4" ) -- speed=1
  108. --self.cloud:animation_sync()
  109. --self.cloud:set_default_animation( "0" ) -- speed=1
  110. --self.cloud:play_animation( "0" )
  111. return 0
  112. end,
  113. --[[ Walk away from the button so we dont trigger it again ]]
  114. walk_away_from_button = function( self )
  115. self.cloud:move_to_position( 0, 0.4 )
  116. self.cloud:move_sync()
  117. return 0
  118. end,
  119. --[[ Cloud looks at Barret ]]
  120. lookat_barret = function( self )
  121. --self.cloud:turn_to_entity( barret, Entity.CLOSEST, 0.5);
  122. self.cloud:turn_to_direction( -45, Entity.CLOSEST, Entity.SMOOTH, 0.5 )
  123. self.cloud:turn_sync()
  124. script:wait( 0.5 )
  125. return 0
  126. end,
  127. --[[ Cloud moves his hands into a "Don't Know" gesture ]]
  128. not_my_problem = function( self )
  129. self.cloud:play_animation_stop( "TalkDontKnow" ) -- speed=1
  130. self.cloud:animation_sync()
  131. --047c (end 047c): -- set window parameters (id = 2, x = 100, y = 20, width = 151, height = 41);
  132. --0486 (end 0486): message:show_text_wait(2, 59, x, y);
  133. self.cloud:play_animation_stop( "TalkDontKnowFull", 1.46667, 1.96667 ) -- speed=1
  134. self.cloud:animation_sync()
  135. script:wait( 0.5 )
  136. self.cloud:set_default_animation( "Idle" ) -- speed=1
  137. self.cloud:play_animation( "Idle" )
  138. return 0
  139. end,
  140. --[[ Cloud shakes head "No" and says that all he cares about is finishing the job before security and roboguards come ]]
  141. get_out_before_security = function( self )
  142. self.cloud:play_animation( "TalkNo" ) -- speed=1
  143. self.cloud:animation_sync()
  144. --0498 (end 0498): -- set window parameters (id = 2, x = 65, y = 20, width = 285, height = 57);
  145. --04a2 (end 04a2): message:show_text_wait(2, 60, x, y);
  146. --04a5 (end 04a5): return
  147. return 0
  148. end,
  149. }
  150. EntityContainer[ "Barret" ] = {
  151. barret = nil,
  152. on_start = function( self )
  153. self.barret = entity_manager:get_entity( "Barret" )
  154. self.barret:set_position( 0, 0, 0.0390625 )
  155. self.barret:set_solid( false )
  156. self.barret:set_visible( false )
  157. return 0
  158. end,
  159. --[[ Barret tells Cloud that the planets dyin ]]
  160. talk_about_planet = function( self )
  161. self.barret:set_position( 0.671875, 0.5, 0.0390625 )
  162. self.barret:set_visible( true )
  163. script:wait( 0.3 )
  164. self.barret:set_move_auto_speed( 1.0 )
  165. self.barret:move_to_position( 0, 0.4 )
  166. script:wait( 0.3 )
  167. self.barret:turn_to_direction( 150, Entity.CLOSEST, Entity.SMOOTH, 0.5 )
  168. self.barret:turn_sync()
  169. script:wait( 0.5 )
  170. --04b1 (end 04b1): [UNREVERSED] SPLIT(00, 00, 00, f9, ff, f7, ff, 70, f9, ff, f7, ff, 70, 28);
  171. script:request_end_sync( Script.ENTITY, "Cloud", "lookat_barret", 6 )
  172. self.barret:play_animation( "TalkGesture" ) -- speed=1
  173. self.barret:animation_sync()
  174. -- set window parameters (id = 2, x = 10, y = 20, width = 245, height = 73);
  175. --message:show_text_wait(2, 57, x, y);
  176. script:request_end_sync( Script.ENTITY, "Cloud", "not_my_problem", 6 )
  177. script:wait( 0.266667 )
  178. self.barret:play_animation( "Angry2" ) -- speed=1
  179. self.barret:animation_sync()
  180. -- set window parameters (id = 2, x = 20, y = 30, width = 268, height = 41);
  181. --message:show_text_wait(2, 58, x, y);
  182. script:request_end_sync( Script.ENTITY, "Cloud", "get_out_before_security", 6 )
  183. self.barret:turn_to_direction( 0, Entity.CLOSEST, Entity.SMOOTH, 0.333333 )
  184. self.barret:turn_sync()
  185. self.barret:play_animation_stop( "Angry3Start" ) -- speed=1
  186. self.barret:animation_sync()
  187. self.barret:set_default_animation( "Angry3Continue" ) -- speed=1
  188. self.barret:play_animation( "Angry3Continue" )
  189. script:wait( 2 )
  190. self.barret:play_animation_stop( "Angry3End", 0, 0.466667 ) -- speed=1
  191. self.barret:animation_sync()
  192. script:wait( 0.666667 )
  193. self.barret:play_animation_stop( "Angry3End", 0.5, 0.966667 ) -- speed=1
  194. self.barret:animation_sync()
  195. self.barret:set_default_animation( "Idle" ) -- speed=1
  196. self.barret:play_animation( "Idle" )
  197. self.barret:play_animation( "Steps", 0, -1 );
  198. --self.barret:turn_to_entity( cl, Entity.CLOSEST, 0.0666667);
  199. self.barret:turn_to_direction( 150, Entity.CLOSEST, Entity.SMOOTH, 0.5 )
  200. self.barret:turn_sync()
  201. script:wait( 0.333333 )
  202. self.barret:move_to_position( 0.671875, 0.5 )
  203. script:wait( 0.6 )
  204. self.barret:set_visible( false )
  205. script:wait( 0.5 )
  206. --0516 (end 0516): [UNREVERSED] JOIN(28);
  207. --0518 (end 0518): temp5_06 = 1;
  208. return 0
  209. end,
  210. }
  211. EntityContainer[ "Jessie" ] = {
  212. jessie = nil,
  213. on_start = function( self )
  214. self.jessie = entity_manager:get_entity( "Jessie" )
  215. -- assosiate entity with model (CHAR) argument doesn't matter
  216. self.jessie:set_position( -0.75, 0.5625, 0.0390625 ) -- triangle_id=5
  217. --self.jessie:set_direction( 315 )
  218. if FFVII.Data.progress_game >= 12 then
  219. self.jessie:set_talkable( false );
  220. self.jessie:set_solid( false )
  221. self.jessie:set_visible( false )
  222. end
  223. if FFVII.Data.progress_game < 12 then
  224. self.jessie:set_solid( false )
  225. self.jessie:set_rotation( -90 )
  226. self.jessie:play_animation_stop( "PointToButton", 0.133333, 0.133333 ) -- speed=1
  227. self.jessie:animation_sync()
  228. script:wait( 0.333333 )
  229. self.jessie:play_animation_stop( "PointToButton", 0.133333, 0.4 ) -- speed=1
  230. self.jessie:animation_sync()
  231. script:wait( 0.266667 )
  232. self.jessie:play_animation_stop( "PointToButton", 0.4, 0.8 ) -- speed=1
  233. self.jessie:animation_sync()
  234. --063b (end 0648): -- set window parameters (id = 1, x = 15, y = 50, width = 202, height = 41);
  235. --0645 (end 0648): message:show_text_wait(1, 46, x, y);
  236. --0648 (end 0648): jumpto( 0648 );
  237. end
  238. return 0
  239. end,
  240. --[[ Jessie stops pointing at the button and looks out the door for possible danger ]]
  241. stop_showing_button = function( self )
  242. self.jessie:play_animation_stop( "PointToButton", 0.833333, 1.26667 ) -- speed=1
  243. self.jessie:animation_sync()
  244. return 0
  245. end,
  246. --[[ Jessie runs out of the elevator once you reach the reactor level ]]
  247. leave_elevator = function( self )
  248. self.jessie:set_default_animation( "Idle" ) -- speed=1
  249. self.jessie:play_animation( "Idle" )
  250. self.jessie:animation_sync()
  251. self.jessie:set_move_auto_speed( 1.75 )
  252. self.jessie:move_to_position( -0.76 , 0 )
  253. self.jessie:move_sync()
  254. self.jessie:move_to_position( -1.70 , 0 )
  255. self.jessie:move_sync()
  256. self.jessie:set_visible( false )
  257. return 0
  258. end,
  259. }
  260. EntityContainer[ "Gateway0" ] = {
  261. on_start = function( self )
  262. return 0
  263. end,
  264. on_enter_line = function( self, entity )
  265. --if entity == "Cloud" then
  266. -- load_field_map_request( "ffvii_nmkin_2", "Spawn_nmkin_2_up" )
  267. --end
  268. return 0
  269. end,
  270. on_move_to_line = function( self, entity )
  271. return 0
  272. end,
  273. on_cross_line = function( self, entity )
  274. if ( FFVII.Data.elevtr1_floor == 1 ) and ( entity == "Cloud" ) then
  275. load_field_map_request( "ffvii_nmkin_1", "Spawn_elevtr1" )
  276. end
  277. if ( FFVII.Data.elevtr1_floor == 0 ) and ( entity == "Cloud" ) then
  278. load_field_map_request( "ffvii_nmkin_2", "Spawn_elevtr1" )
  279. end
  280. --if entity == "Cloud" then
  281. -- load_field_map_request( "ffvii_nmkin_2", "Spawn_nmkin_2_up" )
  282. --end
  283. return 0
  284. end,
  285. on_leave_line = function( self, entity )
  286. return 0
  287. end,
  288. }
  289. EntityContainer[ "Gateway1" ] = {
  290. on_start = function( self )
  291. return 0
  292. end,
  293. on_enter_line = function( self, entity )
  294. return 0
  295. end,
  296. on_move_to_line = function( self, entity )
  297. return 0
  298. end,
  299. on_cross_line = function( self, entity )
  300. if entity == "Player" then
  301. load_field_map_request( "ffvii_nmkin_2", "Spawn_nmkin_2_up" )
  302. end
  303. return 0
  304. end,
  305. on_leave_line = function( self, entity )
  306. return 0
  307. end,
  308. }