mirror of
https://github.com/ineedbots/iw2_bot_warfare.git
synced 2025-04-22 07:25:42 +00:00
lets goo
This commit is contained in:
parent
c714a5de37
commit
e9a97ed7f0
805
mods/bots/maps/mp/bots/_bot.gsc
Normal file
805
mods/bots/maps/mp/bots/_bot.gsc
Normal file
@ -0,0 +1,805 @@
|
||||
#include maps\mp\_utility;
|
||||
#include maps\mp\bots\_bot_utility;
|
||||
|
||||
/*
|
||||
Initiates the whole bot scripts.
|
||||
*/
|
||||
init()
|
||||
{
|
||||
level.bw_VERSION = "2.0.1";
|
||||
|
||||
if(getCvar("bots_main") == "")
|
||||
setCvar("bots_main", true);
|
||||
|
||||
if (!getCvarInt("bots_main"))
|
||||
return;
|
||||
|
||||
thread load_waypoints();
|
||||
thread hook_callbacks();
|
||||
|
||||
if(getCvar("bots_main_GUIDs") == "")
|
||||
setCvar("bots_main_GUIDs", "");//guids of players who will be given host powers, comma seperated
|
||||
if(getCvar("bots_main_firstIsHost") == "")
|
||||
setCvar("bots_main_firstIsHost", true);//first player to connect is a host
|
||||
if(getCvar("bots_main_waitForHostTime") == "")
|
||||
setCvar("bots_main_waitForHostTime", 10.0);//how long to wait to wait for the host player
|
||||
|
||||
if(getCvar("bots_manage_add") == "")
|
||||
setCvar("bots_manage_add", 0);//amount of bots to add to the game
|
||||
if(getCvar("bots_manage_fill") == "")
|
||||
setCvar("bots_manage_fill", 0);//amount of bots to maintain
|
||||
if(getCvar("bots_manage_fill_spec") == "")
|
||||
setCvar("bots_manage_fill_spec", true);//to count for fill if player is on spec team
|
||||
if(getCvar("bots_manage_fill_mode") == "")
|
||||
setCvar("bots_manage_fill_mode", 0);//fill mode, 0 adds everyone, 1 just bots, 2 maintains at maps, 3 is 2 with 1
|
||||
if(getCvar("bots_manage_fill_kick") == "")
|
||||
setCvar("bots_manage_fill_kick", false);//kick bots if too many
|
||||
|
||||
if(getCvar("bots_team") == "")
|
||||
setCvar("bots_team", "autoassign");//which team for bots to join
|
||||
if(getCvar("bots_team_amount") == "")
|
||||
setCvar("bots_team_amount", 0);//amount of bots on axis team
|
||||
if(getCvar("bots_team_force") == "")
|
||||
setCvar("bots_team_force", false);//force bots on team
|
||||
if(getCvar("bots_team_mode") == "")
|
||||
setCvar("bots_team_mode", 0);//counts just bots when 1
|
||||
|
||||
if(getCvar("bots_skill") == "")
|
||||
setCvar("bots_skill", 0);//0 is random, 1 is easy 7 is hard, 8 is custom, 9 is completely random
|
||||
if(getCvar("bots_skill_axis_hard") == "")
|
||||
setCvar("bots_skill_axis_hard", 0);//amount of hard bots on axis team
|
||||
if(getCvar("bots_skill_axis_med") == "")
|
||||
setCvar("bots_skill_axis_med", 0);
|
||||
if(getCvar("bots_skill_allies_hard") == "")
|
||||
setCvar("bots_skill_allies_hard", 0);
|
||||
if(getCvar("bots_skill_allies_med") == "")
|
||||
setCvar("bots_skill_allies_med", 0);
|
||||
|
||||
if(getCvar("bots_loadout_rank") == "")// what rank the bots should be around, -1 is around the players, 0 is all random
|
||||
setCvar("bots_loadout_rank", -1);
|
||||
|
||||
if(getCvar("bots_play_move") == "")//bots move
|
||||
setCvar("bots_play_move", true);
|
||||
if(getCvar("bots_play_knife") == "")//bots knife
|
||||
setCvar("bots_play_knife", true);
|
||||
if(getCvar("bots_play_fire") == "")//bots fire
|
||||
setCvar("bots_play_fire", true);
|
||||
if(getCvar("bots_play_nade") == "")//bots grenade
|
||||
setCvar("bots_play_nade", true);
|
||||
if(getCvar("bots_play_obj") == "")//bots play the obj
|
||||
setCvar("bots_play_obj", true);
|
||||
if(getCvar("bots_play_camp") == "")//bots camp and follow
|
||||
setCvar("bots_play_camp", true);
|
||||
if(getCvar("bots_play_jumpdrop") == "")//bots jump and dropshot
|
||||
setCvar("bots_play_jumpdrop", true);
|
||||
if(getCvar("bots_play_ads") == "")//bot ads
|
||||
setCvar("bots_play_ads", true);
|
||||
|
||||
if(!isDefined(game["botWarfare"]))
|
||||
game["botWarfare"] = true;
|
||||
|
||||
level.defuseObject = undefined;
|
||||
level.bots_smokeList = List();
|
||||
|
||||
level.bots_minGrenadeDistance = 256;
|
||||
level.bots_minGrenadeDistance *= level.bots_minGrenadeDistance;
|
||||
level.bots_maxGrenadeDistance = 1024;
|
||||
level.bots_maxGrenadeDistance *= level.bots_maxGrenadeDistance;
|
||||
level.bots_maxKnifeDistance = 80;
|
||||
level.bots_maxKnifeDistance *= level.bots_maxKnifeDistance;
|
||||
level.bots_goalDistance = 27.5;
|
||||
level.bots_goalDistance *= level.bots_goalDistance;
|
||||
level.bots_noADSDistance = 200;
|
||||
level.bots_noADSDistance *= level.bots_noADSDistance;
|
||||
level.bots_maxShotgunDistance = 500;
|
||||
level.bots_maxShotgunDistance *= level.bots_maxShotgunDistance;
|
||||
level.bots_listenDist = 100;
|
||||
|
||||
level.smokeRadius = 255;
|
||||
|
||||
level.bots = [];
|
||||
level.players = [];
|
||||
|
||||
level.bots_fullautoguns = [];
|
||||
|
||||
level thread fixGamemodes();
|
||||
|
||||
level thread onPlayerConnect();
|
||||
level thread handleBots();
|
||||
level thread watchNades();
|
||||
level thread watchGameEnded();
|
||||
|
||||
//level thread maps\mp\bots\_bot_http::doVersionCheck();
|
||||
}
|
||||
|
||||
/*
|
||||
Starts the threads for bots.
|
||||
*/
|
||||
handleBots()
|
||||
{
|
||||
level thread teamBots();
|
||||
level thread diffBots();
|
||||
level addBots();
|
||||
|
||||
while(!level.mapended)
|
||||
wait 0.05;
|
||||
|
||||
setCvar("bots_manage_add", getBotArray().size);
|
||||
}
|
||||
|
||||
/*
|
||||
The hook callback for when any player becomes damaged.
|
||||
*/
|
||||
onPlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset)
|
||||
{
|
||||
if(self is_bot())
|
||||
{
|
||||
//self maps\mp\bots\_bot_internal::onDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset);
|
||||
//self maps\mp\bots\_bot_script::onDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset);
|
||||
}
|
||||
|
||||
self [[level.prevCallbackPlayerDamage]](eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset);
|
||||
}
|
||||
|
||||
/*
|
||||
The hook callback when any player gets killed.
|
||||
*/
|
||||
onPlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
|
||||
{
|
||||
if(self is_bot())
|
||||
{
|
||||
//self maps\mp\bots\_bot_internal::onKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
|
||||
//self maps\mp\bots\_bot_script::onKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
|
||||
}
|
||||
|
||||
self [[level.prevCallbackPlayerKilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
|
||||
}
|
||||
|
||||
/*
|
||||
Starts the callbacks.
|
||||
*/
|
||||
hook_callbacks()
|
||||
{
|
||||
wait 0.05;
|
||||
level.prevCallbackPlayerDamage = level.callbackPlayerDamage;
|
||||
level.callbackPlayerDamage = ::onPlayerDamage;
|
||||
|
||||
level.prevCallbackPlayerKilled = level.callbackPlayerKilled;
|
||||
level.callbackPlayerKilled = ::onPlayerKilled;
|
||||
}
|
||||
|
||||
/*
|
||||
Adds the level.radio object for koth. Cause the iw3 script doesn't have it.
|
||||
*/
|
||||
fixKoth()
|
||||
{
|
||||
level.radio = undefined;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
wait 0.05;
|
||||
|
||||
if(!isDefined(level.radioObject))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(i = level.radios.size - 1; i >= 0; i--)
|
||||
{
|
||||
if(level.radioObject != level.radios[i].gameobject)
|
||||
continue;
|
||||
|
||||
level.radio = level.radios[i];
|
||||
break;
|
||||
}
|
||||
|
||||
while(isDefined(level.radioObject) && level.radio.gameobject == level.radioObject)
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Fixes gamemodes when level starts.
|
||||
*/
|
||||
fixGamemodes()
|
||||
{
|
||||
for(i=0;i<19;i++)
|
||||
{
|
||||
if(isDefined(level.bombZones) && level.gametype == "sd")
|
||||
{
|
||||
//for(i = 0; i < level.bombZones.size; i++)
|
||||
//level.bombZones[i].onUse = ::onUsePlantObjectFix;
|
||||
break;
|
||||
}
|
||||
|
||||
if(isDefined(level.radios) && level.gametype == "koth")
|
||||
{
|
||||
level thread fixKoth();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Thread when any player connects. Starts the threads needed.
|
||||
*/
|
||||
onPlayerConnect()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
level waittill("connected", player);
|
||||
|
||||
player thread onWeaponFired();
|
||||
player thread connected();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
When a bot disconnects.
|
||||
*/
|
||||
onDisconnectPlayer()
|
||||
{
|
||||
self waittill("disconnect");
|
||||
|
||||
level.players = array_remove(level.players, self);
|
||||
}
|
||||
|
||||
/*
|
||||
When a bot disconnects.
|
||||
*/
|
||||
onDisconnect()
|
||||
{
|
||||
self waittill("disconnect");
|
||||
|
||||
level.bots = array_remove(level.bots, self);
|
||||
}
|
||||
|
||||
/*
|
||||
Called when a player connects.
|
||||
*/
|
||||
connected()
|
||||
{
|
||||
self endon("disconnect");
|
||||
|
||||
level.players[level.players.size] = self;
|
||||
self thread onDisconnectPlayer();
|
||||
|
||||
if (!isDefined(self.pers["bot_host"]))
|
||||
self thread doHostCheck();
|
||||
|
||||
if(!self is_bot())
|
||||
return;
|
||||
|
||||
if (!isDefined(self.pers["isBot"]))
|
||||
{
|
||||
// fast restart...
|
||||
self.pers["isBot"] = true;
|
||||
}
|
||||
|
||||
if (!isDefined(self.pers["isBotWarfare"]))
|
||||
{
|
||||
self.pers["isBotWarfare"] = true;
|
||||
self thread added();
|
||||
}
|
||||
|
||||
//self thread maps\mp\bots\_bot_internal::connected();
|
||||
//self thread maps\mp\bots\_bot_script::connected();
|
||||
|
||||
level.bots[level.bots.size] = self;
|
||||
self thread onDisconnect();
|
||||
|
||||
level notify("bot_connected", self);
|
||||
}
|
||||
|
||||
/*
|
||||
When a bot gets added into the game.
|
||||
*/
|
||||
added()
|
||||
{
|
||||
self endon("disconnect");
|
||||
|
||||
//self thread maps\mp\bots\_bot_internal::added();
|
||||
//self thread maps\mp\bots\_bot_script::added();
|
||||
}
|
||||
|
||||
/*
|
||||
Adds a bot to the game.
|
||||
*/
|
||||
add_bot()
|
||||
{
|
||||
bot = addtestclient();
|
||||
|
||||
if (isdefined(bot))
|
||||
{
|
||||
bot.pers["isBot"] = true;
|
||||
bot.pers["isBotWarfare"] = true;
|
||||
bot thread added();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A server thread for monitoring all bot's difficulty levels for custom server settings.
|
||||
*/
|
||||
diffBots_loop()
|
||||
{
|
||||
var_allies_hard = getCvarInt("bots_skill_allies_hard");
|
||||
var_allies_med = getCvarInt("bots_skill_allies_med");
|
||||
var_axis_hard = getCvarInt("bots_skill_axis_hard");
|
||||
var_axis_med = getCvarInt("bots_skill_axis_med");
|
||||
var_skill = getCvarInt("bots_skill");
|
||||
|
||||
allies_hard = 0;
|
||||
allies_med = 0;
|
||||
axis_hard = 0;
|
||||
axis_med = 0;
|
||||
|
||||
if(var_skill == 8)
|
||||
{
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(!isDefined(player.pers["team"]))
|
||||
continue;
|
||||
|
||||
if(!player is_bot())
|
||||
continue;
|
||||
|
||||
if(player.pers["team"] == "axis")
|
||||
{
|
||||
if(axis_hard < var_axis_hard)
|
||||
{
|
||||
axis_hard++;
|
||||
player.pers["bots"]["skill"]["base"] = 7;
|
||||
}
|
||||
else if(axis_med < var_axis_med)
|
||||
{
|
||||
axis_med++;
|
||||
player.pers["bots"]["skill"]["base"] = 4;
|
||||
}
|
||||
else
|
||||
player.pers["bots"]["skill"]["base"] = 1;
|
||||
}
|
||||
else if(player.pers["team"] == "allies")
|
||||
{
|
||||
if(allies_hard < var_allies_hard)
|
||||
{
|
||||
allies_hard++;
|
||||
player.pers["bots"]["skill"]["base"] = 7;
|
||||
}
|
||||
else if(allies_med < var_allies_med)
|
||||
{
|
||||
allies_med++;
|
||||
player.pers["bots"]["skill"]["base"] = 4;
|
||||
}
|
||||
else
|
||||
player.pers["bots"]["skill"]["base"] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (var_skill != 0 && var_skill != 9)
|
||||
{
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(!player is_bot())
|
||||
continue;
|
||||
|
||||
player.pers["bots"]["skill"]["base"] = var_skill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A server thread for monitoring all bot's difficulty levels for custom server settings.
|
||||
*/
|
||||
diffBots()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
wait 1.5;
|
||||
|
||||
diffBots_loop();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A server thread for monitoring all bot's teams for custom server settings.
|
||||
*/
|
||||
teamBots_loop()
|
||||
{
|
||||
teamAmount = getCvarInt("bots_team_amount");
|
||||
toTeam = getCvar("bots_team");
|
||||
|
||||
alliesbots = 0;
|
||||
alliesplayers = 0;
|
||||
axisbots = 0;
|
||||
axisplayers = 0;
|
||||
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(!isDefined(player.pers["team"]))
|
||||
continue;
|
||||
|
||||
if(player is_bot())
|
||||
{
|
||||
if(player.pers["team"] == "allies")
|
||||
alliesbots++;
|
||||
else if(player.pers["team"] == "axis")
|
||||
axisbots++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(player.pers["team"] == "allies")
|
||||
alliesplayers++;
|
||||
else if(player.pers["team"] == "axis")
|
||||
axisplayers++;
|
||||
}
|
||||
}
|
||||
|
||||
allies = alliesbots;
|
||||
axis = axisbots;
|
||||
|
||||
if(!getCvarInt("bots_team_mode"))
|
||||
{
|
||||
allies += alliesplayers;
|
||||
axis += axisplayers;
|
||||
}
|
||||
|
||||
if(toTeam != "custom")
|
||||
{
|
||||
if(getCvarInt("bots_team_force"))
|
||||
{
|
||||
if(toTeam == "autoassign")
|
||||
{
|
||||
if(abs(axis - allies) > 1)
|
||||
{
|
||||
toTeam = "axis";
|
||||
if(axis > allies)
|
||||
toTeam = "allies";
|
||||
}
|
||||
}
|
||||
|
||||
if(toTeam != "autoassign")
|
||||
{
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(!isDefined(player.pers["team"]))
|
||||
continue;
|
||||
|
||||
if(!player is_bot())
|
||||
continue;
|
||||
|
||||
if(player.pers["team"] == toTeam)
|
||||
continue;
|
||||
|
||||
if (toTeam == "allies")
|
||||
player thread [[level.allies]]();
|
||||
else if (toTeam == "axis")
|
||||
player thread [[level.axis]]();
|
||||
else
|
||||
player thread [[level.spectator]]();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(!isDefined(player.pers["team"]))
|
||||
continue;
|
||||
|
||||
if(!player is_bot())
|
||||
continue;
|
||||
|
||||
if(player.pers["team"] == "axis")
|
||||
{
|
||||
if(axis > teamAmount)
|
||||
{
|
||||
player thread [[level.allies]]();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(axis < teamAmount)
|
||||
{
|
||||
player thread [[level.axis]]();
|
||||
break;
|
||||
}
|
||||
else if(player.pers["team"] != "allies")
|
||||
{
|
||||
player thread [[level.allies]]();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A server thread for monitoring all bot's teams for custom server settings.
|
||||
*/
|
||||
teamBots()
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
wait 1.5;
|
||||
|
||||
teamBots_loop();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A server thread for monitoring all bot's in game. Will add and kick bots according to server settings.
|
||||
*/
|
||||
addBots_loop()
|
||||
{
|
||||
botsToAdd = GetCvarInt("bots_manage_add");
|
||||
|
||||
if(botsToAdd > 0)
|
||||
{
|
||||
SetCvar("bots_manage_add", 0);
|
||||
|
||||
if(botsToAdd > 64)
|
||||
botsToAdd = 64;
|
||||
|
||||
for(; botsToAdd > 0; botsToAdd--)
|
||||
{
|
||||
level add_bot();
|
||||
wait 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
fillMode = getCvarInt("bots_manage_fill_mode");
|
||||
|
||||
if(fillMode == 2 || fillMode == 3)
|
||||
setCvar("bots_manage_fill", getGoodMapAmount());
|
||||
|
||||
fillAmount = getCvarInt("bots_manage_fill");
|
||||
|
||||
players = 0;
|
||||
bots = 0;
|
||||
spec = 0;
|
||||
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(player is_bot())
|
||||
bots++;
|
||||
else if(!isDefined(player.pers["team"]) || (player.pers["team"] != "axis" && player.pers["team"] != "allies"))
|
||||
spec++;
|
||||
else
|
||||
players++;
|
||||
}
|
||||
|
||||
if (!randomInt(999))
|
||||
{
|
||||
setCvar("testclients_doreload", true);
|
||||
wait 0.1;
|
||||
setCvar("testclients_doreload", false);
|
||||
doExtraCheck();
|
||||
}
|
||||
|
||||
if(fillMode == 4)
|
||||
{
|
||||
axisplayers = 0;
|
||||
alliesplayers = 0;
|
||||
|
||||
playercount = level.players.size;
|
||||
for(i = 0; i < playercount; i++)
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if(player is_bot())
|
||||
continue;
|
||||
|
||||
if(!isDefined(player.pers["team"]))
|
||||
continue;
|
||||
|
||||
if(player.pers["team"] == "axis")
|
||||
axisplayers++;
|
||||
else if(player.pers["team"] == "allies")
|
||||
alliesplayers++;
|
||||
}
|
||||
|
||||
result = fillAmount - abs(axisplayers - alliesplayers) + bots;
|
||||
|
||||
if (players == 0)
|
||||
{
|
||||
if(bots < fillAmount)
|
||||
result = fillAmount-1;
|
||||
else if (bots > fillAmount)
|
||||
result = fillAmount+1;
|
||||
else
|
||||
result = fillAmount;
|
||||
}
|
||||
|
||||
bots = result;
|
||||
}
|
||||
|
||||
amount = bots;
|
||||
if(fillMode == 0 || fillMode == 2)
|
||||
amount += players;
|
||||
if(getCvarInt("bots_manage_fill_spec"))
|
||||
amount += spec;
|
||||
|
||||
if(amount < fillAmount)
|
||||
setCvar("bots_manage_add", 1);
|
||||
else if(amount > fillAmount && getCvarInt("bots_manage_fill_kick"))
|
||||
{
|
||||
tempBot = random(getBotArray());
|
||||
if (isDefined(tempBot))
|
||||
kick(tempBot getEntityNumber());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A server thread for monitoring all bot's in game. Will add and kick bots according to server settings.
|
||||
*/
|
||||
addBots()
|
||||
{
|
||||
level endon("game_ended");
|
||||
|
||||
bot_wait_for_host();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
wait 1.5;
|
||||
|
||||
addBots_loop();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
A thread for ALL players when they fire.
|
||||
*/
|
||||
onWeaponFired()
|
||||
{
|
||||
self endon("disconnect");
|
||||
|
||||
self.bots_firing = false;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
self.bots_firing = false;
|
||||
|
||||
while (!self attackButtonPressed())
|
||||
wait 0.05;
|
||||
|
||||
self.bots_firing = true;
|
||||
|
||||
while (self attackButtonPressed())
|
||||
wait 0.05;
|
||||
|
||||
wait 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Launches the smoke
|
||||
*/
|
||||
launchSmoke(org)
|
||||
{
|
||||
nade = spawnStruct();
|
||||
nade.origin = org;
|
||||
|
||||
level.bots_smokeList ListAdd(nade);
|
||||
|
||||
wait 11.5;
|
||||
|
||||
level.bots_smokeList ListRemove(nade);
|
||||
}
|
||||
|
||||
/*
|
||||
Deletes smoke grenades when they explode
|
||||
*/
|
||||
watchNade()
|
||||
{
|
||||
self endon("death");
|
||||
|
||||
lastOrigin = self.origin;
|
||||
creationTime = getTime();
|
||||
timeSlow = 0;
|
||||
|
||||
wait 0.05;
|
||||
while(isDefined(self))
|
||||
{
|
||||
velocity = vector_scale(self.origin - lastOrigin, 20);
|
||||
lastOrigin = self.origin;
|
||||
|
||||
if (getTime() - creationTime > 4000)
|
||||
{
|
||||
if (lengthSquared(velocity) <= 0.05)
|
||||
timeSlow += 0.05;
|
||||
else
|
||||
timeSlow = 0;
|
||||
}
|
||||
|
||||
if (timeSlow > 1)
|
||||
{
|
||||
thread launchSmoke(lastOrigin);
|
||||
self delete();
|
||||
}
|
||||
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Watches nades
|
||||
*/
|
||||
watchNades_loop()
|
||||
{
|
||||
nades = getentarray ("grenade", "classname");
|
||||
|
||||
for (i = 0; i < nades.size; i++)
|
||||
{
|
||||
nade = nades[i];
|
||||
if (!isDefined(nade))
|
||||
continue;
|
||||
|
||||
if (isDefined(nade.bot_audit))
|
||||
continue;
|
||||
|
||||
nade.bot_audit = true;
|
||||
|
||||
nade thread watchNade();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Watches nades
|
||||
*/
|
||||
watchNades()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
wait 0.05;
|
||||
|
||||
watchNades_loop();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Watches the game to end
|
||||
*/
|
||||
watchGameEnded()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
wait 0.05;
|
||||
|
||||
if (isDefined(level.roundended))
|
||||
{
|
||||
if (level.roundended)
|
||||
break;
|
||||
}
|
||||
else if (isDefined(level.gameended))
|
||||
{
|
||||
if (level.gameended)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
level notify("game_ended");
|
||||
}
|
2211
mods/bots/maps/mp/bots/_bot_internal.gsc
Normal file
2211
mods/bots/maps/mp/bots/_bot_internal.gsc
Normal file
File diff suppressed because it is too large
Load Diff
3909
mods/bots/maps/mp/bots/_bot_script.gsc
Normal file
3909
mods/bots/maps/mp/bots/_bot_script.gsc
Normal file
File diff suppressed because it is too large
Load Diff
1700
mods/bots/maps/mp/bots/_bot_utility.gsc
Normal file
1700
mods/bots/maps/mp/bots/_bot_utility.gsc
Normal file
File diff suppressed because it is too large
Load Diff
1018
mods/bots/maps/mp/bots/_menu.gsc
Normal file
1018
mods/bots/maps/mp/bots/_menu.gsc
Normal file
File diff suppressed because it is too large
Load Diff
631
mods/bots/maps/mp/bots/_wp_editor.gsc
Normal file
631
mods/bots/maps/mp/bots/_wp_editor.gsc
Normal file
@ -0,0 +1,631 @@
|
||||
/*
|
||||
_wp_editor
|
||||
Author: INeedGames
|
||||
Date: 09/26/2020
|
||||
The ingame waypoint editor.
|
||||
*/
|
||||
|
||||
#include common_scripts\utility;
|
||||
#include maps\mp\_utility;
|
||||
#include maps\mp\gametypes\_hud_util;
|
||||
#include maps\mp\bots\_bot_utility;
|
||||
|
||||
init()
|
||||
{
|
||||
if(getDvar("bots_main_debug") == "")
|
||||
setDvar("bots_main_debug", 0);
|
||||
|
||||
if(!getDVarint("bots_main_debug"))
|
||||
return;
|
||||
|
||||
if(!getDVarint("developer"))
|
||||
{
|
||||
setdvar("developer_script", 1);
|
||||
setdvar("developer", 1);
|
||||
|
||||
setdvar("sv_mapRotation", "map "+getDvar("mapname"));
|
||||
exitLevel(false);
|
||||
}
|
||||
|
||||
setDvar("bots_main", 0);
|
||||
setdvar("bots_main_menu", 0);
|
||||
setdvar("bots_manage_fill_mode", 0);
|
||||
setdvar("bots_manage_fill", 0);
|
||||
setdvar("bots_manage_add", 0);
|
||||
setdvar("bots_manage_fill_kick", 1);
|
||||
setDvar("bots_manage_fill_spec", 1);
|
||||
|
||||
if (getDvar("bots_main_debug_distance") == "")
|
||||
setDvar("bots_main_debug_distance", 512.0);
|
||||
|
||||
if (getDvar("bots_main_debug_cone") == "")
|
||||
setDvar("bots_main_debug_cone", 0.65);
|
||||
|
||||
if (getDvar("bots_main_debug_minDist") == "")
|
||||
setDvar("bots_main_debug_minDist", 32.0);
|
||||
|
||||
if (getDvar("bots_main_debug_drawThrough") == "")
|
||||
setDvar("bots_main_debug_drawThrough", false);
|
||||
|
||||
if(getDvar("bots_main_debug_commandWait") == "")
|
||||
setDvar("bots_main_debug_commandWait", 0.5);
|
||||
|
||||
if(getDvar("bots_main_debug_framerate") == "")
|
||||
setDvar("bots_main_debug_framerate", 58);
|
||||
|
||||
if(getDvar("bots_main_debug_lineDuration") == "")
|
||||
setDvar("bots_main_debug_lineDuration", 3);
|
||||
|
||||
if(getDvar("bots_main_debug_printDuration") == "")
|
||||
setDvar("bots_main_debug_printDuration", 3);
|
||||
|
||||
if(getDvar("bots_main_debug_debugRate") == "")
|
||||
setDvar("bots_main_debug_debugRate", 0.5);
|
||||
|
||||
setDvar("player_sustainAmmo", 1);
|
||||
|
||||
level.waypoints = [];
|
||||
level.waypointCount = 0;
|
||||
|
||||
level waittill( "connected", player);
|
||||
|
||||
player thread onPlayerSpawned();
|
||||
}
|
||||
|
||||
onPlayerSpawned()
|
||||
{
|
||||
self endon("disconnect");
|
||||
for(;;)
|
||||
{
|
||||
self waittill("spawned_player");
|
||||
self thread beginDebug();
|
||||
}
|
||||
}
|
||||
|
||||
beginDebug()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
|
||||
level.wpToLink = -1;
|
||||
level.autoLink = false;
|
||||
self.closest = -1;
|
||||
self.command = undefined;
|
||||
|
||||
self clearPerks();
|
||||
self takeAllWeapons();
|
||||
self.specialty = [];
|
||||
self giveWeapon("m16_gl_mp");
|
||||
self SetActionSlot( 3, "altMode" );
|
||||
self giveWeapon("frag_grenade_mp");
|
||||
self freezecontrols(false);
|
||||
|
||||
self thread debug();
|
||||
self thread addWaypoints();
|
||||
self thread linkWaypoints();
|
||||
self thread deleteWaypoints();
|
||||
self thread watchSaveWaypointsCommand();
|
||||
self thread sayExtras();
|
||||
|
||||
self thread textScroll("^1SecondaryOffhand - ^2Add Waypoint; ^3MeleeButton - ^4Link Waypoint; ^5FragButton - ^6Delete Waypoint; ^7UseButton + AttackButton - ^8Save");
|
||||
}
|
||||
|
||||
sayExtras()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
self iprintln("Making a crouch waypoint with only one link...");
|
||||
self iprintln("Makes a camping waypoint.");
|
||||
}
|
||||
|
||||
debug()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
|
||||
self setClientDvar("com_maxfps", getDvarInt("bots_main_debug_framerate"));
|
||||
|
||||
for(;;)
|
||||
{
|
||||
wait getDvarFloat("bots_main_debug_debugRate");
|
||||
|
||||
if(isDefined(self.command))
|
||||
continue;
|
||||
|
||||
closest = -1;
|
||||
myEye = self getTagOrigin( "j_head" );
|
||||
myAngles = self GetPlayerAngles();
|
||||
|
||||
for(i = 0; i < level.waypointCount; i++)
|
||||
{
|
||||
if(closest == -1 || closer(self.origin, level.waypoints[i].origin, level.waypoints[closest].origin))
|
||||
closest = i;
|
||||
|
||||
wpOrg = level.waypoints[i].origin + (0, 0, 25);
|
||||
|
||||
if(distance(level.waypoints[i].origin, self.origin) < getDvarFloat("bots_main_debug_distance") && (bulletTracePassed(myEye, wpOrg, false, self) || getDVarint("bots_main_debug_drawThrough")))
|
||||
{
|
||||
for(h = level.waypoints[i].children.size - 1; h >= 0; h--)
|
||||
line(wpOrg, level.waypoints[level.waypoints[i].children[h]].origin + (0, 0, 25), (1,0,1), 1, 1, getDvarInt("bots_main_debug_lineDuration"));
|
||||
|
||||
if(getConeDot(wpOrg, myEye, myAngles) > getDvarFloat("bots_main_debug_cone"))
|
||||
print3d(wpOrg, i, (1,0,0), 2, 1, 6);
|
||||
|
||||
if (isDefined(level.waypoints[i].angles) && level.waypoints[i].type != "stand")
|
||||
line(wpOrg, wpOrg + AnglesToForward(level.waypoints[i].angles) * 64, (1,1,1), 1, 1, getDvarInt("bots_main_debug_lineDuration"));
|
||||
}
|
||||
}
|
||||
|
||||
self.closest = closest;
|
||||
|
||||
if(closest != -1)
|
||||
{
|
||||
stringChildren = "";
|
||||
for(i = 0; i < level.waypoints[closest].children.size; i++)
|
||||
{
|
||||
if(i != 0)
|
||||
stringChildren = stringChildren + "," + level.waypoints[closest].children[i];
|
||||
else
|
||||
stringChildren = stringChildren + level.waypoints[closest].children[i];
|
||||
}
|
||||
print3d(level.waypoints[closest].origin + (0, 0, 35), stringChildren, (0,1,0), 2, 1, getDvarInt("bots_main_debug_printDuration"));
|
||||
|
||||
print3d(level.waypoints[closest].origin + (0, 0, 15), level.waypoints[closest].type, (0,1,0), 2, 1, getDvarInt("bots_main_debug_printDuration"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AddWaypoints()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
for(;;)
|
||||
{
|
||||
while(!self SecondaryOffhandButtonPressed() || isDefined(self.command))
|
||||
wait 0.05;
|
||||
|
||||
pos = self getOrigin();
|
||||
self.command = true;
|
||||
|
||||
self iprintln("Adding a waypoint...");
|
||||
self iprintln("ADS - climb; Attack + Use - tube");
|
||||
self iprintln("Attack - grenade; Use - claymore");
|
||||
self iprintln("Else(wait) - your stance");
|
||||
|
||||
wait getDvarFloat("bots_main_debug_commandWait");
|
||||
|
||||
self addWaypoint(pos);
|
||||
|
||||
self.command = undefined;
|
||||
|
||||
while(self SecondaryOffhandButtonPressed())
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
linkWaypoints()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
for(;;)
|
||||
{
|
||||
while(!self MeleeButtonPressed() || isDefined(self.command))
|
||||
wait 0.05;
|
||||
|
||||
self.command = true;
|
||||
|
||||
self iprintln("ADS - Unlink; Else(wait) - Link");
|
||||
|
||||
wait getDvarFloat("bots_main_debug_commandWait");
|
||||
|
||||
if(!self adsButtonPressed())
|
||||
self LinkWaypoint(self.closest);
|
||||
else
|
||||
self UnLinkWaypoint(self.closest);
|
||||
|
||||
self.command = undefined;
|
||||
|
||||
while(self MeleeButtonPressed())
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
deleteWaypoints()
|
||||
{
|
||||
self endon("disconnect");
|
||||
self endon("death");
|
||||
for(;;)
|
||||
{
|
||||
while(!self fragButtonPressed() || isDefined(self.command))
|
||||
wait 0.05;
|
||||
|
||||
self.command = true;
|
||||
|
||||
self iprintln("Attack - DeleteAll; ADS - Load");
|
||||
self iprintln("Else(wait) - Delete");
|
||||
|
||||
wait getDvarFloat("bots_main_debug_commandWait");
|
||||
|
||||
if(self attackButtonPressed())
|
||||
self deleteAllWaypoints();
|
||||
else if(self adsButtonPressed())
|
||||
self LoadWaypoints();
|
||||
else
|
||||
self DeleteWaypoint(self.closest);
|
||||
|
||||
self.command = undefined;
|
||||
|
||||
while(self fragButtonPressed())
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
watchSaveWaypointsCommand()
|
||||
{
|
||||
self endon("death");
|
||||
self endon("disconnect");
|
||||
|
||||
for(;;)
|
||||
{
|
||||
while(!self useButtonPressed() || !self attackButtonPressed() || isDefined(self.command))
|
||||
wait 0.05;
|
||||
|
||||
self.command = true;
|
||||
|
||||
self iprintln("ADS - Autolink; Else(wait) - Save");
|
||||
|
||||
wait getDvarFloat("bots_main_debug_commandWait");
|
||||
|
||||
if(!self adsButtonPressed())
|
||||
{
|
||||
self checkForWarnings();
|
||||
wait 1;
|
||||
|
||||
logprint("***********ABiliTy's WPDump**************\n\n");
|
||||
logprint("\n\n\n\n");
|
||||
mpnm=getMapName(getdvar("mapname"));
|
||||
logprint("\n\n"+mpnm+"()\n{\n/*");
|
||||
logprint("*/waypoints = [];\n/*");
|
||||
for(i = 0; i < level.waypointCount; i++)
|
||||
{
|
||||
logprint("*/waypoints["+i+"] = spawnstruct();\n/*");
|
||||
logprint("*/waypoints["+i+"].origin = "+level.waypoints[i].origin+";\n/*");
|
||||
logprint("*/waypoints["+i+"].type = \""+level.waypoints[i].type+"\";\n/*");
|
||||
for(c = 0; c < level.waypoints[i].children.size; c++)
|
||||
{
|
||||
logprint("*/waypoints["+i+"].children["+c+"] = "+level.waypoints[i].children[c]+";\n/*");
|
||||
}
|
||||
if(isDefined(level.waypoints[i].angles) && (level.waypoints[i].type == "claymore" || level.waypoints[i].type == "tube" || (level.waypoints[i].type == "crouch" && level.waypoints[i].children.size == 1) || level.waypoints[i].type == "climb" || level.waypoints[i].type == "grenade"))
|
||||
logprint("*/waypoints["+i+"].angles = "+level.waypoints[i].angles+";\n/*");
|
||||
}
|
||||
logprint("*/return waypoints;\n}\n\n\n\n");
|
||||
|
||||
filename = "waypoints/" + getdvar("mapname") + "_wp.csv";
|
||||
fd = FS_FOpen(filename, "write");
|
||||
|
||||
PrintLn("********* Start Bot Warfare WPDump *********");
|
||||
PrintLn(level.waypointCount);
|
||||
|
||||
if (fd > 0)
|
||||
{
|
||||
if (!FS_WriteLine(fd, level.waypointCount+""))
|
||||
{
|
||||
FS_FClose(fd);
|
||||
fd = 0;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < level.waypointCount; i++)
|
||||
{
|
||||
str = "";
|
||||
wp = level.waypoints[i];
|
||||
|
||||
str += wp.origin[0] + " " + wp.origin[1] + " " + wp.origin[2] + ",";
|
||||
|
||||
for(h = 0; h < wp.children.size; h++)
|
||||
{
|
||||
str += wp.children[h];
|
||||
|
||||
if (h < wp.children.size - 1)
|
||||
str += " ";
|
||||
}
|
||||
str += "," + wp.type + ",";
|
||||
|
||||
if (isDefined(wp.angles))
|
||||
str += wp.angles[0] + " " + wp.angles[1] + " " + wp.angles[2] + ",";
|
||||
else
|
||||
str += ",";
|
||||
|
||||
str += ",";
|
||||
|
||||
PrintLn(str);
|
||||
|
||||
if (fd > 0)
|
||||
{
|
||||
if (!FS_WriteLine(fd, str))
|
||||
{
|
||||
FS_FClose(fd);
|
||||
fd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
PrintLn("\n\n\n\n\n\n");
|
||||
|
||||
self iprintln("Saved!!! to " + filename);
|
||||
|
||||
if (fd > 0)
|
||||
FS_FClose(fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(level.autoLink)
|
||||
{
|
||||
self iPrintlnBold("Auto link disabled");
|
||||
level.autoLink = false;
|
||||
level.wpToLink = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
self iPrintlnBold("Auto link enabled");
|
||||
level.autoLink = true;
|
||||
level.wpToLink = self.closest;
|
||||
}
|
||||
}
|
||||
|
||||
self.command = undefined;
|
||||
|
||||
while(self useButtonPressed() && self attackButtonPressed())
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
LoadWaypoints()
|
||||
{
|
||||
self DeleteAllWaypoints();
|
||||
self iPrintlnBold("Loading WPS...");
|
||||
load_waypoints();
|
||||
|
||||
wait 1;
|
||||
|
||||
self checkForWarnings();
|
||||
}
|
||||
|
||||
checkForWarnings()
|
||||
{
|
||||
if(level.waypointCount <= 0)
|
||||
self iprintln("WARNING: waypointCount is "+level.waypointCount);
|
||||
|
||||
if(level.waypointCount != level.waypoints.size)
|
||||
self iprintln("WARNING: waypointCount is not "+level.waypoints.size);
|
||||
|
||||
for(i = 0; i < level.waypointCount; i++)
|
||||
{
|
||||
if(!isDefined(level.waypoints[i]))
|
||||
{
|
||||
self iprintln("WARNING: waypoint "+i+" is undefined");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(level.waypoints[i].children.size <= 0)
|
||||
self iprintln("WARNING: waypoint "+i+" childCount is "+level.waypoints[i].children.size);
|
||||
else
|
||||
{
|
||||
if (!isDefined(level.waypoints[i].children) || !isDefined(level.waypoints[i].children.size))
|
||||
{
|
||||
self iprintln("WARNING: waypoint "+i+" children is not defined");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(h = level.waypoints[i].children.size - 1; h >= 0; h--)
|
||||
{
|
||||
child = level.waypoints[i].children[h];
|
||||
|
||||
if(!isDefined(level.waypoints[child]))
|
||||
self iprintln("WARNING: waypoint "+i+" child "+child+" is undefined");
|
||||
else if(child == i)
|
||||
self iprintln("WARNING: waypoint "+i+" child "+child+" is itself");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isDefined(level.waypoints[i].type))
|
||||
{
|
||||
self iprintln("WARNING: waypoint "+i+" type is undefined");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!isDefined(level.waypoints[i].angles) && (level.waypoints[i].type == "claymore" || level.waypoints[i].type == "tube" || (level.waypoints[i].type == "crouch" && level.waypoints[i].children.size == 1) || level.waypoints[i].type == "climb" || level.waypoints[i].type == "grenade"))
|
||||
self iprintln("WARNING: waypoint "+i+" angles is undefined");
|
||||
}
|
||||
}
|
||||
|
||||
DeleteAllWaypoints()
|
||||
{
|
||||
level.waypoints = [];
|
||||
level.waypointCount = 0;
|
||||
|
||||
self iprintln("DelAllWps");
|
||||
}
|
||||
|
||||
DeleteWaypoint(nwp)
|
||||
{
|
||||
if(nwp == -1 || distance(self.origin, level.waypoints[nwp].origin) > getDvarFloat("bots_main_debug_minDist"))
|
||||
{
|
||||
self iprintln("No close enough waypoint to delete.");
|
||||
return;
|
||||
}
|
||||
|
||||
level.wpToLink = -1;
|
||||
|
||||
for(i = level.waypoints[nwp].children.size - 1; i >= 0; i--)
|
||||
{
|
||||
child = level.waypoints[nwp].children[i];
|
||||
|
||||
level.waypoints[child].children = array_remove(level.waypoints[child].children, nwp);
|
||||
}
|
||||
|
||||
for(i = 0; i < level.waypointCount; i++)
|
||||
{
|
||||
for(h = level.waypoints[i].children.size - 1; h >= 0; h--)
|
||||
{
|
||||
if(level.waypoints[i].children[h] > nwp)
|
||||
level.waypoints[i].children[h]--;
|
||||
}
|
||||
}
|
||||
|
||||
for ( entry = 0; entry < level.waypointCount; entry++ )
|
||||
{
|
||||
if ( entry == nwp )
|
||||
{
|
||||
while ( entry < level.waypointCount-1 )
|
||||
{
|
||||
level.waypoints[entry] = level.waypoints[entry+1];
|
||||
entry++;
|
||||
}
|
||||
level.waypoints[entry] = undefined;
|
||||
break;
|
||||
}
|
||||
}
|
||||
level.waypointCount--;
|
||||
|
||||
self iprintln("DelWp "+nwp);
|
||||
}
|
||||
|
||||
addWaypoint(pos)
|
||||
{
|
||||
level.waypoints[level.waypointCount] = spawnstruct();
|
||||
|
||||
level.waypoints[level.waypointCount].origin = pos;
|
||||
|
||||
if(self AdsButtonPressed())
|
||||
level.waypoints[level.waypointCount].type = "climb";
|
||||
else if(self AttackButtonPressed() && self UseButtonPressed())
|
||||
level.waypoints[level.waypointCount].type = "tube";
|
||||
else if(self AttackButtonPressed())
|
||||
level.waypoints[level.waypointCount].type = "grenade";
|
||||
else if(self UseButtonPressed())
|
||||
level.waypoints[level.waypointCount].type = "claymore";
|
||||
else
|
||||
level.waypoints[level.waypointCount].type = self getStance();
|
||||
|
||||
level.waypoints[level.waypointCount].angles = self getPlayerAngles();
|
||||
|
||||
level.waypoints[level.waypointCount].children = [];
|
||||
|
||||
self iprintln(level.waypoints[level.waypointCount].type + " Waypoint "+ level.waypointCount +" Added at "+pos);
|
||||
|
||||
if(level.autoLink)
|
||||
{
|
||||
if(level.wpToLink == -1)
|
||||
level.wpToLink = level.waypointCount - 1;
|
||||
|
||||
level.waypointCount++;
|
||||
self LinkWaypoint(level.waypointCount - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
level.waypointCount++;
|
||||
}
|
||||
}
|
||||
|
||||
UnLinkWaypoint(nwp)
|
||||
{
|
||||
if(nwp == -1 || distance(self.origin, level.waypoints[nwp].origin) > getDvarFloat("bots_main_debug_minDist"))
|
||||
{
|
||||
self iprintln("Waypoint Unlink Cancelled "+level.wpToLink);
|
||||
level.wpToLink = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if(level.wpToLink == -1 || nwp == level.wpToLink)
|
||||
{
|
||||
level.wpToLink = nwp;
|
||||
self iprintln("Waypoint Unlink Started "+nwp);
|
||||
return;
|
||||
}
|
||||
|
||||
level.waypoints[nwp].children = array_remove(level.waypoints[nwp].children, level.wpToLink);
|
||||
level.waypoints[level.wpToLink].children = array_remove(level.waypoints[level.wpToLink].children, nwp);
|
||||
|
||||
self iprintln("Waypoint " + nwp + " Broken to " + level.wpToLink);
|
||||
level.wpToLink = -1;
|
||||
}
|
||||
|
||||
LinkWaypoint(nwp)
|
||||
{
|
||||
if(nwp == -1 || distance(self.origin, level.waypoints[nwp].origin) > getDvarFloat("bots_main_debug_minDist"))
|
||||
{
|
||||
self iprintln("Waypoint Link Cancelled "+level.wpToLink);
|
||||
level.wpToLink = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if(level.wpToLink == -1 || nwp == level.wpToLink)
|
||||
{
|
||||
level.wpToLink = nwp;
|
||||
self iprintln("Waypoint Link Started "+nwp);
|
||||
return;
|
||||
}
|
||||
|
||||
weGood = true;
|
||||
for(i = level.waypoints[level.wpToLink].children.size - 1; i >= 0; i--)
|
||||
{
|
||||
if(level.waypoints[level.wpToLink].children[i] == nwp)
|
||||
{
|
||||
weGood = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(weGood)
|
||||
{
|
||||
for(i = level.waypoints[nwp].children.size - 1; i >= 0; i--)
|
||||
{
|
||||
if(level.waypoints[nwp].children[i] == level.wpToLink)
|
||||
{
|
||||
weGood = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!weGood )
|
||||
{
|
||||
self iprintln("Waypoint Link Cancelled "+nwp+" and "+level.wpToLink+" already linked.");
|
||||
level.wpToLink = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
level.waypoints[level.wpToLink].children[level.waypoints[level.wpToLink].children.size] = nwp;
|
||||
level.waypoints[nwp].children[level.waypoints[nwp].children.size] = level.wpToLink;
|
||||
|
||||
self iprintln("Waypoint " + nwp + " Linked to " + level.wpToLink);
|
||||
level.wpToLink = -1;
|
||||
}
|
||||
|
||||
destroyOnDeath(hud)
|
||||
{
|
||||
hud endon("death");
|
||||
self waittill_either("death","disconnect");
|
||||
hud destroy();
|
||||
}
|
||||
|
||||
textScroll(string)
|
||||
{
|
||||
self endon("death");
|
||||
self endon("disconnect");
|
||||
//thanks ActionScript
|
||||
|
||||
back = createBar((0,0,0), 1000, 30);
|
||||
back setPoint("CENTER", undefined, 0, 220);
|
||||
self thread destroyOnDeath(back);
|
||||
|
||||
text = createFontString("default", 1.5);
|
||||
text setText(string);
|
||||
self thread destroyOnDeath(text);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
text setPoint("CENTER", undefined, 1200, 220);
|
||||
text setPoint("CENTER", undefined, -1200, 220, 20);
|
||||
wait 20;
|
||||
}
|
||||
}
|
3
mods/bots/maps/mp/bots/waypoints/_custom_map.gsc
Normal file
3
mods/bots/maps/mp/bots/waypoints/_custom_map.gsc
Normal file
@ -0,0 +1,3 @@
|
||||
main(mapname)
|
||||
{
|
||||
}
|
@ -3,6 +3,8 @@ init()
|
||||
level.clientid = 0;
|
||||
|
||||
level thread onPlayerConnect();
|
||||
|
||||
level thread maps\mp\bots\_bot::init();
|
||||
}
|
||||
|
||||
onPlayerConnect()
|
||||
|
1
z_client.bat
Normal file
1
z_client.bat
Normal file
@ -0,0 +1 @@
|
||||
start "" "%~dp0CoD2MP_s.exe" +set fs_game "mods/bots" +set developer "1" +set developer_script "1" +set com_introPlayed "1"
|
Loading…
x
Reference in New Issue
Block a user