Page 1 of 2
Kill streak
Posted: May 15th, 2010, 3:09 pm
by Moustache
When a player kills 20 people in a row I want that they get a text on their screen.
I don't know how to let the script check if they have made a kill. How can I do that?
Maybe something like this?
or this?
But the above codes don't work.
Re: Kill streak
Posted: May 15th, 2010, 5:15 pm
by ConnoR
Im guessing for a mod you are working on?
Re: Kill streak
Posted: May 15th, 2010, 6:06 pm
by Opel
Try Something Like This Mabye.
Code: Select all
streak()
{
self notify("streak_function");
self endon("disconnect");
self endon("joined_spectators");
self endon("streak_function");
while(1)
{
wait 0.05;
if(isDefined(self.cur_kill_streak))
{
streak = self.cur_kill_streak;
switch(streak)
{
case 20:
self iprintlnbold("20 Killstreak");
break;
}
}
}
}
Re: Kill streak
Posted: May 16th, 2010, 10:59 am
by Moustache
ConnoR wrote:Im guessing for a mod you are working on?
I want to place this on a promod TDM server

You can add your own scripts in custom_ruleset.
liam wrote:Try Something Like This Mabye.
Code: Select all
streak()
{
self notify("streak_function");
self endon("disconnect");
self endon("joined_spectators");
self endon("streak_function");
while(1)
{
wait 0.05;
if(isDefined(self.cur_kill_streak))
{
streak = self.cur_kill_streak;
switch(streak)
{
case 20:
self iprintlnbold("20 Killstreak");
break;
}
}
}
}
That doesn't work.
Re: Kill streak
Posted: May 16th, 2010, 12:26 pm
by Drofder2004
onplayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
for(;;)
{
self waittill("spawned_player");
self thread streak();
}
}
streak()
{
self endon("disconnect");
self endon("killed_player");
self endon("joined_spectators");
last = 0;
while(1)
{
if(last != self.cur_kill_streak)
{
switch(self.cur_kill_streak)
{
case 20;
iprintln( &"RANK_KILL_STREAK_N", self, 20);
break;
}
last = self.cur_kill_streak
}
wait 0.05;
}
}
Re: Kill streak
Posted: May 16th, 2010, 1:10 pm
by Moustache
That also doesn't work
Maybe promod doesn't support that function?
I was thinking about using something like this.
But this also doesn't work:
Code: Select all
setkills()
{
self.killstreak = 0;
for(;;)
{
self waittill("spawned_player");
if ( self.killstreak == 3)
{
IPrintLnBold( "^23");
IPrintLnBold( "kills treak");
}
else if( isPlayer( attacker ) )
{
self.killstreak++;
}
wait 0.05;
}
}
Re: Kill streak
Posted: May 16th, 2010, 1:27 pm
by Opel
yours wouldnt work as there is no self.killstreak. You would use self.cur_kill_streak as it is used in globalogic
Re: Kill streak
Posted: May 16th, 2010, 2:16 pm
by Moustache
liam wrote:yours wouldnt work as there is no self.killstreak. You would use self.cur_kill_streak as it is used in globalogic
I create the self.killstreak with this:
Or am I wrong?
Re: Kill streak
Posted: May 16th, 2010, 6:25 pm
by ConnoR
Promod TDM eh? Sounds interesting
Re: Kill streak
Posted: May 16th, 2010, 6:31 pm
by Moustache
ConnoR wrote:Promod TDM eh? Sounds interesting
Explain

Re: Kill streak
Posted: May 16th, 2010, 6:46 pm
by ConnoR
Its just i'd never heard of it before and it would be interesting too see the mod when its done
Re: Kill streak
Posted: May 17th, 2010, 7:27 am
by Moustache
ConnoR wrote:Its just i'd never heard of it before and it would be interesting too see the mod when its done
Then I need to know how the kills are defined. But I don't know that

Re: Kill streak
Posted: May 17th, 2010, 6:24 pm
by Moustache
Promod Fails with killstreaks
This code (Thanxs Drofder

) works on other mods, but not on promod:
Code: Select all
onplayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
for(;;)
{
self waittill("spawned_player");
self thread streak();
IPrintLnBold( "^2Test KS" );
}
}
streak()
{
self endon("disconnect");
self endon("killed_player");
self endon("joined_spectators");
last = 0;
while(1)
{
if(last != self.cur_kill_streak)
{
switch(self.cur_kill_streak)
{
case 3:
IPrintLnBold( "^13 ks" );
iprintln( &"RANK_KILL_STREAK_N", self, 3);
break;
}
last = self.cur_kill_streak;
}
wait 0.05;
}
}
When someone spawn everyone gets this message: Test KS
But the rest fail
This is the script:
Code: Select all
onplayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
for(;;)
{
self waittill("spawned_player");
self thread streak();
IPrintLnBold( "^2Test KS" );
}
}
streak()
{
self.useLastStandParams = undefined;
assert( isdefined( self.lastStandParams ) );
attacker = self.lastStandParams.attacker;
self.lastStandParams = undefined;
self endon("disconnect");
self endon("killed_player");
self endon("joined_spectators");
self.kills_in_a_row = 0;
while(1)
{
if ( isPlayer( attacker ) )
{
self.kills_in_a_row++;
IPrintLnBold( "^6KS +1" );
}
if ( self.kills_in_a_row >= 2 )
{
IPrintLnBold( "^22");
IPrintLnBold( "kill treak");
}
wait 0.05;
}
}
This part I copied from _globallogic.gsc:
Code: Select all
self.useLastStandParams = undefined;
assert( isdefined( self.lastStandParams ) );
attacker = self.lastStandParams.attacker;
self.lastStandParams = undefined;
Re: Kill streak
Posted: May 17th, 2010, 8:29 pm
by Opel
Doesn't Promod disable killstreaks? So you would have to change something in its globallogic or something?
Re: Kill streak
Posted: May 17th, 2010, 10:25 pm
by Drofder2004
Try this.
Code: Select all
onPlayerSpawned()
{
for(;;)
{
self waittill("spawned_player");
self thread monitorKills();
}
}
onPlayerConnect()
{
for(;;)
{
level waittill("connected", player);
player thread onPlayerSpawned();
}
}
monitorKills()
{
self endon("disconnect");
self endon("killed_player");
self endon("joined_spectators");
streak = 0;
before = self.kills;
for(;;)
{
current = self.kills;
while(current == self.kills)
wait 0.05;
streak = self.kills - before;
if((streak % 5) == 0)
iprintln( &"RANK_KILL_STREAK_N", self, streak);
}
}