Does anyone know how to add killing sprees?
It adds something completely new to the game and i would like to add it in my mod.
Could someone please help me with this?
Thanks
Does anyone know how to add killing sprees?
It adds something completely new to the game and i would like to add it in my mod.
Could someone please help me with this?
Thanks
Well, kills are already tracked, so that should point you to the right area of the code. You can also do it with a console bot, such as marks etadmin_mod http://bani.anime.net/banimod/forums/viewtopic.php?t=3747
Ok thanks, looked at that one.
Does someone else got some more information about killing sprees.
Hi there,
the etadmin mod has sprees displayed.
http://et.d1p.de/etadmin_mod/index.php
It’s a server side bunch of scripts – I dont know if this helps.
Regards,
US
Well, kills are already tracked, so that should point you to the right area of the code.
Try looking in player_die function in g_combat.c
dvl
Does someone wants to help me with making the code for killing sprees.
Or give me a small start in which way i need to go.
I would really appreciate that.
you should add some global int , which will be nulled after death … try to add 1 to this integer when player kill someone and when this will reach specific number make some effect for that (announcer , icon in scoreboard…)
Just curious why would you choose to add it there? I thought adding it here would be better:
typedef struct {
weaponStats_t weaponStats[WP_NUM_WEAPONS];
int suicides;
int spreeAmount;
int hitRegions[HR_NUM_HITREGIONS];
int objectiveStats[MAX_OBJECTIVES];
} playerStats_t;
Am I mistaken? Would this not work correctly?
Is somebody willing to help me making sprees. No matter what i try, i just cant make it work.
Any help would be appreciated
It has been a while ago since I made this code, but I thought maybe some of you could use it. So for all intrested in adding killing sprees, here is the code:
First of all, in g_local.h add:
int spreeamount;
Above:
qboolean hasaward;
Then in g_combat.c the player_die function:
Replace the normal part with this:
if(attacker == self) {
if(self->client) {
self->client->pers.playerStats.suicides++;
trap_PbStat ( self - g_entities , "suicide" ,
va ( "%d %d %d" , self->client->sess.sessionTeam , self->client->sess.playerType , weap ) ) ;
}
if( self->client->spreeamount >= 5 ) {
AP(va(" cpm\"%s^f's killing spree is over after ^g%d kills^f! ^7(^2SUICIDE^7)
\"", self->client->pers.netname, self->client->spreeamount));
self->client->spreeamount = 0;
}
self->client->spreeamount = 0;
} else if(OnSameTeam( self, attacker )) {
G_LogTeamKill( attacker, weap );
if( self->client->spreeamount >= 5 ) {
AP(va(" cpm\"%s^f's killing spree is over after ^g%d kills^f! ^7(^1TEAMKILL^7)
\"", self->client->pers.netname, self->client->spreeamount));
self->client->spreeamount = 0;
}
self->client->spreeamount = 0;
} else {
G_LogDeath( self, weap );
G_LogKill( attacker, weap );
if( g_killingspree.integer ) {
if( self->client->spreeamount >= 5 ) {
AP(va(" cpm\"%s^f's killing spree is over after ^g%d kills^f!
\"", self->client->pers.netname, self->client->spreeamount));
self->client->spreeamount = 0;
}
self->client->spreeamount = 0;
}
if( g_gamestate.integer == GS_PLAYING ) {
if( attacker->client ) {
attacker->client->combatState |= (1<<COMBATSTATE_KILLEDPLAYER);
}
}
}
That’s from // G_Printf( "player_die
" );
To // RF, record this death in AAS system so that bots avoid areas which have high death rates
Then furthur down, after:
if( g_gametype.integer == GT_WOLF_LMS ) {
if( level.firstbloodTeam == -1 )
level.firstbloodTeam = attacker->client->sess.sessionTeam;
AddKillScore( attacker, WOLF_FRAG_BONUS );
}
attacker->client->lastKillTime = level.time;
Add:
if(g_killingspree.integer) {
attacker->client->spreeamount++;
if( attacker->client->spreeamount == 5 ) {
AP(va(" cpm\"%s ^fis on a killing spree! ^g(^75 kills in a row^g)
\"", attacker->client->pers.netname));
G_globalSound("sound/shadowmod/killingspree.wav");
}else if( attacker->client->spreeamount == 10 ) {
AP(va(" cpm\"%s ^fis dominating! ^g(^710 kills in a row^g)
\"", attacker->client->pers.netname));
}else if( attacker->client->spreeamount == 15 ) {
AP(va(" cpm\"%s ^fis an assasin! ^g(^715 kills in a row^g)
\"", attacker->client->pers.netname));
}else if( attacker->client->spreeamount == 20 ) {
AP(va(" cpm\"%s ^fis owning! ^g(^720 kills in a row^g)
\"", attacker->client->pers.netname));
}else if( attacker->client->spreeamount == 25 ) {
AP(va(" cpm\"%s ^fis on a terror strike! ^g(^725 kills in a row^g)
\"", attacker->client->pers.netname));
}else if( attacker->client->spreeamount == 30 ) {
AP(va(" cpm\"%s ^fis a killing machine! ^g(^730 kills in a row^g)
\"", attacker->client->pers.netname));
}else if( attacker->client->spreeamount == 40 ) {
AP(va(" cpm\"%s ^fis invincible! ^g(^740 kills in a row^g)
\"", attacker->client->pers.netname));
}else if( attacker->client->spreeamount == 50 ) {
AP(va(" cpm\"%s ^fis godlike! ^g(^750 kills in a row^g)
\"", attacker->client->pers.netname));
}
}
You of course need to add g_killingspree or remove the integer
I hope i helped some guys out.
Good luck with it !!
This is one of the things I’m going to add, however I was thinking of making the spree limits percentages or something like that.
Because of large pub servers it is easy for people to get 5 or more kills. I have seen servers where the etadmin_mod was constantly printing the 5 and 10 kill spree messages.
Does this realy work, i tried it and when i host a server and connect to it, it instantly says “Connection Interupted” and when i join a team it crashes the game and says “Error unknown event 2”
Im maybe just a noob coder lol but i added the stuff where it said to add it and then added the cvars (g_killingspree) to g_local.h, bg_local.h, and g_main.c. Is there somethin else im supposed to be doin?
check if it is something else than the spreecode that causes a crash!
btw code works perfect…
yeah i just compiled with and without this code, and when its there it crashes the game and when its not it doesnt crash…I redid it 3 times to make sure i didnt ferget anything…maybe im not addin somethin in the right place.
i added to g_main.c
vmCvar_t g_killingspree;
{ &g_killingspree, “g_killingspree”, “0”, 0 },
then i added to bg_local.h
extern vmCvar_t g_killingspree;
added to g_local.h
extern vmCvar_t g_killingspree;
am i missing anything? im new to this stuff so i dont know
u dont have to add it into the bg_local header file
and i would remove this cvar cause for testing you dont actually need it
that did it LION, thankz man…removin the cvar from bg_local did the trick…thankz for the code Shadow Commando , and thankz fer the help lion
4-5th day into codin for ET, im catchin on
:drink:
d@Ve
You can now also look in the source of ETPub,
They have a code for killing spree aswell.
It only works differently then mine.
great job with the code, but it counts teamkills as part of the killing spree, any way to put some kind of check in it to tell if its a teammate or not ??