Advertisement
LunaScripts

Death Prop EDIT

Feb 29th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. @name Death Prop Edit
  2. @persist E:entity O:entity Hold Attack Dest:vector Vec:vector Ang:angle
  3. if(first()){
  4. #Make the angle for the death ball to spin randomly
  5. A = 45
  6. Ang = ang(randint(-A,A),randint(-A,A),randint(-A,A)) * 50000
  7. #Hide the chip
  8. entity():setColor(0,0,0,0)
  9. O = owner()
  10. runOnTick(1)
  11. }
  12.  
  13. Pos=E:pos()
  14. #Spin the ball randomly
  15. E:applyAngForce(Ang+$Ang*5)
  16. #Only hover if the owner is alive
  17. if(O:isAlive()){
  18. #If holding, then move the chip above the owners head
  19. if(Hold){
  20. #Set Destination
  21. Dest=O:pos()+vec(0,0,(200+E:radius()))
  22. #If the ball is close, move slowly and accurately
  23. if(Pos:distance(Dest)<50){
  24. Attack = 0
  25. Vec=(Dest-Pos)*E:mass()
  26. E:applyForce(Vec+$Vec*5)
  27. }
  28. #If its far away, move quickly
  29. else{
  30. Vec=(Dest-Pos)*E:mass()*Pos:distance(Dest)*50000
  31. E:applyForce(Vec)
  32. }
  33. }
  34. #If the owner left clicks, start the attack sequence
  35. if(Attack==0&O:keyAttack1()&E&O:aimEntity()!=E){
  36. #Just incase it gets stuck
  37. stoptimer("ManualReset")
  38. timer("ManualReset",3000)
  39. Dest=O:aimPos()
  40. Hold=0
  41. Attack=1
  42. }
  43. #Attack Code - Strikes the spot once
  44. if(Attack==1){
  45. Vec=(Dest-Pos)*E:mass()*50000*Pos:distance(Dest)
  46. E:applyForce(Vec)
  47. #When the ball reaches its target, go back to holding
  48. if((Pos:distance(Dest)<20)){
  49. Attack=2
  50. Hold=1
  51. }
  52. }
  53. #Attack 2 code - Flys constantly at the spot
  54. if(O:keyAttack2()&E&O:aimEntity()!=E){
  55. Attack=0
  56. Hold=1
  57. Dest=O:aimPos()
  58. Vec=(Dest-Pos)*E:mass()*50000*Pos:distance(Dest)
  59. E:applyForce(Vec)
  60. }
  61. if((O:keyUse()|O:keyAttack1()|O:keyAttack2())&!E){
  62. print("ERROR: No prop selected")
  63. }
  64. #If porp is stuck, return to owner
  65. if(clk("ManualReset")){
  66. Attack=0
  67. Hold=1
  68. }
  69. #Prop selection code
  70. if(O:keyUse()&O:aimEntity()&O:aimEntity()!=E){
  71. #Set the old prop to 5 mass and remove the trail
  72. E:setMass(5)
  73. E:removeTrails()
  74. #Designate the new prop and play with its properties
  75. E=O:aimEntity()
  76. E:setTrails(130,0,0.1,"trails/laser",vec(255,255,255),255)
  77. E:setMaterial("effects/ar2_altfire1b")
  78. #E:setMaterial("models/props_combine/metal_combinebridge001")
  79. E:setMass(50000)
  80. print("Prop selected")
  81. Hold=1
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement