Advertisement
Guest User

missile buckshot

a guest
Jul 20th, 2015
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.56 KB | None | 0 0
  1. //HIS CODE
  2. /*createMissileOnFire()
  3. {
  4.     self endon("death");
  5.     self endon("disconnect");
  6.    
  7.     self giveWeapon("fnp45_mp");
  8.     self switchtoweapon("fnp45_mp");
  9.     self givemaxammo("fnp45_mp");
  10.    
  11.     level.SmokeFxEffect = loadfx( "weapon/trophy_system/fx_trophy_deploy_impact" );
  12.     self iprintln("^2ON");
  13.     for(;;)
  14.     {
  15.         self waittill("weapon_fired");
  16.         if(self getcurrentweapon()=="fnp45_mp")
  17.         {
  18.             self.nullPoint = self getCursorPos2();
  19.             self.proj = spawn("script_model", self getTagOrigin("tag_weapon_right"));
  20.             self.proj setModel("t6_wpn_projectile_rpg7");
  21.             self.proj.angles = self.angles;
  22.             self.proj thread loopEffect(level.SmokeFxEffect, 10);
  23.             // Takes ENTITY TYPE & TIME
  24.             wait 0.01;
  25.             //Initializing Missile Speed / Missile Distance
  26.             speed = 1750;
  27.             duration = readDistance(speed, self.proj.origin, self.nullPoint);
  28.             //Initializing Variables For forceGravity()
  29.             force = 5;
  30.             timescale = 0.1;
  31.             //Starting Missile Movement
  32.             self.proj moveTo(self.nullPoint, duration);
  33.             self.proj rotateTo(self.nullPoint, duration);
  34.             //Implementing Gravity / Checking For Unit Collision
  35.             forceGravity(self.proj, self.nullPoint, force, duration, timescale);
  36.             checkCollision(self.proj, level.chopper_fx["explode"]["large"], "wpn_rocket_explode");
  37.         }
  38.     }
  39. }
  40. forceGravity(ent, target, force, duration, timescale)
  41. {
  42.     //Altitude Decrease
  43.     for(i = 0;i < duration;i += force)
  44.     {
  45.         target = target - (0, 0, i);
  46.         ent moveTo(target, duration);
  47.         ent rotateTo(target, duration);
  48.         wait timescale;
  49.     }
  50.     self notify("canExplode");
  51. }
  52. checkCollision(ent, fxIfCollides, sfxIfCollides)
  53. {
  54.     vector = anglesToForward(ent.angles);
  55.     forward = ent.origin+(vector[0]*45,vector[1]*45,vector[2]*49);
  56.     collision = bulletTrace(ent.origin,forward,false,self);
  57.     while(1)
  58.     {
  59.         if(collision)
  60.         {
  61.             addEffect(ent.origin, fxIfCollides);
  62.             ent playsound(sfxIfCollides);
  63.             RadiusDamage(ent.origin, 450, 700,350, self, "MOD_PROJECTILE_SPLASH","remote_missile_bomblet_mp");
  64.             //This can be changed if needed
  65.             ent delete();
  66.             break;
  67.         }
  68.         else
  69.         {
  70.             self waittill("canExplode");
  71.             addEffect(ent.origin, fxIfCollides);
  72.             ent playsound(sfxIfCollides);
  73.             RadiusDamage(ent.origin, 450, 700,350, self, "MOD_PROJECTILE_SPLASH","remote_missile_bomblet_mp");
  74.             //This can be changed if needed
  75.             ent delete();
  76.         }
  77.         break;
  78.     }
  79. }
  80. loopEffect(effect, time)
  81. {
  82.     for(i=0;i<time;i++)
  83.     {
  84.         playFxOnTag(effect,self,"tag_origin");
  85.         wait 0.2;
  86.     }
  87. }
  88. readDistance(speed,origin,moveTo)
  89. {
  90.     return (distance(origin,moveTo)/speed);
  91. }
  92. //House Keeping
  93. addEffect( groundpoint, fx )
  94. {
  95.     effect = spawnFx( fx, groundpoint, (0,0,1), (1,0,0) );
  96.     triggerFx( effect );
  97.     return effect;
  98. }
  99. GetCursorPos2()
  100. {
  101.     return BulletTrace(self getTagOrigin( "tag_weapon_right" ),vector_scal(anglestoforward(self getPlayerAngles()),1000000),false,self)["position"];
  102. }
  103. vector_Scal(vec, scale)
  104. {
  105.         vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
  106.         return vec;
  107. }*/
  108.  
  109. ////////////////////////////////////////////////////////////
  110.  
  111.  
  112. //MY CODE
  113. initbuckshot()
  114. {
  115.     self.bucsh=booleanOpposite(self.bucsh);
  116.     self iPrintln(booleanReturnVal(self.bucsh,"Missile Buckshot ^1OFF","Missile Buckshot ^2ON"));
  117.     if(self.isbuckshot==0||self.bucsh)
  118.     {
  119.         self giveWeapon("fnp45_mp");
  120.         self switchToWeapon("fnp45_mp");
  121.         self givemaxammo("fnp45_mp");
  122.         self notify("GiveNewWeapon");
  123.         self thread dobuckshot();
  124.         self.isbuckshot=1;
  125.     }
  126.     else
  127.     {
  128.         self notify("stop_buckshot");
  129.         self notify("stop_buckshotFX");
  130.         self takeWeapon("fnp45_mp");
  131.         self.isbuckshot=0;
  132.     }
  133. }
  134. dobuckshot()
  135. {
  136.     self endon("disconnect");
  137.     self endon("game_ended");
  138.     self endon("stop_buckshot");
  139.     self thread waitbuckshotSuicide();
  140.     for(;;)
  141.     {
  142.         self waittill("weapon_fired");
  143.         if(self getCurrentWeapon()== "fnp45_mp")
  144.         {
  145.             self playsound("wpn_rpg_fire_plr");
  146.             self thread mainbuckshot();
  147.         }
  148.     }
  149. }
  150. mainbuckshot()
  151. {
  152.     weapOrigin=self getTagOrigin("tag_weapon_right");
  153.     target=self traceBullet();
  154.     buckshotMissile=spawn("script_model",weapOrigin);
  155.     buckshotMissile setModel("t6_wpn_projectile_rpg7");
  156.     buckshotMissile.killcament=buckshotMissile;
  157.     endLocation=BulletTrace(buckshotMissile.origin,target,0,self)["position"];
  158.     buckshotMissile.angles=VectorToAngles(endLocation - buckshotMissile.origin);
  159.     buckshotMissile rotateto(VectorToAngles(endLocation - buckshotMissile.origin),0.001);
  160.     buckshotMissile moveto(endLocation,0.55);
  161.     self thread buckshotEffect(buckshotMissile,endLocation);
  162.     wait 0.556;
  163.     self notify("stop_buckshotFX");
  164.     playfx(level.buckshotexplo,buckshotMissile.origin);
  165.     buckshotMissile playsound("wpn_rocket_explode");
  166.     earthquake(1,1,buckshotMissile.origin,300);
  167.     buckshotMissile RadiusDamage(buckshotMissile.origin,200,200,200,self);
  168.     buckshotMissile delete();
  169. }
  170. buckshotEffect(object,target)
  171. {
  172.     self endon("disconnect");
  173.     self endon("game_ended");
  174.     self endon("stop_buckshotFX_Final");
  175.     self endon("stop_buckshot");
  176.     buckshotLaser=loadfx( "weapon/trophy_system/fx_trophy_deploy_impact" );
  177.     for(;;)
  178.     {
  179.         buckshotGreen=spawnFx(buckshotLaser,object.origin,VectorToAngles(target - object.origin));
  180.         triggerFx(buckshotGreen);
  181.         wait 0.0005;
  182.     }
  183.     for(;;)
  184.     {
  185.         self waittill("stop_buckshotFX");
  186.         self notify("stop_buckshotFX_Final");
  187.     }
  188. }
  189. waitbuckshotSuicide()
  190. {
  191.     self endon("disconnect");
  192.     self endon("game_ended");
  193.     self waittill("death");
  194.     self notify("stop_buckshot");
  195.     self notify("stop_buckshotFX");
  196.     self.isbuckshot=0;
  197. }
  198. traceBullet()
  199. {
  200.         return bulletTrace(self getEye(), self getEye()+vectorScale(anglesToForward(self getPlayerAngles()), 1000000), false, self)["position"];
  201. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement