Post: Wait till you get a kill on someone else
01-30-2016, 09:29 PM #1
BullyWiiPlaza
Climbing up the ladder
(adsbygoogle = window.adsbygoogle || []).push({}); I need to wait till I get a kill on somebody else (so suicides should be excluded). I wrote a code so far that basically waits till some player gets a kill but it can't be used to check for specific players to get a kill. It basically waits till someone died and then triggers:
    waitTillSomePlayerDied()
{
level.playerKilledNotification = "playerKilled";

foreach(player in level.players)
{
player thread waitForDeath();
}

level waittill(level.playerKilledNotification);
}

waitForDeath()
{
level endon("game_ended");
level endon(level.playerKilledNotification);

self waittill("killed_player");

level notify(level.playerKilledNotification);
}

I wrote another script which waits till the player's kills amount increases so that I can tell that I got a kill but it doesn't work work well on Search & Destroy since kills sometimes don't increase and it's supposed to be used there mainly:
    // Waits till you killed another player but fails when kills on the scoreboard don't update
waitTillPlayerKilled()
{
self endon("disconnect");

oldKillsCount = self.pers["kills"];

while(true)
{
updatedKillsCount = self.pers["kills"];

if(updatedKillsCount > oldKillsCount)
{
return;
}

wait 0.05;
}
}

Both of them are not perfect so I'm wondering what could be done to fix the mentioned problems. I need this for an end game trickshot.

Thanks Kryptus
(adsbygoogle = window.adsbygoogle || []).push({});
01-30-2016, 10:35 PM #2
HiddenHour
I defeated!
Originally posted by BullyWiiPlaza View Post
I need to wait till I get a kill on somebody else (so suicides should be excluded). I wrote a code so far that basically waits till some player gets a kill but it can't be used to check for specific players to get a kill. It basically waits till someone died and then triggers:
    waitTillSomePlayerDied()
{
level.playerKilledNotification = "playerKilled";

foreach(player in level.players)
{
player thread waitForDeath();
}

level waittill(level.playerKilledNotification);
}

waitForDeath()
{
level endon("game_ended");
level endon(level.playerKilledNotification);

self waittill("killed_player");

level notify(level.playerKilledNotification);
}

I wrote another script which waits till the player's kills amount increases so that I can tell that I got a kill but it doesn't work work well on Search & Destroy since kills sometimes don't increase and it's supposed to be used there mainly:
    // Waits till you killed another player but fails when kills on the scoreboard don't update
waitTillPlayerKilled()
{
self endon("disconnect");

oldKillsCount = self.pers["kills"];

while(true)
{
updatedKillsCount = self.pers["kills"];

if(updatedKillsCount > oldKillsCount)
{
return;
}

wait 0.05;
}
}

Both of them are not perfect so I'm wondering what could be done to fix the mentioned problems. I need this for an end game trickshot.

Thanks Kryptus


So you want to make a script that checks if a player got a kill?
01-30-2016, 10:43 PM #3
BullyWiiPlaza
Climbing up the ladder
Originally posted by TheHiddenHour View Post
So you want to make a script that checks if a player got a kill?

Yes. Not any player but a specific one Smile
01-30-2016, 10:47 PM #4
HiddenHour
I defeated!
Originally posted by BullyWiiPlaza View Post
Yes. Not any player but a specific one Smile


Why not try something like this?
    killDetection()
{
self endon("disconnect");
self endon("game_ended");
self endon("end_killDetection");

self.killDetection = self.pers["kills"];

for(;Winky Winky
{
if(self.killDetection != self.pers["kills"])
{
//activate scripts
self.killDetection = self.pers["kills"]
}
wait 0.01;
}
}


How do you plan on getting the desired player to activate it?
01-30-2016, 10:56 PM #5
BullyWiiPlaza
Climbing up the ladder
Originally posted by TheHiddenHour View Post
Why not try something like this?

This is what I posted above and it's not working properly on Search & Destroy games since the kills counter doesn't always update...
01-30-2016, 11:04 PM #6
HiddenHour
I defeated!
Originally posted by BullyWiiPlaza View Post
This is what I posted above and it's not working properly on Search & Destroy games since the kills counter doesn't always update...


Just tested it out and it works fine. Are you sure that your script is working correctly? What
01-30-2016, 11:05 PM #7
BullyWiiPlaza
Climbing up the ladder
Originally posted by TheHiddenHour View Post
Just tested it out and it works fine. Are you sure that your script is working correctly? What

Yes but I told you I need something better. If you make the game last unlimited on Search & Destroy you will realize that the kills stop updating. Anyway, I'm not sure what exactly causes this but it's happening to me. On other game modes the script indeed works fine.
01-30-2016, 11:07 PM #8
HiddenHour
I defeated!
Originally posted by BullyWiiPlaza View Post
Yes but I told you I need something better. If you make the game last unlimited on Search & Destroy you will realize that the kills stop updating. Anyway, I'm not sure what exactly causes this but it's happening to me. On other game modes the script indeed works fine.


Ahh. You might want to mention that in your post. I'll look into something else.
01-31-2016, 02:47 AM #9
jwm614
NextGenUpdate Elite
Originally posted by BullyWiiPlaza View Post
Yes but I told you I need something better. If you make the game last unlimited on Search & Destroy you will realize that the kills stop updating. Anyway, I'm not sure what exactly causes this but it's happening to me. On other game modes the script indeed works fine.


did you try
    ondeath()
{
self endon("done");

for(;Winky Winky
{
self waittill("death");
//do shit
wait 0.10;
self notify("done");

}

}
01-31-2016, 11:22 AM #10
BullyWiiPlaza
Climbing up the ladder
Originally posted by jwm614 View Post
did you try
    ondeath()
{
self endon("done");

for(;Winky Winky
{
self waittill("death");
//do shit
wait 0.10;
self notify("done");

}

}

Alright but this waits till the calling entity dies, right? This is like my first example code since it can only tell that someone specific died but not that someone specific got a kill. This is a significant difference.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo