Advertisement
Guest User

Untitled

a guest
May 25th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.42 KB | None | 0 0
  1. Global NextStageDest$
  2.  
  3. Function Object_Goal_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
  4.  
  5. o.tObject = New tObject
  6.  
  7. o\ObjType = OBJTYPE_GOAL
  8. o\Position = New tVector
  9. o\Position\x# = x#
  10. o\Position\y# = y#
  11. o\Position\z# = z#
  12. o\Rotation = New tVector
  13. o\Rotation\x# = rx#
  14. o\Rotation\y# = ry#
  15. o\Rotation\z# = rz#
  16. o\Dest$ = Dest$
  17. o\ObjectCanHoming=False
  18.  
  19. o\Scale=New tVector
  20. o\Scale\x# = sx#
  21. o\Scale\y# = sy#
  22. o\Scale\z# = sz#
  23.  
  24.  
  25.  
  26.  
  27. o\Entity = LoadMesh("Objects\no.b3d")
  28.  
  29.  
  30. If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
  31. o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
  32. EntityTexture(o\IValues[0], Textures_Shadow)
  33. PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
  34.  
  35. o\FValues[0] = PickedNX#()
  36. o\FValues[1] = PickedNY#()
  37. o\FValues[2] = PickedNZ#()
  38.  
  39. MoveEntity(o\IValues[0], 0, 0.2, 0)
  40. ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
  41. EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
  42. End If
  43.  
  44.  
  45. ScaleEntity o\Entity,1.2, 1, 1.2
  46. TranslateEntity o\Entity, x#, y#, z#
  47. TurnEntity o\Entity, rx#, ry#, rz#
  48. Pivot = CreateCube()
  49. PositionEntity(Pivot, x#, y#, z#)
  50. ScaleEntity pivot,sx#,sy#,sz#
  51. EntityAlpha pivot, 0.5
  52. ;TurnEntity pivot,0,ry#+90,rz#
  53. EntityColor Pivot, 255,0,0
  54. Return o
  55.  
  56. End Function
  57.  
  58.  
  59. ; =========================================================================================================
  60. ; Object_Goal_Update
  61. ; =========================================================================================================
  62. ; Updates the goal object
  63.  
  64. Function Object_Goal_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  65.  
  66. ;New code To check the state of the ring
  67. If (o\State=0) Then
  68.  
  69.  
  70.  
  71.  
  72. ; Player collided with ring
  73. If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
  74.  
  75.  
  76. ; Bling!
  77. StopChannel (Channel_Music)
  78. StopChannel (Channel_BoostMusic)
  79.  
  80.  
  81. StageRestart()
  82. normaldest$ = o\Dest$
  83. switchstage=True
  84. Return
  85. EndIf
  86.  
  87. EndIf
  88.  
  89. End Function
  90.  
  91. ; =========================================================================================================
  92. ; Object_Invis_Create
  93. ; =========================================================================================================
  94. ; Creates a New Goalinvis Object
  95. Global testdest$
  96. Global Switchstage=False
  97. Global Normaldest$
  98. Function Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
  99.  
  100. o.tObject = New tObject
  101.  
  102. o\ObjType = OBJTYPE_GOALINVIS
  103.  
  104. o\Position = New tVector
  105. o\Position\x# = x#
  106. o\Position\y# = y#
  107. o\Position\z# = z#
  108. o\Rotation = New tVector
  109. o\Rotation\x# = rx#
  110. o\Rotation\y# = ry#
  111. o\Rotation\z# = rz#
  112. o\Dest$ = Dest$
  113. o\ObjectCanHoming=False
  114.  
  115. o\Scale=New tVector
  116. o\Scale\x# = sx#
  117. o\Scale\y# = sy#
  118. o\Scale\z# = sz#
  119.  
  120.  
  121.  
  122.  
  123. o\Entity = LoadMesh("Objects\no.b3d")
  124.  
  125.  
  126. If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
  127. o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
  128. EntityTexture(o\IValues[0], Textures_Shadow)
  129. PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
  130.  
  131. o\FValues[0] = PickedNX#()
  132. o\FValues[1] = PickedNY#()
  133. o\FValues[2] = PickedNZ#()
  134.  
  135. MoveEntity(o\IValues[0], 0, 0.2, 0)
  136. ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
  137. EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
  138. End If
  139.  
  140.  
  141. ScaleEntity o\Entity,1.2, 1, 1.2
  142. TranslateEntity o\Entity, x#, y#, z#
  143. TurnEntity o\Entity, rx#, ry#, rz#
  144. Pivot = CreateCube()
  145. PositionEntity(Pivot, x#, y#, z#)
  146. ScaleEntity pivot,sx#,sy#,sz#
  147. EntityAlpha pivot, 0.5
  148. ;TurnEntity pivot,0,ry#+90,rz#
  149. EntityColor Pivot, 255,0,0
  150.  
  151. Return o
  152.  
  153. End Function
  154.  
  155.  
  156. ; =========================================================================================================
  157. ; Object_Goalinvis_Update
  158. ; =========================================================================================================
  159. ; Updates the goalinvis object
  160.  
  161. Function Object_GoalInvis_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  162.  
  163. ;New code To check the state of the ring
  164. If (o\State=0) Then
  165.  
  166.  
  167.  
  168.  
  169. ; Player collided with ring
  170. If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
  171.  
  172.  
  173. ; Bling!
  174. StopChannel (Channel_Music)
  175. StopChannel (Channel_BoostMusic)
  176.  
  177.  
  178.  
  179. testdest$ = o\Dest$
  180. switchstage=True
  181. StageRestart()
  182. Return
  183. EndIf
  184.  
  185. EndIf
  186.  
  187. End Function
  188.  
  189.  
  190. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  191. ; Checkpoint
  192. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  193.  
  194.  
  195. ; =========================================================================================================
  196. ; Object_Checkpoint_Create
  197. ; =========================================================================================================
  198. ; Creates a New Ring Object
  199.  
  200. Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
  201.  
  202.  
  203. o.tObject = New tObject
  204.  
  205. o\ObjType = OBJTYPE_CP
  206.  
  207. o\Position = New tVector
  208. o\Position\x# = x#
  209. o\Position\y# = y#
  210. o\Position\z# = z#
  211. o\Rotation = New tVector
  212. o\Rotation\x# = rx#
  213. o\Rotation\y# = ry#
  214. o\Rotation\z# = rz#
  215.  
  216. o\Entity = CopyEntity(Check1_Model)
  217. o\EntityAnimation = CopyEntity(Check2_Model)
  218.  
  219.  
  220.  
  221. EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  222. ScaleEntity o\Entity, 0.6, 0.6, 0.6
  223. TranslateEntity o\Entity, x#, y#, z#
  224. EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  225. ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
  226. TranslateEntity o\EntityAnimation , x#, y#, z#
  227. TurnEntity o\Entity, rx#, ry#, rz#
  228. TurnEntity o\EntityAnimation, rx#, ry#, rz#
  229.  
  230. Return o
  231.  
  232. End Function
  233.  
  234. Global Checkpoint_Activate = False
  235. Global CheckpointIdle =0
  236. Global Spawn_X
  237. Global Spawn_Y
  238. Global Spawn_Z
  239. Global Spawn_rot_X
  240. Global Spawn_rot_Y
  241. Global Spawn_rot_Z
  242. Global CheckTime
  243. ; =========================================================================================================
  244. ; Object_Checkpoint_Update
  245. ; =========================================================================================================
  246. ; Updates the ring object
  247. Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  248. ; Aaron's optimization -- get the distance only once
  249. dist# = EntityDistance(p\Objects\Entity, o\Entity)
  250. ; Check to see if the entity is within a good range for activation
  251. If dist > 0 And dist < 5
  252. ; Check to see if the entity has already been activated
  253. If o\State > 0 And o\State < 2
  254. ; NOTE: You could play a "this checkpoint is not active" sound here
  255. ; Return because the entity has already been activated
  256. Return
  257. EndIf
  258. ; NOTE: This area will NOT be reached if the entity was activated
  259. ; Record that this entity has been activated
  260. o\State = 1
  261. ; Begin the activation effect
  262. Checked = True
  263. PlaySound Sound_Checkpoint
  264. Animate o\EntityAnimation, 3, 0.75
  265. Spawn_X = EntityX(p\Objects\Entity)
  266. Spawn_Y = EntityY(p\Objects\Entity) +1
  267. Spawn_Z = EntityZ(p\Objects\Entity)
  268.  
  269. Spawn_rot_X =-o\Rotation\x#
  270. Spawn_rot_Y =-o\Rotation\y#
  271. Spawn_rot_Z =-o\Rotation\z#
  272. CheckTime = Game\Gameplay\Time
  273. Return
  274. EndIf
  275.  
  276.  
  277. End Function
  278. Global NextStageDest$
  279.  
  280. Function Object_Goal_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
  281.  
  282. o.tObject = New tObject
  283.  
  284. o\ObjType = OBJTYPE_GOAL
  285. o\Position = New tVector
  286. o\Position\x# = x#
  287. o\Position\y# = y#
  288. o\Position\z# = z#
  289. o\Rotation = New tVector
  290. o\Rotation\x# = rx#
  291. o\Rotation\y# = ry#
  292. o\Rotation\z# = rz#
  293. o\Dest$ = Dest$
  294. o\ObjectCanHoming=False
  295.  
  296. o\Scale=New tVector
  297. o\Scale\x# = sx#
  298. o\Scale\y# = sy#
  299. o\Scale\z# = sz#
  300.  
  301.  
  302.  
  303.  
  304. o\Entity = LoadMesh("Objects\no.b3d")
  305.  
  306.  
  307. If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
  308. o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
  309. EntityTexture(o\IValues[0], Textures_Shadow)
  310. PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
  311.  
  312. o\FValues[0] = PickedNX#()
  313. o\FValues[1] = PickedNY#()
  314. o\FValues[2] = PickedNZ#()
  315.  
  316. MoveEntity(o\IValues[0], 0, 0.2, 0)
  317. ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
  318. EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
  319. End If
  320.  
  321.  
  322. ScaleEntity o\Entity,1.2, 1, 1.2
  323. TranslateEntity o\Entity, x#, y#, z#
  324. TurnEntity o\Entity, rx#, ry#, rz#
  325. Pivot = CreateCube()
  326. PositionEntity(Pivot, x#, y#, z#)
  327. ScaleEntity pivot,sx#,sy#,sz#
  328. EntityAlpha pivot, 0.5
  329. ;TurnEntity pivot,0,ry#+90,rz#
  330. EntityColor Pivot, 255,0,0
  331. Return o
  332.  
  333. End Function
  334.  
  335.  
  336. ; =========================================================================================================
  337. ; Object_Goal_Update
  338. ; =========================================================================================================
  339. ; Updates the goal object
  340.  
  341. Function Object_Goal_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  342.  
  343. ;New code To check the state of the ring
  344. If (o\State=0) Then
  345.  
  346.  
  347.  
  348.  
  349. ; Player collided with ring
  350. If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
  351.  
  352.  
  353. ; Bling!
  354. StopChannel (Channel_Music)
  355. StopChannel (Channel_BoostMusic)
  356.  
  357.  
  358. StageRestart()
  359. normaldest$ = o\Dest$
  360. switchstage=True
  361. Return
  362. EndIf
  363.  
  364. EndIf
  365.  
  366. End Function
  367.  
  368. ; =========================================================================================================
  369. ; Object_Invis_Create
  370. ; =========================================================================================================
  371. ; Creates a New Goalinvis Object
  372. Global testdest$
  373. Global Switchstage=False
  374. Global Normaldest$
  375. Function Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
  376.  
  377. o.tObject = New tObject
  378.  
  379. o\ObjType = OBJTYPE_GOALINVIS
  380.  
  381. o\Position = New tVector
  382. o\Position\x# = x#
  383. o\Position\y# = y#
  384. o\Position\z# = z#
  385. o\Rotation = New tVector
  386. o\Rotation\x# = rx#
  387. o\Rotation\y# = ry#
  388. o\Rotation\z# = rz#
  389. o\Dest$ = Dest$
  390. o\ObjectCanHoming=False
  391.  
  392. o\Scale=New tVector
  393. o\Scale\x# = sx#
  394. o\Scale\y# = sy#
  395. o\Scale\z# = sz#
  396.  
  397.  
  398.  
  399.  
  400. o\Entity = LoadMesh("Objects\no.b3d")
  401.  
  402.  
  403. If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
  404. o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
  405. EntityTexture(o\IValues[0], Textures_Shadow)
  406. PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
  407.  
  408. o\FValues[0] = PickedNX#()
  409. o\FValues[1] = PickedNY#()
  410. o\FValues[2] = PickedNZ#()
  411.  
  412. MoveEntity(o\IValues[0], 0, 0.2, 0)
  413. ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
  414. EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
  415. End If
  416.  
  417.  
  418. ScaleEntity o\Entity,1.2, 1, 1.2
  419. TranslateEntity o\Entity, x#, y#, z#
  420. TurnEntity o\Entity, rx#, ry#, rz#
  421. Pivot = CreateCube()
  422. PositionEntity(Pivot, x#, y#, z#)
  423. ScaleEntity pivot,sx#,sy#,sz#
  424. EntityAlpha pivot, 0.5
  425. ;TurnEntity pivot,0,ry#+90,rz#
  426. EntityColor Pivot, 255,0,0
  427.  
  428. Return o
  429.  
  430. End Function
  431.  
  432.  
  433. ; =========================================================================================================
  434. ; Object_Goalinvis_Update
  435. ; =========================================================================================================
  436. ; Updates the goalinvis object
  437.  
  438. Function Object_GoalInvis_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  439.  
  440. ;New code To check the state of the ring
  441. If (o\State=0) Then
  442.  
  443.  
  444.  
  445.  
  446. ; Player collided with ring
  447. If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
  448.  
  449.  
  450. ; Bling!
  451. StopChannel (Channel_Music)
  452. StopChannel (Channel_BoostMusic)
  453.  
  454.  
  455.  
  456. testdest$ = o\Dest$
  457. switchstage=True
  458. StageRestart()
  459. Return
  460. EndIf
  461.  
  462. EndIf
  463.  
  464. End Function
  465.  
  466.  
  467. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  468. ; Checkpoint
  469. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  470.  
  471.  
  472. ; =========================================================================================================
  473. ; Object_Checkpoint_Create
  474. ; =========================================================================================================
  475. ; Creates a New Ring Object
  476.  
  477. Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
  478.  
  479.  
  480. o.tObject = New tObject
  481.  
  482. o\ObjType = OBJTYPE_CP
  483.  
  484. o\Position = New tVector
  485. o\Position\x# = x#
  486. o\Position\y# = y#
  487. o\Position\z# = z#
  488. o\Rotation = New tVector
  489. o\Rotation\x# = rx#
  490. o\Rotation\y# = ry#
  491. o\Rotation\z# = rz#
  492.  
  493. o\Entity = CopyEntity(Check1_Model)
  494. o\EntityAnimation = CopyEntity(Check2_Model)
  495.  
  496.  
  497.  
  498. EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  499. ScaleEntity o\Entity, 0.6, 0.6, 0.6
  500. TranslateEntity o\Entity, x#, y#, z#
  501. EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  502. ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
  503. TranslateEntity o\EntityAnimation , x#, y#, z#
  504. TurnEntity o\Entity, rx#, ry#, rz#
  505. TurnEntity o\EntityAnimation, rx#, ry#, rz#
  506.  
  507. Return o
  508.  
  509. End Function
  510.  
  511. Global Checkpoint_Activate = False
  512. Global CheckpointIdle =0
  513. Global Spawn_X
  514. Global Spawn_Y
  515. Global Spawn_Z
  516. Global Spawn_rot_X
  517. Global Spawn_rot_Y
  518. Global Spawn_rot_Z
  519. Global CheckTime
  520. ; =========================================================================================================
  521. ; Object_Checkpoint_Update
  522. ; =========================================================================================================
  523. ; Updates the ring object
  524. Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  525. ; Aaron's optimization -- get the distance only once
  526. dist# = EntityDistance(p\Objects\Entity, o\Entity)
  527. ; Check to see if the entity is within a good range for activation
  528. If dist > 0 And dist < 5
  529. ; Check to see if the entity has already been activated
  530. If o\State > 0 And o\State < 2
  531. ; NOTE: You could play a "this checkpoint is not active" sound here
  532. ; Return because the entity has already been activated
  533. Return
  534. EndIf
  535. ; NOTE: This area will NOT be reached if the entity was activated
  536. ; Record that this entity has been activated
  537. o\State = 1
  538. ; Begin the activation effect
  539. Checked = True
  540. PlaySound Sound_Checkpoint
  541. Animate o\EntityAnimation, 3, 0.75
  542. Spawn_X = EntityX(p\Objects\Entity)
  543. Spawn_Y = EntityY(p\Objects\Entity) +1
  544. Spawn_Z = EntityZ(p\Objects\Entity)
  545.  
  546. Spawn_rot_X =-o\Rotation\x#
  547. Spawn_rot_Y =-o\Rotation\y#
  548. Spawn_rot_Z =-o\Rotation\z#
  549. CheckTime = Game\Gameplay\Time
  550. Return
  551. EndIf
  552.  
  553.  
  554. End Function
  555. Global NextStageDest$
  556.  
  557. Function Object_Goal_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
  558.  
  559. o.tObject = New tObject
  560.  
  561. o\ObjType = OBJTYPE_GOAL
  562. o\Position = New tVector
  563. o\Position\x# = x#
  564. o\Position\y# = y#
  565. o\Position\z# = z#
  566. o\Rotation = New tVector
  567. o\Rotation\x# = rx#
  568. o\Rotation\y# = ry#
  569. o\Rotation\z# = rz#
  570. o\Dest$ = Dest$
  571. o\ObjectCanHoming=False
  572.  
  573. o\Scale=New tVector
  574. o\Scale\x# = sx#
  575. o\Scale\y# = sy#
  576. o\Scale\z# = sz#
  577.  
  578.  
  579.  
  580.  
  581. o\Entity = LoadMesh("Objects\no.b3d")
  582.  
  583.  
  584. If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
  585. o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
  586. EntityTexture(o\IValues[0], Textures_Shadow)
  587. PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
  588.  
  589. o\FValues[0] = PickedNX#()
  590. o\FValues[1] = PickedNY#()
  591. o\FValues[2] = PickedNZ#()
  592.  
  593. MoveEntity(o\IValues[0], 0, 0.2, 0)
  594. ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
  595. EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
  596. End If
  597.  
  598.  
  599. ScaleEntity o\Entity,1.2, 1, 1.2
  600. TranslateEntity o\Entity, x#, y#, z#
  601. TurnEntity o\Entity, rx#, ry#, rz#
  602. Pivot = CreateCube()
  603. PositionEntity(Pivot, x#, y#, z#)
  604. ScaleEntity pivot,sx#,sy#,sz#
  605. EntityAlpha pivot, 0.5
  606. ;TurnEntity pivot,0,ry#+90,rz#
  607. EntityColor Pivot, 255,0,0
  608. Return o
  609.  
  610. End Function
  611.  
  612.  
  613. ; =========================================================================================================
  614. ; Object_Goal_Update
  615. ; =========================================================================================================
  616. ; Updates the goal object
  617.  
  618. Function Object_Goal_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  619.  
  620. ;New code To check the state of the ring
  621. If (o\State=0) Then
  622.  
  623.  
  624.  
  625.  
  626. ; Player collided with ring
  627. If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
  628.  
  629.  
  630. ; Bling!
  631. StopChannel (Channel_Music)
  632. StopChannel (Channel_BoostMusic)
  633.  
  634.  
  635. StageRestart()
  636. normaldest$ = o\Dest$
  637. switchstage=True
  638. Return
  639. EndIf
  640.  
  641. EndIf
  642.  
  643. End Function
  644.  
  645. ; =========================================================================================================
  646. ; Object_Invis_Create
  647. ; =========================================================================================================
  648. ; Creates a New Goalinvis Object
  649. Global testdest$
  650. Global Switchstage=False
  651. Global Normaldest$
  652. Function Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,Dest$,sx#,sy#,sz#)
  653.  
  654. o.tObject = New tObject
  655.  
  656. o\ObjType = OBJTYPE_GOALINVIS
  657.  
  658. o\Position = New tVector
  659. o\Position\x# = x#
  660. o\Position\y# = y#
  661. o\Position\z# = z#
  662. o\Rotation = New tVector
  663. o\Rotation\x# = rx#
  664. o\Rotation\y# = ry#
  665. o\Rotation\z# = rz#
  666. o\Dest$ = Dest$
  667. o\ObjectCanHoming=False
  668.  
  669. o\Scale=New tVector
  670. o\Scale\x# = sx#
  671. o\Scale\y# = sy#
  672. o\Scale\z# = sz#
  673.  
  674.  
  675.  
  676.  
  677. o\Entity = LoadMesh("Objects\no.b3d")
  678.  
  679.  
  680. If (LinePick(x#, y#, z#, 0, -OMEGA#, 0)<>0) Then
  681. o\IValues[0] = CreateQuad(3, 1.1, 1.5, 0.5)
  682. EntityTexture(o\IValues[0], Textures_Shadow)
  683. PositionEntity(o\IValues[0], PickedX#(), PickedY#(), PickedZ#(), True)
  684.  
  685. o\FValues[0] = PickedNX#()
  686. o\FValues[1] = PickedNY#()
  687. o\FValues[2] = PickedNZ#()
  688.  
  689. MoveEntity(o\IValues[0], 0, 0.2, 0)
  690. ScaleEntity(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1), 1-Min#((y#-PickedY#())/120, 1))
  691. EntityAlpha(o\IValues[0], 1-Min#((y#-PickedY#())/120, 1))
  692. End If
  693.  
  694.  
  695. ScaleEntity o\Entity,1.2, 1, 1.2
  696. TranslateEntity o\Entity, x#, y#, z#
  697. TurnEntity o\Entity, rx#, ry#, rz#
  698. Pivot = CreateCube()
  699. PositionEntity(Pivot, x#, y#, z#)
  700. ScaleEntity pivot,sx#,sy#,sz#
  701. EntityAlpha pivot, 0.5
  702. ;TurnEntity pivot,0,ry#+90,rz#
  703. EntityColor Pivot, 255,0,0
  704.  
  705. Return o
  706.  
  707. End Function
  708.  
  709.  
  710. ; =========================================================================================================
  711. ; Object_Goalinvis_Update
  712. ; =========================================================================================================
  713. ; Updates the goalinvis object
  714.  
  715. Function Object_GoalInvis_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  716.  
  717. ;New code To check the state of the ring
  718. If (o\State=0) Then
  719.  
  720.  
  721.  
  722.  
  723. ; Player collided with ring
  724. If (Abs(EntityX(p\Objects\Entity) - o\Position\x) < o\Scale\x) And (Abs(EntityY(p\Objects\Entity) - o\Position\y) < o\Scale\y) And (Abs(EntityZ(p\Objects\Entity) - o\Position\z) < o\Scale\z) Then
  725.  
  726.  
  727. ; Bling!
  728. StopChannel (Channel_Music)
  729. StopChannel (Channel_BoostMusic)
  730.  
  731.  
  732.  
  733. testdest$ = o\Dest$
  734. switchstage=True
  735. StageRestart()
  736. Return
  737. EndIf
  738.  
  739. EndIf
  740.  
  741. End Function
  742.  
  743.  
  744. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  745. ; Checkpoint
  746. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  747.  
  748.  
  749. ; =========================================================================================================
  750. ; Object_Checkpoint_Create
  751. ; =========================================================================================================
  752. ; Creates a New Ring Object
  753.  
  754. Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
  755.  
  756.  
  757. o.tObject = New tObject
  758.  
  759. o\ObjType = OBJTYPE_CP
  760.  
  761. o\Position = New tVector
  762. o\Position\x# = x#
  763. o\Position\y# = y#
  764. o\Position\z# = z#
  765. o\Rotation = New tVector
  766. o\Rotation\x# = rx#
  767. o\Rotation\y# = ry#
  768. o\Rotation\z# = rz#
  769.  
  770. o\Entity = CopyEntity(Check1_Model)
  771. o\EntityAnimation = CopyEntity(Check2_Model)
  772.  
  773.  
  774.  
  775. EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  776. ScaleEntity o\Entity, 0.6, 0.6, 0.6
  777. TranslateEntity o\Entity, x#, y#, z#
  778. EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  779. ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
  780. TranslateEntity o\EntityAnimation , x#, y#, z#
  781. TurnEntity o\Entity, rx#, ry#, rz#
  782. TurnEntity o\EntityAnimation, rx#, ry#, rz#
  783.  
  784. Return o
  785.  
  786. End Function
  787.  
  788. Global Checkpoint_Activate = False
  789. Global CheckpointIdle =0
  790. Global Spawn_X
  791. Global Spawn_Y
  792. Global Spawn_Z
  793. Global Spawn_rot_X
  794. Global Spawn_rot_Y
  795. Global Spawn_rot_Z
  796. Global CheckTime
  797. ; =========================================================================================================
  798. ; Object_Checkpoint_Update
  799. ; =========================================================================================================
  800. ; Updates the ring object
  801. Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  802. ; Aaron's optimization -- get the distance only once
  803. dist# = EntityDistance(p\Objects\Entity, o\Entity)
  804. ; Check to see if the entity is within a good range for activation
  805. If dist > 0 And dist < 5
  806. ; Check to see if the entity has already been activated
  807. If o\State > 0 And o\State < 2
  808. ; NOTE: You could play a "this checkpoint is not active" sound here
  809. ; Return because the entity has already been activated
  810. Return
  811. EndIf
  812. ; NOTE: This area will NOT be reached if the entity was activated
  813. ; Record that this entity has been activated
  814. o\State = 1
  815. ; Begin the activation effect
  816. Checked = True
  817. PlaySound Sound_Checkpoint
  818. Animate o\EntityAnimation, 3, 0.75
  819. Spawn_X = EntityX(p\Objects\Entity)
  820. Spawn_Y = EntityY(p\Objects\Entity) +1
  821. Spawn_Z = EntityZ(p\Objects\Entity)
  822.  
  823. Spawn_rot_X =-o\Rotation\x#
  824. Spawn_rot_Y =-o\Rotation\y#
  825. Spawn_rot_Z =-o\Rotation\z#
  826. CheckTime = Game\Gameplay\Time
  827. Return
  828. EndIf
  829.  
  830.  
  831. End Function
  832.  
  833.  
  834.  
  835.  
  836.  
  837. Case "goal"
  838. ; Update progress bar
  839. Game_Stage_UpdateProgressBar("Loading object n."+j+": Goal Ring", Float#(j)/Float#(xmlNodeChildCount(RootChildNode)))
  840.  
  841. positionX# = 0
  842. positionY# = 0
  843. positionZ# = 0
  844.  
  845. rotationX# = 0
  846. rotationY# = 0
  847. rotationZ# = 0
  848.  
  849.  
  850.  
  851. normalDest$ = xmlNodeAttributeValueGet(SceneChildNode, "dest")
  852. ; Setup position, rotation and scale.
  853. ScenePosition = xmlNodeFind("position", SceneChildNode)
  854. If (ScenePosition<>0) Then
  855. positionX# = Float(xmlNodeAttributeValueGet(ScenePosition, "x"))
  856. positionY# = Float(xmlNodeAttributeValueGet(ScenePosition, "y"))
  857. positionZ# = Float(xmlNodeAttributeValueGet(ScenePosition, "z"))
  858. End If
  859.  
  860. SceneRotation = xmlNodeFind("rotation", SceneChildNode)
  861. If (SceneRotation<>0) Then
  862. rotationX# = Float(xmlNodeAttributeValueGet(SceneRotation, "pitch"))
  863. rotationY# = Float(xmlNodeAttributeValueGet(SceneRotation, "yaw"))
  864. rotationZ# = Float(xmlNodeAttributeValueGet(SceneRotation, "roll"))
  865. End If
  866.  
  867. obj.tObject = Object_Goal_Create(positionX#, positionY#, positionZ#,rotationX#,rotationy#,rotationZ#,"")
  868.  
  869. Case "goalinvis"
  870. ; Update progress bar
  871. Game_Stage_UpdateProgressBar("Loading object n."+j+": Stage Gate", Float#(j)/Float#(xmlNodeChildCount(RootChildNode)))
  872.  
  873.  
  874.  
  875. positionX# = 0
  876. positionY# = 0
  877. positionZ# = 0
  878.  
  879. rotationX# = 0
  880. rotationY# = 0
  881. rotationZ# = 0
  882.  
  883. scaleX# = 5
  884. scaleY# = 5
  885. scaleZ# = 5
  886.  
  887. Dest$ = xmlNodeAttributeValueGet(SceneChildNode, "dest")
  888. ; Setup position, rotation and scale.
  889. ScenePosition = xmlNodeFind("position", SceneChildNode)
  890. If (ScenePosition<>0) Then
  891. positionX# = Float(xmlNodeAttributeValueGet(ScenePosition, "x"))
  892. positionY# = Float(xmlNodeAttributeValueGet(ScenePosition, "y"))
  893. positionZ# = Float(xmlNodeAttributeValueGet(ScenePosition, "z"))
  894. End If
  895.  
  896. SceneRotation = xmlNodeFind("rotation", SceneChildNode)
  897. If (SceneRotation<>0) Then
  898. rotationX# = Float(xmlNodeAttributeValueGet(SceneRotation, "pitch"))
  899. rotationY# = Float(xmlNodeAttributeValueGet(SceneRotation, "yaw"))
  900. rotationZ# = Float(xmlNodeAttributeValueGet(SceneRotation, "roll"))
  901. End If
  902.  
  903. SceneScale = xmlNodeFind("scale", SceneChildNode)
  904. If (SceneScale<>0) Then
  905. scaleX# = Float(xmlNodeAttributeValueGet(SceneScale, "x"))
  906. scaleY# = Float(xmlNodeAttributeValueGet(SceneScale, "y"))
  907. scaleZ# = Float(xmlNodeAttributeValueGet(SceneScale, "z"))
  908. End If
  909.  
  910. Object_GoalInvis_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0,dest$,sx#,sy#,sz#,"")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement