Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. //Artillery Script by Sharpe\\
  2. /*/*//*/*//*/*//*/*//*/*//*/*//*/*//*
  3.  
  4. \\
  5. \\
  6. \\___.
  7. _((|_L]_
  8. _/(__(\_ _)\_
  9.  
  10. //*//*/*//*/*//*/*//*/*//*/*//*/*/
  11.  
  12. #using_animtree( "custom_anims" );
  13.  
  14. #define LAUNCH_EXP "sharpe/artillery/launch_exp"
  15. #define LAUNCH_SMK "sharpe/artillery/launch_smk"
  16. #define BULLET "veh_t7_drone_raps"
  17. #define IMPACT "sharpe/artillery/impact"
  18. #define ANIM "flak38anim"
  19.  
  20. #precache( "model", BULLET );
  21. #precache( "xanim", ANIM );
  22. #precache( "fx" , LAUNCH_EXP );
  23. #precache( "fx" , LAUNCH_SMK );
  24. #precache( "fx" , IMPACT );
  25.  
  26.  
  27. function autoexec init()
  28. {
  29. //==============Variables to Change============\
  30. level.time_to_impact = 1;
  31. level.cooldown = 40;
  32. level.exp_radius = 1;
  33. //============Variables to Not Change==========\
  34.  
  35. level.artillery = GetEntArray( "artillery_trigger", "targetname" );
  36. level.players = GetPlayers();
  37.  
  38. main();
  39. }
  40.  
  41. function main()
  42. {
  43. foreach(artillery in level.artillery)
  44. artillery thread artillery();
  45. }
  46.  
  47. function artillery()
  48. {
  49. //Clean Up for when the game is over
  50. self endon("death");
  51. level endon("end_game");
  52.  
  53. //Get rid of the hint icon
  54. self SetCursorHint("HINT_NOICON");
  55.  
  56. model = GetEnt( self.target , "targetname" );
  57. muzzle = GetEnt( model.target , "targetname" );
  58. bullet = GetEnt( muzzle.target, "targetname" );
  59. arcLoc = GetEnt( bullet.target, "targetname" );
  60. impact = GetEnt( arcLoc.target, "targetname" );
  61.  
  62. wait(RandomIntRange(1, 20));
  63. while(true)
  64. {
  65. //Set the hint to say we are ready to fire
  66. self SetHintString( "Hold ^3&&1^7 to fire");
  67. //Wait till a player activate the artillery
  68. wait(10);
  69.  
  70. //Update the hintstring for firing
  71. self SetHintString( "Firing" );
  72. //Play the launch sound
  73. PlaySoundAtPosition( "artillery_launch", muzzle.origin );
  74.  
  75. launch_smoke = PlayFX(LAUNCH_SMK, muzzle.origin );
  76. launch_smoke.angles = muzzle.angles;
  77. launch_explosion = PlayFX(LAUNCH_EXP, muzzle.origin );
  78. launch_explosion.angles = muzzle.angles;
  79.  
  80. play_anims(model);
  81.  
  82. bullet.origin = muzzle.origin;
  83. bullet.angles = muzzle.angles;
  84. bullet PlaySound("artillery_whistle");
  85.  
  86. thread move_bullet(bullet, arcLoc, impact);
  87.  
  88. wait( level.time_to_impact );
  89.  
  90. //Play the impact sound
  91. impact PlaySound( "artillery_impact" );
  92. impact_fx = PlayFX(IMPACT, impact.origin);
  93. impact_fx.angles = impact.angles;
  94.  
  95. radius = spawn( "trigger_radius", impact.origin, 1, level.exp_radius, level.exp_radius );
  96.  
  97. //self SetHintString( "Cooling Down" );
  98.  
  99. //self PlaySound ( "artillery_ready" );
  100. }
  101. }
  102.  
  103. function move_bullet(bullet, arc, impact)
  104. {
  105. half_time = level.time_to_impact / 2;
  106. bullet MoveTo(arc.origin, half_time);
  107. wait(half_time);
  108. bullet.angles = arc.angles;
  109. bullet MoveTo(impact.origin, half_time);
  110. wait(half_time);
  111. bullet MoveZ(-1000, 0.1);
  112. wait(0.1);
  113. }
  114.  
  115. function play_anims(model)
  116. {
  117. model useanimtree(#animtree);
  118. model AnimScripted( ANIM, model.origin , model.angles, %flak38anim); // Add Your Anims file name where you see "Your_Anim_fileName_Here" in both spots.
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement