Author Topic: Tutorial - Sticky Nades for X4  (Read 4889 times)

Offline SevenSniff

  • Rank: Private
  • *
  • Posts: 21
Tutorial - Sticky Nades for X4
« on: October 07, 2008, 12:57:49 pm »
This is a simple script modification no need for .ff rebuilds or new files!

What is this you ask? This is a script which will "Stick" a nade to a player if they are harmed by impact of a nade!
The player will explode 3 seconds after being "Stuck" and will kill anyone in the radius giving the "sticker" the kill's.

The only file you need to modify is "maps/mp/gametypes/_globallogic.gsc"

REMEMBER TO BACK UP ALL OF YOUR FILES BEFORE ATTEMPTING THIS TUTORIAL!!!

If your lazy or dont understand scripting this download a pre-build _goballogic.gsc, thanks to Lojik

DOWNLOAD HERE

------------------------------------------------------------------------

OPEN: "maps/mp/gametypes/_globallogic.gsc"

Go to the bottom of the file and after the last "}" paste this code

Code: [Select]
playergoboom() // Modified script _explosive_barrels.gsc
{
self iPrintlnBold("You have a grenade stuck on you!"); // Comment this line out if you dont want the message.

wait(3); // add a 3 second wait to make it seem there realy is a nade attached.

self playsound (level.playerExpSound); // play nade FX
playfx (level.nade_fx["nade"]["explode"], self.origin); // play nade sound

phyExpMagnitude = 2;

// Modify these values if you have changed your nade properties.
minDamage = 75; // keep the min damage the same as a real nade.
maxDamage = 300; // keep the max damage the same as a real nade.
blastRadius = 256; // keep the radius the same as a real nade.

// do not pass damage owner if they have disconnected before the nade explodes
if ( !isdefined( self.damageOwner ) )
{
radiusDamage(self.origin + (0,0,30), blastRadius, maxDamage, minDamage);
}
else
{
radiusDamage(self.origin + (0,0,30), blastRadius, maxDamage, minDamage, self.damageOwner);
}

physicsExplosionSphere( self.origin + (0,0,30), blastRadius, blastRadius/2, phyExpMagnitude );

self maps\mp\gametypes\_shellshock::grenade_earthQuake(); // do a nade earthquake
}

------------------------------------------------------------------------

now that the easy bit is done, lets have some fun :D

------------------------------------------------------------------------

FIND:

Code: [Select]
precacheShader( "faction_128_sas" );
AFTER ADD:

Code: [Select]
level.nade_fx["nade"]["explode"] = loadfx ("explosions/grenadeexp_default");
level.playerExpSound = "grenade_explode_default";

------------------------------------------------------------------------

FIND:

Code: [Select]
self.hasSpawned = false;
self.waitingToSpawn = false;
self.deathCount = 0;

AFTER ADD:

Code: [Select]
self.damageOwner = undefined;
self.newsweapon = undefined;

------------------------------------------------------------------------

FIND:

Code: [Select]
prof_end( "Callback_PlayerDamage flags/tweaks" );
ADD BEFORE:

Code: [Select]
if( !isDefined( eInflictor )) // To be honest im not sure if this is safe on X4, but we can always re-work it :P
sWeapon = "frag_grenade_mp";

------------------------------------------------------------------------

FIND:

Code: [Select]
if ( (isSubStr( sMeansOfDeath, "MOD_GRENADE" ) || isSubStr( sMeansOfDeath, "MOD_EXPLOSIVE" ) || isSubStr( sMeansOfDeath, "MOD_PROJECTILE" )) && isDefined( eInflictor ) )

ADD BEFORE:

Code: [Select]
isFrag = isSubStr( sWeapon, "frag_" ); //Lets make sure this is a frag nade

if (isFrag && sMeansOfDeath == "MOD_IMPACT")
{
self.damageOwner = eAttacker;
self.newsweapon = "frag_grenade_mp"; // Sets the weapon so it display's as a nade kill
Iprintln(eAttacker.name + " has stuck " + self.name);
eInflictor.origin = eInflictor.origin + (0, 0, -100000); // Throw the original nade away so it wont cause a 2nd explostion
self thread playergoboom();
}

------------------------------------------------------------------------

FIND:

Code: [Select]
// send out an obituary message to all clients about the kill
ADD BEFORE:

Code: [Select]
if(isdefined(self.newsweapon))
{
sWeapon = self.newsweapon;
self.newsweapon = undefined;
}

------------------------------------------------------------------------

Save the file and upload, you are now ready for sticky nades! Enjoy!

Scripted by Seven with theoretical help from Joker :P

any queries or problems dont hestate to ask.

Offline aimlance

  • Rank: Private
  • *
  • Posts: 26
Re: Tutorial - Sticky Nades for X4
« Reply #1 on: October 07, 2008, 03:16:01 pm »
Tested with bots and works great. Should have took a screen but saw 1 stuck on a bots neck lmfao

Offline coRpSE

  • Rank: Private
  • *
  • Posts: 24
    • http://www.headshotdomain.net
Re: Tutorial - Sticky Nades for X4
« Reply #2 on: October 12, 2008, 01:33:16 am »
I tried this and it didn't seem to work. Sounds like a nice modification to have.

Offline aimlance

  • Rank: Private
  • *
  • Posts: 26
Re: Tutorial - Sticky Nades for X4
« Reply #3 on: October 12, 2008, 03:30:39 am »
Heres my globallogic.gsc file, runs fine on my server. back yours up tho because I dont remember what other changes I have made to it. If any it was for the better tho.

http://www.mediafire.com/?sumxcodzfm3

Offline coRpSE

  • Rank: Private
  • *
  • Posts: 24
    • http://www.headshotdomain.net
Re: Tutorial - Sticky Nades for X4
« Reply #4 on: October 12, 2008, 06:42:10 am »
Yours worked, I wounder why mine wouldn't work.

Even though using yours works. I did notice a difference. my gsc file is larger in size and I really hate to remove a piece of coding that was supposed to do something or be for something.. so I feel safer not to use yours, I just wondering why your file works and mine doesn't.

Offline odin

  • Rank: Private
  • *
  • Posts: 1
Re: Tutorial - Sticky Nades for X4
« Reply #5 on: October 12, 2008, 10:00:21 am »
I compare the two files, and other than the sticky nade changes, there are only two others.

This line has been commented out.
   
Code: [Select]
//level.onForfeit = ::default_onForfeit;
And this code has been removed.


Code: [Select]
self initPersStat( "longhead" );
    self.longhead = self getPersStat( "longhead" );

    self initPersStat( "longshot" );
    self.longshot = self getPersStat( "longshot" );

Offline coRpSE

  • Rank: Private
  • *
  • Posts: 24
    • http://www.headshotdomain.net
Re: Tutorial - Sticky Nades for X4
« Reply #6 on: October 12, 2008, 02:37:24 pm »
Quote
   
Code: [Select]
//level.onForfeit = ::default_onForfeit;
I saw this




Quote
Code: [Select]
self initPersStat( "longhead" );
    self.longhead = self getPersStat( "longhead" );

    self initPersStat( "longshot" );
    self.longshot = self getPersStat( "longshot" );

I don't have that either in my coding, I started to compare, got up to like 900 and had to stop. nothing at that point.

Offline Lojik

  • Rank: Private
  • *
  • Posts: 57
Re: Tutorial - Sticky Nades for X4
« Reply #7 on: October 13, 2008, 02:13:40 pm »
_globallogic.gsc file needed for Sticky Nades Click Here

You can grab the file above if youd like to get sticky nades working in X4 2.0

I added to it myself no code has been removed only added the above code and thats that enjoy

Thanks to seven for this good stuff indeed thanks

Offline FistFight

  • Rank: Private
  • *
  • Posts: 34
    • http://www.ufclansite.net
Re: Tutorial - Sticky Nades for X4
« Reply #8 on: October 21, 2008, 10:55:59 pm »
So say I want to make c4 stick to a person. How would I go about doing that?

thought it would be kinda funny to throw it on a person and remote detinate them when they get closer to their team mates.

Offline Powerbolt

  • Rank: Private
  • *
  • Posts: 2
Re: Tutorial - Sticky Nades for X4
« Reply #9 on: June 18, 2009, 02:13:45 am »
Can someone please upload the gsc file again?

Offline FewPeople

  • Rank: Private
  • *
  • Posts: 206
    • http://www.xanthiserver.dyndns.org
Re: Tutorial - Sticky Nades for X4
« Reply #10 on: October 19, 2009, 12:53:37 am »
yes im lazy as well :P, can we get a link to this download on this site please

Offline coRpSE

  • Rank: Private
  • *
  • Posts: 24
    • http://www.headshotdomain.net
Re: Tutorial - Sticky Nades for X4
« Reply #11 on: November 15, 2009, 09:49:24 am »
For those that want the edited .gsc.

Download Here