Ok, we can use a method were we take over a thread.
Basically, inside all gametypes, there is a thread called "Callback_PlayerKilled", this is also referenced by the variable 'level.callbackPlayerKilled'.
what we want to do is take over this callback and use our own...
First create the following code inside mymod.gsc (if you want a different name, you will need to change all instances of 'mymod'). This will be used to call our own version of the playerKilled thread...
myMod.gsc
Code: Select all
playerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
self endon ("disconnect");
//Now we need to call the original thread first, to play all the death animations and register the death.
[[level.default_CallbackPlayerKilled]](eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);
//Now for our code
playFx(level._effect["mine_explosion"], self.origin);
// Because this thread was called on the player who died, we do not need any thing but the FX.
}
So that is how to take over the function, but first we need to thread this in EVERY gametype.
First open dm.gsc
Scroll down until you find
Code: Select all
level.callbackStartGameType = ::Callback_StartGameType;
level.callbackPlayerConnect = ::Callback_PlayerConnect;
level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
level.callbackPlayerDamage = ::Callback_PlayerDamage;
level.callbackPlayerKilled = ::Callback_PlayerKilled;
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
Now straight after this line you will need to add the first code we created... you need to change the level.callbackPlayerKilled.
It is very important that it comes after the "_callbacksetup::SetupCallback();" part, as this is the part that is created to save all the default callbacks
So, add this code...
Code: Select all
level.callbackPlayerKilled = mymod::playerKilled;
You should now have....
Code: Select all
level.callbackStartGameType = ::Callback_StartGameType;
level.callbackPlayerConnect = ::Callback_PlayerConnect;
level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
level.callbackPlayerDamage = ::Callback_PlayerDamage;
level.callbackPlayerKilled = ::Callback_PlayerKilled;
maps\mp\gametypes\_callbacksetup::SetupCallbacks();
level.callbackPlayerKilled = mymod::playerKilled;
Give me any errors you get....
Becareful copying this code, the forum width is small and some things have gone down a line but should be 1 full line