Advertisement
Guest User

Untitled

a guest
May 25th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.76 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. testdest$ = 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. StageRestart()
  179. testdest$ = o\Dest$
  180. switchstage=True
  181. Return
  182. EndIf
  183.  
  184. EndIf
  185.  
  186. End Function
  187.  
  188.  
  189. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  190. ; Checkpoint
  191. ; /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  192.  
  193.  
  194. ; =========================================================================================================
  195. ; Object_Checkpoint_Create
  196. ; =========================================================================================================
  197. ; Creates a New Ring Object
  198.  
  199. Function Object_Checkpoint_Create.tObject(x#, y#, z#,rx#=0, ry#=0, rz#=0)
  200.  
  201.  
  202. o.tObject = New tObject
  203.  
  204. o\ObjType = OBJTYPE_CP
  205.  
  206. o\Position = New tVector
  207. o\Position\x# = x#
  208. o\Position\y# = y#
  209. o\Position\z# = z#
  210. o\Rotation = New tVector
  211. o\Rotation\x# = rx#
  212. o\Rotation\y# = ry#
  213. o\Rotation\z# = rz#
  214.  
  215. o\Entity = CopyEntity(Check1_Model)
  216. o\EntityAnimation = CopyEntity(Check2_Model)
  217.  
  218.  
  219.  
  220. EntityAutoFade(o\Entity, OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  221. ScaleEntity o\Entity, 0.6, 0.6, 0.6
  222. TranslateEntity o\Entity, x#, y#, z#
  223. EntityAutoFade(o\EntityAnimation , OBJECT_VIEWDISTANCE_MIN#, OBJECT_VIEWDISTANCE_MAX#)
  224. ScaleEntity o\EntityAnimation , 0.6, 0.6, 0.6
  225. TranslateEntity o\EntityAnimation , x#, y#, z#
  226. TurnEntity o\Entity, rx#, ry#, rz#
  227. TurnEntity o\EntityAnimation, rx#, ry#, rz#
  228.  
  229. Return o
  230.  
  231. End Function
  232.  
  233. Global Checkpoint_Activate = False
  234. Global CheckpointIdle =0
  235. Global Spawn_X
  236. Global Spawn_Y
  237. Global Spawn_Z
  238. Global Spawn_rot_X
  239. Global Spawn_rot_Y
  240. Global Spawn_rot_Z
  241. Global CheckTime
  242. ; =========================================================================================================
  243. ; Object_Checkpoint_Update
  244. ; =========================================================================================================
  245. ; Updates the ring object
  246. Function Object_Checkpoint_Update(o.tObject, p.tPlayer, d.tDeltaTime)
  247. ; Aaron's optimization -- get the distance only once
  248. dist# = EntityDistance(p\Objects\Entity, o\Entity)
  249. ; Check to see if the entity is within a good range for activation
  250. If dist > 0 And dist < 5
  251. ; Check to see if the entity has already been activated
  252. If o\State > 0 And o\State < 2
  253. ; NOTE: You could play a "this checkpoint is not active" sound here
  254. ; Return because the entity has already been activated
  255. Return
  256. EndIf
  257. ; NOTE: This area will NOT be reached if the entity was activated
  258. ; Record that this entity has been activated
  259. o\State = 1
  260. ; Begin the activation effect
  261. Checked = True
  262. PlaySound Sound_Checkpoint
  263. Animate o\EntityAnimation, 3, 0.75
  264. Spawn_X = EntityX(p\Objects\Entity)
  265. Spawn_Y = EntityY(p\Objects\Entity) +1
  266. Spawn_Z = EntityZ(p\Objects\Entity)
  267.  
  268. Spawn_rot_X =-o\Rotation\x#
  269. Spawn_rot_Y =-o\Rotation\y#
  270. Spawn_rot_Z =-o\Rotation\z#
  271. CheckTime = Game\Gameplay\Time
  272. Return
  273. EndIf
  274.  
  275.  
  276. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement