Post: [Code] Real Explosive Bullets
07-29-2015, 12:49 AM #1
-Numb
You talkin to me?
(adsbygoogle = window.adsbygoogle || []).push({}); Hello NGU!
I made an advanced explosive bullets script.. I think it is much better than the "RadiusDamage" explosive bullets that most of you probably know.
I know there have been made similar type of EB back in the mw2 1.11 days, so yeah credits to whoever came up with this idea.

I also added some variables so you can easily edit the radius, damage, make it trough walls and sniper only..


Put this a place it gets runned only once.. Like onPlayerConnect/onPlayerSpawned etc.
    self.EBRadius = 400;
self.EBDamage = 100;
self.EBMethod = "MOD_RIFLE_BULLET";
self.EBTroughWalls = false;
self.SniperOnlyEB = false;

Of cource you can edit them as much as you want if you would like a bigger radius/higher damage/sniper only by default..

Here is the actual EB code
    RealEB() //This is the toggle! Call this in your menu..
{
if(self.NumbsEB == false )
{
self.NumbsEB = true;
self thread NumbsRealEB();
self iPrintln("Real Explosive Bullets: [^2ON^7]");
}
else
{
self.NumbsEB = false;
self notify("StopRealEB");
self iPrintln("Real Explosive Bullets: [^1OFF^7]");
}
}

NumbsRealEB()
{
self endon("disconnect");
self endon("StopRealEB");

for(;Winky Winky
{
self waittill( "weapon_fired" );
forward = self getTagOrigin("j_head");
end = self thread vector_scal(anglestoforward(self getPlayerAngles()),1000000);
ExplosiveLocation = BulletTrace( forward, end, 0, self )[ "position" ];

if(self.SniperOnlyEB) { if(!isSubStr(self getCurrentWeapon(), "svu_") && !isSubStr(self getCurrentWeapon(), "dsr50_") && !isSubStr(self getCurrentWeapon(), "ballista_") && !isSubStr(self getCurrentWeapon(), "xpr_")) { continue; } } //To make it sniper only

foreach(player in level.players) {
if(level.teamBased && self.pers["team"] == player.pers["team"]) { continue; } //So you don't kill your team mates

if(Distance(ExplosiveLocation, player.origin) < self.EBRadius && player != self && isAlive(player))
{
if(self.EBTroughWalls == true || bulletTracePassed(ExplosiveLocation, player getTagOrigin("tag_eye"), 0, self)) {
player thread [[level.callbackPlayerDamage]](self, self, self.EBDamage, 8, self.EBMethod, self getCurrentWeapon(), (0,0,0), (0,0,0), "j_mainroot", 0, 0 );
}}}
}
}

//Also be sure to have the vector scal in your menu if you don't have it

vector_scal(vec,scale)
{
vec =(vec[0] * scale,vec[1] * scale,vec[2] * scale);
return vec;
}


Thats pretty much it for the explosive bullets, but for all you lazy people: I added a spoiler with some toggles in case you did not know how to..
    RadiusEB() //Call this to change radius of the EB
{
if(self.EBRadius < 2000)
{
Radius = self.EBRadius;
self.EBRadius = (Radius + 100);
}
else
{
self.EBRadius = 100;
}
self iprintln("EB Radius set to: ^5"+self.EBRadius);
}

DamageEB() //Call this to change damage of the EB
{
if(self.EBDamage < 200)
{
Damage = self.EBDamage;
self.EBDamage = (Damage + 50);
}
else
{
self.EBDamage = 50;
}
self iprintln("EB Damage set to: ^5"+self.EBDamage);
}

SniperOnlyEB() //Call this do enable/disable sniper only EB
{
if(self.SniperOnlyEB == false) {
self.SniperOnlyEB = true;
self iPrintln("Sniper Only EB: [^2ON^7]"); }
else {
self.SniperOnlyEB = false;
self iPrintln("Sniper Only EB: [^1OFF^7]"); }
}

TroughWallsEB() //Call this to enable/disable EB goes trough walls
{
if(self.EBTroughWalls == false) {
self.EBTroughWalls = true;
self iPrintln("EB Trough Walls: [^2ON^7]"); }
else {
self.EBTroughWalls = false;
self iPrintln("EB Trough Walls: [^1OFF^7]"); }
}

HeadshotEB() //Call this to enable/disable if the EB gives you headshots only
{
if(self.EBMethod == "MOD_RIFLE_BULLET") {
self.EBMethod = "MOD_HEAD_SHOT";
self iPrintln("EB Do Headshot: [^2ON^7]"); }
else {
self.EBMethod = "MOD_RIFLE_BULLET";
self iPrintln("EB Do Headshot: [^1OFF^7]"); }
}
That is just some toggles I made real quick for my menu.. Use them if you want :kiss:

The following 3 users say thank you to -Numb for this useful post:

EscoMods, zAlbanianModder
10-10-2016, 08:06 AM #11
Kaedin
Gobble
It gives me an error saying "Unresolved external: 0 parameters in maps/mp/_load.gsc". can you plz help me

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo