Start push update

This commit is contained in:
INeedBots
2021-02-18 13:53:14 -06:00
parent e11e055c68
commit 69bca119d9
85 changed files with 14865 additions and 14605 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,507 @@
/*
_bot_utility
Author: INeedGames
Date: 12/20/2020
The shared functions for bots
*/
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
/*
Returns an array of all the bots in the game.
*/
getBotArray()
{
result = [];
playercount = level.players.size;
for(i = 0; i < playercount; i++)
{
player = level.players[i];
if(!player is_bot())
continue;
result[result.size] = player;
}
return result;
}
/*
Returns a good amount of players.
*/
getGoodMapAmount()
{
switch(getdvar("mapname"))
{
default:
return 2;
}
}
/*
Rounds to the nearest whole number.
*/
Round(x)
{
y = int(x);
if(abs(x) - abs(y) > 0.5)
{
if(x < 0)
return y - 1;
else
return y + 1;
}
else
return y;
}
/*
Picks a random thing
*/
PickRandom(arr)
{
if (!arr.size)
return undefined;
return arr[randomInt(arr.size)];
}
/*
If is defusing
*/
isDefusing()
{
return (isDefined(self.isDefusing) && self.isDefusing);
}
/*
If is defusing
*/
isPlanting()
{
return (isDefined(self.isPlanting) && self.isPlanting);
}
/*
If is defusing
*/
inLastStand()
{
return (isDefined(self.laststand) && self.laststand);
}
/*
Is they the flag carrier men?
*/
isFlagCarrier()
{
return (isDefined(self.isFlagCarrier) && self.isFlagCarrier);
}
/*
If the site is in use
*/
isInUse()
{
return (isDefined(self.inUse) && self.inUse);
}
/*
If the player is carrying a bomb
*/
isBombCarrier()
{
return (isDefined(self.isBombCarrier) && self.isBombCarrier);
}
/*
Gets the bot's difficulty number
*/
GetBotDiffNum()
{
num = 0;
switch (getDvar("bot_difficulty"))
{
case "fu":
num = 3;
break;
case "hard":
num = 2;
break;
case "normal":
num = 1;
break;
case "easy":
default:
num = 0;
break;
}
return num;
}
/*
Taken from iw4 script
*/
waittill_any_timeout( timeOut, string1, string2, string3, string4, string5 )
{
if ( ( !isdefined( string1 ) || string1 != "death" ) &&
( !isdefined( string2 ) || string2 != "death" ) &&
( !isdefined( string3 ) || string3 != "death" ) &&
( !isdefined( string4 ) || string4 != "death" ) &&
( !isdefined( string5 ) || string5 != "death" ) )
self endon( "death" );
ent = spawnstruct();
if ( isdefined( string1 ) )
self thread waittill_string( string1, ent );
if ( isdefined( string2 ) )
self thread waittill_string( string2, ent );
if ( isdefined( string3 ) )
self thread waittill_string( string3, ent );
if ( isdefined( string4 ) )
self thread waittill_string( string4, ent );
if ( isdefined( string5 ) )
self thread waittill_string( string5, ent );
ent thread _timeout( timeOut );
ent waittill( "returned", msg );
ent notify( "die" );
return msg;
}
/*
Used for waittill_any_timeout
*/
_timeout( delay )
{
self endon( "die" );
wait( delay );
self notify( "returned", "timeout" );
}
/*
Waits for a host player
*/
bot_wait_for_host()
{
host = undefined;
while (!isDefined(level) || !isDefined(level.players))
wait 0.05;
for(i = getDvarFloat("bots_main_waitForHostTime"); i > 0; i -= 0.05)
{
host = GetHostPlayer();
if(isDefined(host))
break;
wait 0.05;
}
if(!isDefined(host))
return;
for(i = getDvarFloat("bots_main_waitForHostTime"); i > 0; i -= 0.05)
{
if(IsDefined( host.pers[ "team" ] ))
break;
wait 0.05;
}
if(!IsDefined( host.pers[ "team" ] ))
return;
for(i = getDvarFloat("bots_main_waitForHostTime"); i > 0; i -= 0.05)
{
if(host.pers[ "team" ] == "allies" || host.pers[ "team" ] == "axis")
break;
wait 0.05;
}
}
/*
Wrapper for setgoal
*/
SetBotGoal(where, dist)
{
self SetScriptGoal(where, dist);
waittillframeend;
self notify("new_goal");
}
/*
Weapper for cleargoal
*/
ClearBotGoal()
{
self ClearScriptGoal();
waittillframeend;
self notify("new_goal");
}
/*
Freezes bot in place
*/
botStopMove(what)
{
self endon("disconnect");
self endon("death");
level endon("game_ended");
self notify("botStopMove");
self endon("botStopMove");
if (!what)
return;
og = self.origin;
for (;;)
{
self setVelocity((0,0,0));
self setOrigin(og);
wait 0.05;
}
}
/*
Matches a num to a char
*/
keyCodeToString(a)
{
b="";
switch(a)
{
case 0: b= "a"; break;
case 1: b= "b"; break;
case 2: b= "c"; break;
case 3: b= "d"; break;
case 4: b= "e"; break;
case 5: b= "f"; break;
case 6: b= "g"; break;
case 7: b= "h"; break;
case 8: b= "i"; break;
case 9: b= "j"; break;
case 10: b= "k"; break;
case 11: b= "l"; break;
case 12: b= "m"; break;
case 13: b= "n"; break;
case 14: b= "o"; break;
case 15: b= "p"; break;
case 16: b= "q"; break;
case 17: b= "r"; break;
case 18: b= "s"; break;
case 19: b= "t"; break;
case 20: b= "u"; break;
case 21: b= "v"; break;
case 22: b= "w"; break;
case 23: b= "x"; break;
case 24: b= "y"; break;
case 25: b= "z"; break;
case 26: b= "."; break;
case 27: b= " "; break;
}
return b;
}
/*
Does the extra check when adding bots
*/
doExtraCheck()
{
maps\mp\bots\_bot_script::checkTheBots();
}
/*
Returns the cone dot (like fov, or distance from the center of our screen).
*/
getConeDot(to, from, dir)
{
dirToTarget = VectorNormalize(to-from);
forward = AnglesToForward(dir);
return vectordot(dirToTarget, forward);
}
/*
Fixes sd bomb planting
*/
bot_onUsePlantObjectFix( player )
{
// planted the bomb
if ( !self maps\mp\gametypes\_gameobjects::isFriendlyTeam( player.pers["team"] ) )
{
level thread bot_bombPlanted( self, player );
player logString( "bomb planted: " + self.label );
// disable all bomb zones except this one
for ( index = 0; index < level.bombZones.size; index++ )
{
if ( level.bombZones[index] == self )
continue;
level.bombZones[index] maps\mp\gametypes\_gameobjects::disableObject();
}
thread playSoundOnPlayers( "mus_sd_planted"+"_"+level.teamPostfix[player.pers["team"]] );
// removed plant audio until finalization of assest TODO : new plant sounds when assests are online
// player playSound( "mpl_sd_bomb_plant" );
player notify ( "bomb_planted" );
level thread maps\mp\_popups::DisplayTeamMessageToAll( &"MP_EXPLOSIVES_PLANTED_BY", player );
if( isdefined(player.pers["plants"]) )
{
player.pers["plants"]++;
player.plants = player.pers["plants"];
}
player maps\mp\_medals::saboteur();
player maps\mp\gametypes\_persistence::statAddWithGameType( "PLANTS", 1 );
maps\mp\gametypes\_globallogic_audio::leaderDialog( "bomb_planted" );
maps\mp\gametypes\_globallogic_score::givePlayerScore( "plant", player );
//player thread [[level.onXPEvent]]( "plant" );
}
}
/*
Fixes sd bomb planting
*/
bot_bombPlanted( destroyedObj, player )
{
maps\mp\gametypes\_globallogic_utils::pauseTimer();
level.bombPlanted = true;
destroyedObj.visuals[0] thread maps\mp\gametypes\_globallogic_utils::playTickingSound( "mpl_sab_ui_suitcasebomb_timer" );
//Play suspense music
level thread maps\mp\gametypes\sd::bombPlantedMusicDelay();
//thread maps\mp\gametypes\_globallogic_audio::actionMusicSet();
level.tickingObject = destroyedObj.visuals[0];
level.timeLimitOverride = true;
setGameEndTime( int( gettime() + (level.bombTimer * 1000) ) );
setMatchFlag( "bomb_timer", 1 );
if ( !level.multiBomb )
{
level.sdBomb maps\mp\gametypes\_gameobjects::allowCarry( "none" );
level.sdBomb maps\mp\gametypes\_gameobjects::setVisibleTeam( "none" );
level.sdBomb maps\mp\gametypes\_gameobjects::setDropped();
level.sdBombModel = level.sdBomb.visuals[0];
}
else
{
for ( index = 0; index < level.players.size; index++ )
{
if ( isDefined( level.players[index].carryIcon ) )
level.players[index].carryIcon destroyElem();
}
trace = bulletTrace( player.origin + (0,0,20), player.origin - (0,0,2000), false, player );
tempAngle = randomfloat( 360 );
forward = (cos( tempAngle ), sin( tempAngle ), 0);
forward = vectornormalize( forward - vector_scale( trace["normal"], vectordot( forward, trace["normal"] ) ) );
dropAngles = vectortoangles( forward );
level.sdBombModel = spawn( "script_model", trace["position"] );
level.sdBombModel.angles = dropAngles;
level.sdBombModel setModel( "prop_suitcase_bomb" );
}
destroyedObj maps\mp\gametypes\_gameobjects::allowUse( "none" );
destroyedObj maps\mp\gametypes\_gameobjects::setVisibleTeam( "none" );
/*
destroyedObj maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", undefined );
destroyedObj maps\mp\gametypes\_gameobjects::set2DIcon( "enemy", undefined );
destroyedObj maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", undefined );
destroyedObj maps\mp\gametypes\_gameobjects::set3DIcon( "enemy", undefined );
*/
label = destroyedObj maps\mp\gametypes\_gameobjects::getLabel();
// create a new object to defuse with.
trigger = destroyedObj.bombDefuseTrig;
trigger.origin = level.sdBombModel.origin;
visuals = [];
defuseObject = maps\mp\gametypes\_gameobjects::createUseObject( game["defenders"], trigger, visuals, (0,0,32) );
defuseObject maps\mp\gametypes\_gameobjects::allowUse( "friendly" );
defuseObject maps\mp\gametypes\_gameobjects::setUseTime( level.defuseTime );
defuseObject maps\mp\gametypes\_gameobjects::setUseText( &"MP_DEFUSING_EXPLOSIVE" );
defuseObject maps\mp\gametypes\_gameobjects::setUseHintText( &"PLATFORM_HOLD_TO_DEFUSE_EXPLOSIVES" );
defuseObject maps\mp\gametypes\_gameobjects::setVisibleTeam( "any" );
defuseObject maps\mp\gametypes\_gameobjects::set2DIcon( "friendly", "compass_waypoint_defuse" + label );
defuseObject maps\mp\gametypes\_gameobjects::set2DIcon( "enemy", "compass_waypoint_defend" + label );
defuseObject maps\mp\gametypes\_gameobjects::set3DIcon( "friendly", "waypoint_defuse" + label );
defuseObject maps\mp\gametypes\_gameobjects::set3DIcon( "enemy", "waypoint_defend" + label );
defuseObject.label = label;
defuseObject.onBeginUse = maps\mp\gametypes\sd::onBeginUse;
defuseObject.onEndUse = maps\mp\gametypes\sd::onEndUse;
defuseObject.onUse = maps\mp\gametypes\sd::onUseDefuseObject;
defuseObject.useWeapon = "briefcase_bomb_defuse_mp";
level.defuseObject = defuseObject;//every cod...
player.isBombCarrier = false;
maps\mp\gametypes\sd::BombTimerWait();
setMatchFlag( "bomb_timer", 0 );
destroyedObj.visuals[0] maps\mp\gametypes\_globallogic_utils::stopTickingSound();
if ( level.gameEnded || level.bombDefused )
return;
level.bombExploded = true;
explosionOrigin = level.sdBombModel.origin+(0,0,12);
level.sdBombModel hide();
if ( isdefined( player ) )
{
destroyedObj.visuals[0] radiusDamage( explosionOrigin, 512, 200, 20, player, "MOD_EXPLOSIVE", "briefcase_bomb_mp" );
level thread maps\mp\_popups::DisplayTeamMessageToAll( &"MP_EXPLOSIVES_BLOWUP_BY", player );
player maps\mp\_medals::bomber();
player maps\mp\gametypes\_persistence::statAddWithGameType( "DESTRUCTIONS", 1 );
}
else
destroyedObj.visuals[0] radiusDamage( explosionOrigin, 512, 200, 20, undefined, "MOD_EXPLOSIVE", "briefcase_bomb_mp" );
rot = randomfloat(360);
explosionEffect = spawnFx( level._effect["bombexplosion"], explosionOrigin + (0,0,50), (0,0,1), (cos(rot),sin(rot),0) );
triggerFx( explosionEffect );
thread playSoundinSpace( "mpl_sd_exp_suitcase_bomb_main", explosionOrigin );
//thread maps\mp\gametypes\_globallogic_audio::set_music_on_team( "SILENT", "both" );
if ( isDefined( destroyedObj.exploderIndex ) )
exploder( destroyedObj.exploderIndex );
for ( index = 0; index < level.bombZones.size; index++ )
level.bombZones[index] maps\mp\gametypes\_gameobjects::disableObject();
defuseObject maps\mp\gametypes\_gameobjects::disableObject();
setGameEndTime( 0 );
wait 3;
maps\mp\gametypes\sd::sd_endGame( game["attackers"], game["strings"]["target_destroyed"] );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,102 +0,0 @@
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
///////////////Bot Warfare////////////////
Feel free to use code, however give credit where credit is due!
-INeedGames/INeedBot(s) @ ineedbots@outlook.org
|________________________________________|
Contents:
1: Features
2: Installation/Requirements
3: FAQs/Notes
4: Changelog
5: Credits
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
///////////////1: Features////////////////
This mod extends the functionality and features of Combat Training in Black Ops multiplayer.
Menu changes (combat training menu):
You can select any game mode.
You can change prestige classes if available.
You can change your clan tag, emblem and calling card.
You can prestige.
Increased limits of bot numbers.
Bot changes:
Bots play all game modes (capture flags, plant and defuse, etc.).
Bots take out spyplanes and counter spyplanes.
Bots react to the uav, jammer, decoys, motion sensor and camera spike.
Bots can destroy tactical insertions.
Bots can call in chopper gunner and gun ship but do not use it.
Bots can hack claymores if they are not facing it.
Fixed bots never reviving a player if they move.
Fixed bots trying to capture a hacked care package when they can't because its on their team.
Silencers will not cause other bots to look in the firer's direction.
Bots class, rank, and cod points all persist across rounds.
Bots will spend cod points on everything they choose now (not just gun and perk like before).
Bots can choose two attachments if they have the perk.
Bots can skip killcams.
Bots have a slight delay after spawning, scales inversely with difficulty.
Bots can reroll carepackages.
Bots can use the valkyrie rocket carepackage streak.
|________________________________________|
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
///////2: Installation/Requirements///////
If you want to install it as a mod:
1. Locate the root folder which your game is installed in.
2. Locate the 'mods' folder, if there isn't one, make it.
3. Move the 'mp_bots' folder found in the 'Move to mods folder' into the 'mods' folder.
4. The file/folder structure should be '.BORoot\mods\mp_bots\mp_bots.iwd'.
5. Simply run the game, go to the 'Mods' menu and select 'mp_bots'.
6. Thats it, go play!
If you want to rank up with the mod:
WARNING: Make sure to backup your patch_mp.ff and patch_ui_mp.ff files! You will not be able to play on servers with different FFs!
1. Locate the root folder which your game is installed in.
2. Go into the folder 'zone' and then into the folder 'Common'.
3. Move the two files 'patch_mp.ff' and 'patch_ui_mp.ff' from the 'Others' folder into the 'Common' folder, replacing the files.
4. Now run the game and the mod will be running by default. (No need to select the mod from the in-game menu)
|________________________________________|
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
///////////////3: FAQs/Notes//////////////
Q: DLC maps have no images (with rank up option)!
A: It appears Treyarch has put the materials for these maps in the original patch_mp.ff file. It is currently not known how to insert materials into a FF as they are streamed.
Q: I'm getting menu asset limit errors when I switch to a mod (with rank up option)!
A: The modified FFs have menu files in them. Restoring back to your original FF files will fix this.
TODO:
Make bots use remote helicopters, possible?
Make bots use alt weapon types (tube, master key, flamethrower) possible?
|________________________________________|
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
///////////////4: Changelog///////////////
v1.03(01/05/2020):
Fixed bots switching to secondaries all the time.
Bots can freely switch to their secondaries.
Fixed HCTDM scorelimit menu option.
v1.02(05/06/2018):
Fixed a few small bugs. A possible infinite loop when bots are too poor for a grenade and reasonable setups are on, and bots never spawning after death with forcerespawn off.
Added an option to allow for UNLIMITED score.
v1.01(03/02/2018):
Fixed bot's rank not updating after a multiround.
Can now set bot numbers for friends and enemies from 0 - 30 within menu. (15v15) (1v29)
v1.0(02/08/2018):
Initial release.
|________________________________________|
|\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
////////////////5: Credits////////////////
INeedGames(me) - creator: http://www.moddb.com/mods/bot-warfare
apdonato - ideas and/of implementation of code from their 'BO patch': http://rsebots.blogspot.ca/
|________________________________________|
Feel free to use code, host on other sites, host on servers, mod it and merge mods with it, just give credit where credit is due!
-INeedGames/INeedBot(s) @ ineedbots@outlook.org