mirror of
https://github.com/Resxt/Plutonium-IW5-Scripts.git
synced 2025-04-18 20:22:53 +00:00
Added kill_stuck_bots
This commit is contained in:
parent
62a2c67088
commit
627ce1adb6
@ -20,3 +20,10 @@ Display the player's killstreak, total kills and deaths on top of the screen
|
||||
|
||||

|
||||
</details>
|
||||
|
||||
## kill_stuck_bots.gsc
|
||||
|
||||
This is a temporary solution to inactive bots or bots stuck in corners on custom maps.
|
||||
This checks for bots kills and deaths every 30 seconds. If they didn't do any kill or didn't die in 30 seconds they're considered inactive/stuck and they're killed.
|
||||
Obviously a better way to do this would be checking for their positions or removing bad spawns on the map or creating waypoints for the map.
|
||||
This is just a quick temporary solution that works for me.
|
54
small_scripts/kill_stuck_bots.gsc
Normal file
54
small_scripts/kill_stuck_bots.gsc
Normal file
@ -0,0 +1,54 @@
|
||||
Init()
|
||||
{
|
||||
level thread OnPlayerConnect();
|
||||
}
|
||||
|
||||
OnPlayerConnect()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
level waittill("connected", player);
|
||||
player thread OnPlayerSpawned();
|
||||
}
|
||||
}
|
||||
|
||||
OnPlayerSpawned()
|
||||
{
|
||||
self endon("disconnect");
|
||||
for(;;)
|
||||
{
|
||||
self waittill("spawned_player");
|
||||
if (isDefined(self.pers["isBot"]))
|
||||
{
|
||||
if (self.pers["isBot"])
|
||||
{
|
||||
self thread KillStuckBots();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KillStuckBots()
|
||||
{
|
||||
self endon ("disconnect");
|
||||
level endon("game_ended");
|
||||
|
||||
kills_before = self.pers["cur_kill_streak"];
|
||||
deaths_before = self.pers["deaths"];
|
||||
|
||||
wait 30;
|
||||
|
||||
kills_now = self.pers["cur_kill_streak"];
|
||||
deaths_now = self.pers["deaths"];
|
||||
|
||||
if (kills_now == kills_before && deaths_before == deaths_now)
|
||||
{
|
||||
self Suicide();
|
||||
}
|
||||
}
|
||||
|
||||
// Prints text in the bootstrapper
|
||||
Debug(text)
|
||||
{
|
||||
Print(text);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user