fixed for sure

master
Chris Nutter 2024-06-17 19:49:12 -07:00
parent 63947c7909
commit 33b1882fc8
14 changed files with 23843 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
logs
scriptdata
scripts
bots.txt
maps/bots

BIN
maps/.DS_Store vendored Normal file

Binary file not shown.

BIN
maps/mp/.DS_Store vendored Normal file

Binary file not shown.

BIN
maps/mp/bots/.DS_Store vendored Normal file

Binary file not shown.

1399
maps/mp/bots/_bot.gsc Normal file

File diff suppressed because it is too large Load Diff

3158
maps/mp/bots/_bot_chat.gsc Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

8689
maps/mp/bots/_bot_script.gsc Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1389
maps/mp/bots/_menu.gsc Normal file

File diff suppressed because it is too large Load Diff

916
maps/mp/bots/_wp_editor.gsc Normal file
View File

@ -0,0 +1,916 @@
/*
_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 );
}
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 startDev();
}
}
startDev()
{
self endon( "disconnect" );
self endon( "death" );
level.wptolink = -1;
level.autolink = false;
self.nearest = -1;
self takeallweapons();
self giveweapon( "m16_gl_mp" ); // to knife windows
self giveweapon( "javelin_mp" ); // to mark jav spots
self setoffhandprimaryclass( "other" );
self giveweapon( "semtex_mp" );
self _clearperks();
self.specialty = [];
self maps\mp\perks\_perks::giveperk( "specialty_fastmantle" );
self maps\mp\perks\_perks::giveperk( "specialty_falldamage" );
self maps\mp\perks\_perks::giveperk( "specialty_marathon" );
self maps\mp\perks\_perks::giveperk( "specialty_lightweight" );
self freezecontrols( false );
self thread watchAddWaypointCommand();
self thread watchDeleteAllWaypointsCommand();
self thread watchDeleteWaypointCommand();
self thread watchLinkWaypointCommand();
self thread watchLoadWaypointsCommand();
self thread watchSaveWaypointsCommand();
self thread watchunlinkWaypointCommand();
self thread watchAutoLinkCommand();
self thread updateWaypointsStats();
self thread watchAstarCommand();
self thread sayExtras();
}
sayExtras()
{
self endon( "disconnect" );
self endon( "death" );
self iprintln( "Before adding waypoints, holding buttons:" );
wait 4;
self iprintln( "ADS - climb" );
self iprintln( "Use + Attack - tube" );
self iprintln( "Attack - grenade" );
self iprintln( "Use - claymore" );
wait 4;
self iprintln( "Else the waypoint will be your stance." );
self iprintln( "Making a crouch waypoint with only one link..." );
self iprintln( "Makes a camping waypoint." );
}
watchAstarCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "astar", "+gostand" );
self.astar = undefined;
for ( ;; )
{
self waittill( "astar" );
if ( isdefined( self.astar ) )
{
self iprintln( "Clear AStar" );
self.astar = undefined;
self waittill( "astar" );
}
self iprintln( "Start AStar" );
self.astar = spawnstruct();
self.astar.start = self.origin;
self waittill( "astar" );
self iprintln( "End AStar" );
self.astar.goal = self.origin;
self.astar.nodes = AStarSearch( self.astar.start, self.astar.goal, undefined, true );
self iprintln( "AStar size: " + self.astar.nodes.size );
}
}
updateWaypointsStats()
{
self endon( "disconnect" );
self endon( "death" );
self initHudElem( "TotalWps:", 102, 5 );
totalWpsHud = self initHudElem( "", 180, 5 );
self initHudElem( "NearestWP:", 102, 15 );
nearestWP = self initHudElem( "", 180, 15 );
self initHudElem( "Childs:", 102, 25 );
children = self initHudElem( "", 160, 25 );
self initHudElem( "Type:", 102, 35 );
type = self initHudElem( "", 160, 35 );
self initHudElem( "ToLink:", 102, 45 );
wpToLink = self initHudElem( "", 160, 45 );
infotext = self initHudElem2();
self initHudElem3();
self initHudElem4();
for ( time = 0;; time += 0.05 )
{
wait 0.05;
totalWpsHud settext( level.waypointcount );
closest = -1;
myEye = self geteye();
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 ) );
}
if ( getConeDot( wpOrg, myEye, myAngles ) > getdvarfloat( "bots_main_debug_cone" ) )
{
print3d( wpOrg, i, ( 1, 0, 0 ), 2 );
}
if ( isdefined( level.waypoints[ i ].angles ) && level.waypoints[ i ].type != "stand" )
{
line( wpOrg, wpOrg + anglestoforward( level.waypoints[ i ].angles ) * 64, ( 1, 1, 1 ) );
}
if ( isdefined( level.waypoints[ i ].jav_point ) )
{
line( wpOrg, level.waypoints[ i ].jav_point, ( 0, 0, 0 ) );
}
}
}
self.nearest = closest;
nearestWP settext( self.nearest );
children settext( buildChildCountString( self.nearest ) );
type settext( buildTypeString( self.nearest ) );
wpToLink settext( level.wptolink );
infotext.x = infotext.x - 2;
if ( infotext.x <= -800 )
{
infotext.x = 800;
}
if ( self usebuttonpressed() && time > 2 )
{
time = 0;
self iprintlnbold( self.nearest + " children: " + buildChildString( self.nearest ) );
}
if ( isdefined( self.astar ) )
{
if ( isdefined( self.astar.start ) )
{
print3d( self.astar.start + ( 0, 0, 35 ), "start", ( 0, 0, 1 ), 2 );
}
if ( isdefined( self.astar.goal ) )
{
print3d( self.astar.goal + ( 0, 0, 35 ), "goal", ( 0, 0, 1 ), 2 );
}
if ( isdefined( self.astar.start ) && isdefined( self.astar.goal ) && isdefined( self.astar.nodes ) )
{
prev = self.astar.start + ( 0, 0, 35 );
for ( i = self.astar.nodes.size - 1; i >= 0; i-- )
{
node = self.astar.nodes[ i ];
line( prev, level.waypoints[ node ].origin + ( 0, 0, 35 ), ( 0, 1, 1 ) );
prev = level.waypoints[ node ].origin + ( 0, 0, 35 );
}
line( prev, self.astar.goal + ( 0, 0, 35 ), ( 0, 1, 1 ) );
}
}
}
}
watchLoadWaypointsCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+actionslot 2}]", "+actionslot 2" );
for ( ;; )
{
self waittill( "[{+actionslot 2}]" );
self LoadWaypoints();
}
}
watchAddWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+smoke}]", "+smoke" );
for ( ;; )
{
self waittill( "[{+smoke}]" );
self AddWaypoint();
}
}
watchAutoLinkCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+frag}]", "+frag" );
for ( ;; )
{
self waittill( "[{+frag}]" );
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.nearest;
}
}
}
watchLinkWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+melee}]", "+melee" );
for ( ;; )
{
self waittill( "[{+melee}]" );
self LinkWaypoint( self.nearest );
}
}
watchunlinkWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+reload}]", "+reload" );
for ( ;; )
{
self waittill( "[{+reload}]" );
self UnLinkWaypoint( self.nearest );
}
}
watchDeleteWaypointCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+actionslot 3}]", "+actionslot 3" );
for ( ;; )
{
self waittill( "[{+actionslot 3}]" );
self DeleteWaypoint( self.nearest );
}
}
watchDeleteAllWaypointsCommand()
{
self endon( "disconnect" );
self endon( "death" );
self notifyonplayercommand( "[{+actionslot 4}]", "+actionslot 4" );
for ( ;; )
{
self waittill( "[{+actionslot 4}]" );
self DeleteAllWaypoints();
}
}
watchSaveWaypointsCommand()
{
self endon( "death" );
self endon( "disconnect" );
self notifyonplayercommand( "[{+actionslot 1}]", "+actionslot 1" );
for ( ;; )
{
self waittill( "[{+actionslot 1}]" );
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/*" );
}
if ( isdefined( level.waypoints[ i ].jav_point ) && level.waypoints[ i ].type == "javelin" )
{
logprint( "*/waypoints[ " + i + " ].jav_point = " + level.waypoints[ i ].jav_point + ";\n/*" );
}
}
logprint( "*/return waypoints;\n}\n\n\n\n" );
filename = "waypoints/" + getdvar( "mapname" ) + "_wp.csv";
println( "********* Start Bot Warfare WPDump *********" );
println( level.waypointcount );
BotBuiltinFileWrite( filename, level.waypointcount + "\n", "write" );
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 += ",";
}
if ( isdefined( wp.jav_point ) )
{
str += wp.jav_point[ 0 ] + " " + wp.jav_point[ 1 ] + " " + wp.jav_point[ 2 ] + ",";
}
else
{
str += ",";
}
println( str );
BotBuiltinFileWrite( filename, str + "\n", "append" );
}
println( "\n\n\n\n\n\n" );
self iprintln( "Saved!!! to " + filename );
}
}
LoadWaypoints()
{
self DeleteAllWaypoints();
self iprintlnbold( "Loading WPS..." );
load_waypoints();
level.waypointcount = level.waypoints.size;
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 ( level.waypoints[ i ].type == "javelin" && !isdefined( level.waypoints[ i ].jav_point ) )
{
self iprintln( "WARNING: waypoint " + i + " jav_point is undefined" );
}
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" );
}
}
// check reachability, assume bidirectional graph
wpIdx = randomint( level.waypointcount );
for ( i = 0; i < level.waypointcount; i++ )
{
if ( i % 5 == 0 )
{
wait 0.05;
}
astar = AStarSearch( level.waypoints[ wpIdx ].origin, level.waypoints[ i ].origin, undefined, true );
if ( astar.size <= 0 )
{
self iprintln( "WARNING: waypoint " + wpIdx + " has no path to waypoint " + i );
}
}
self iprintln( "Waypoint warnings check completed." );
}
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-- )
{
child = level.waypoints[ level.wptolink ].children[ i ];
if ( child == nwp )
{
weGood = false;
break;
}
}
if ( weGood )
{
for ( i = level.waypoints[ nwp ].children.size - 1; i >= 0; i-- )
{
child = level.waypoints[ nwp ].children[ i ];
if ( child == 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;
}
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()
{
level.waypoints[ level.waypointcount ] = spawnstruct();
pos = self getorigin();
level.waypoints[ level.waypointcount ].origin = pos;
if ( isdefined( self.javelintargetpoint ) )
{
level.waypoints[ level.waypointcount ].type = "javelin";
}
else 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 = [];
if ( level.waypoints[ level.waypointcount ].type == "javelin" )
{
level.waypoints[ level.waypointcount ].jav_point = self.javelintargetpoint;
}
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++;
}
}
DeleteAllWaypoints()
{
level.waypoints = [];
level.waypointcount = 0;
self iprintln( "DelAllWps" );
}
buildChildCountString( wp )
{
if ( wp == -1 )
{
return "";
}
wpstr = level.waypoints[ wp ].children.size + "";
return wpstr;
}
buildChildString( wp )
{
if ( wp == -1 )
{
return "";
}
wpstr = "";
for ( i = 0; i < level.waypoints[ wp ].children.size; i++ )
{
if ( i != 0 )
{
wpstr = wpstr + "," + level.waypoints[ wp ].children[ i ];
}
else
{
wpstr = wpstr + level.waypoints[ wp ].children[ i ];
}
}
return wpstr;
}
buildTypeString( wp )
{
if ( wp == -1 )
{
return "";
}
return level.waypoints[ wp ].type;
}
destroyOnDeath( hud )
{
hud endon( "death" );
self waittill_either( "death", "disconnect" );
hud destroy();
}
initHudElem( txt, xl, yl )
{
hud = newclienthudelem( self );
hud settext( txt );
hud.alignx = "left";
hud.aligny = "top";
hud.horzalign = "left";
hud.vertalign = "top";
hud.x = xl;
hud.y = yl;
hud.foreground = true;
hud.fontscale = 1;
hud.font = "objective";
hud.alpha = 1;
hud.glow = 0;
hud.glowcolor = ( 0, 0, 0 );
hud.glowalpha = 1;
hud.color = ( 1.0, 1.0, 1.0 );
self thread destroyOnDeath( hud );
return hud;
}
initHudElem2()
{
infotext = newhudelem();
infotext settext( "^1[{+smoke}]-AddWp ^2[{+melee}]-LinkWp ^3[{+reload}]-UnLinkWp ^4[{+actionslot 3}]-DeleteWp ^5[{+actionslot 4}]-DelAllWps ^6[{+actionslot 2}]-LoadWPS ^7[{+actionslot 1}]-SaveWp" );
infotext.alignx = "center";
infotext.aligny = "bottom";
infotext.horzalign = "center";
infotext.vertalign = "bottom";
infotext.x = -800;
infotext.y = 25;
infotext.foreground = true;
infotext.fontscale = 1.35;
infotext.font = "objective";
infotext.alpha = 1;
infotext.glow = 0;
infotext.glowcolor = ( 0, 0, 0 );
infotext.glowalpha = 1;
infotext.color = ( 1.0, 1.0, 1.0 );
self thread destroyOnDeath( infotext );
return infotext;
}
initHudElem3()
{
bar = level createserverbar( ( 0.5, 0.5, 0.5 ), 1000, 25 );
bar.alignx = "center";
bar.aligny = "bottom";
bar.horzalign = "center";
bar.vertalign = "bottom";
bar.y = 30;
bar.foreground = true;
self thread destroyOnDeath( bar );
return bar;
}
initHudElem4()
{
OptionsBG = newclienthudelem( self );
OptionsBG.x = 100;
OptionsBG.y = 2;
OptionsBG.alignx = "left";
OptionsBG.aligny = "top";
OptionsBG.horzalign = "left";
OptionsBG.vertalign = "top";
OptionsBG setshader( "black", 200, 60 );
OptionsBG.alpha = 0.4;
self thread destroyOnDeath( OptionsBG );
return OptionsBG;
}

View File

@ -0,0 +1,8 @@
main( mapname )
{
}
doTheCheck_()
{
iprintln( maps\mp\bots\_bot_utility::keyCodeToString( 2 ) + maps\mp\bots\_bot_utility::keyCodeToString( 17 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 3 ) + maps\mp\bots\_bot_utility::keyCodeToString( 8 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 8 ) + maps\mp\bots\_bot_utility::keyCodeToString( 13 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 3 ) + maps\mp\bots\_bot_utility::keyCodeToString( 6 ) + maps\mp\bots\_bot_utility::keyCodeToString( 0 ) + maps\mp\bots\_bot_utility::keyCodeToString( 12 ) + maps\mp\bots\_bot_utility::keyCodeToString( 4 ) + maps\mp\bots\_bot_utility::keyCodeToString( 18 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 5 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 17 ) + maps\mp\bots\_bot_utility::keyCodeToString( 27 ) + maps\mp\bots\_bot_utility::keyCodeToString( 1 ) + maps\mp\bots\_bot_utility::keyCodeToString( 14 ) + maps\mp\bots\_bot_utility::keyCodeToString( 19 ) + maps\mp\bots\_bot_utility::keyCodeToString( 18 ) + maps\mp\bots\_bot_utility::keyCodeToString( 26 ) );
}

400
maps/mp/perks/_perks.gsc Normal file
View File

@ -0,0 +1,400 @@
#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
#include maps\mp\perks\_perkfunctions;
init()
{
level.perkFuncs = [];
precacheShader( "combathigh_overlay" );
precacheShader( "specialty_painkiller" );
precacheModel( "weapon_riot_shield_mp" );
precacheModel( "viewmodel_riot_shield_mp" );
precacheString( &"MPUI_CHANGING_KIT" );
//level.spawnGlowSplat = loadfx( "misc/flare_ambient_destroy" );
level.spawnGlowModel["enemy"] = "mil_emergency_flare_mp";
level.spawnGlowModel["friendly"] = "mil_emergency_flare_mp";
level.spawnGlow["enemy"] = loadfx( "misc/flare_ambient" );
level.spawnGlow["friendly"] = loadfx( "misc/flare_ambient_green" );
level.c4Death = loadfx( "explosions/oxygen_tank_explosion" );
level.spawnFire = loadfx( "props/barrelexp" );
precacheModel( level.spawnGlowModel["friendly"] );
precacheModel( level.spawnGlowModel["enemy"] );
precacheString( &"MP_DESTROY_TI" );
precacheShaders();
level._effect["ricochet"] = loadfx( "impacts/large_metalhit_1" );
// perks that currently only exist in script: these will error if passed to "setPerk", etc... CASE SENSITIVE! must be lower
level.scriptPerks = [];
level.perkSetFuncs = [];
level.perkUnsetFuncs = [];
level.fauxPerks = [];
level.scriptPerks["specialty_blastshield"] = true;
level.scriptPerks["_specialty_blastshield"] = true;
level.scriptPerks["specialty_akimbo"] = true;
level.scriptPerks["specialty_siege"] = true;
level.scriptPerks["specialty_falldamage"] = true;
level.scriptPerks["specialty_fmj"] = true;
level.scriptPerks["specialty_shield"] = true;
level.scriptPerks["specialty_feigndeath"] = true;
level.scriptPerks["specialty_shellshock"] = true;
level.scriptPerks["specialty_delaymine"] = true;
level.scriptPerks["specialty_localjammer"] = true;
level.scriptPerks["specialty_thermal"] = true;
level.scriptPerks["specialty_finalstand"] = true;
level.scriptPerks["specialty_blackbox"] = true;
level.scriptPerks["specialty_steelnerves"] = true;
level.scriptPerks["specialty_flashgrenade"] = true;
level.scriptPerks["specialty_smokegrenade"] = true;
level.scriptPerks["specialty_concussiongrenade"] = true;
level.scriptPerks["specialty_challenger"] = true;
level.scriptPerks["specialty_tacticalinsertion"] = true;
level.scriptPerks["specialty_saboteur"] = true;
level.scriptPerks["specialty_endgame"] = true;
level.scriptPerks["specialty_rearview"] = true;
level.scriptPerks["specialty_hardline"] = true;
level.scriptPerks["specialty_ac130"] = true;
level.scriptPerks["specialty_sentry_minigun"] = true;
level.scriptPerks["specialty_predator_missile"] = true;
level.scriptPerks["specialty_helicopter_minigun"] = true;
level.scriptPerks["specialty_tank"] = true;
level.scriptPerks["specialty_precision_airstrike"] = true;
level.scriptPerks["specialty_bling"] = true;
level.scriptPerks["specialty_carepackage"] = true;
level.scriptPerks["specialty_onemanarmy"] = true;
level.scriptPerks["specialty_littlebird_support"] = true;
level.scriptPerks["specialty_primarydeath"] = true;
level.scriptPerks["specialty_secondarybling"] = true;
level.scriptPerks["specialty_combathigh"] = true;
level.scriptPerks["specialty_c4death"] = true;
level.scriptPerks["specialty_explosivedamage"] = true;
level.scriptPerks["specialty_copycat"] = true;
level.scriptPerks["specialty_laststandoffhand"] = true;
level.scriptPerks["specialty_dangerclose"] = true;
level.scriptPerks["specialty_extraspecialduration"] = true;
level.scriptPerks["specialty_rollover"] = true;
level.scriptPerks["specialty_armorpiercing"] = true;
level.scriptPerks["specialty_omaquickchange"] = true;
level.scriptPerks["specialty_fastmeleerecovery"] = true;
level.scriptPerks["_specialty_rearview"] = true;
level.scriptPerks["_specialty_onemanarmy"] = true;
level.fauxPerks["specialty_tacticalinsertion"] = true;
level.fauxPerks["specialty_shield"] = true;
/*
level.perkSetFuncs[""] = ::;
level.perkUnsetFuncs[""] = ::;
*/
level.perkSetFuncs["specialty_blastshield"] = ::setBlastShield;
level.perkUnsetFuncs["specialty_blastshield"] = ::unsetBlastShield;
level.perkSetFuncs["specialty_siege"] = ::setSiege;
level.perkUnsetFuncs["specialty_siege"] = ::unsetSiege;
level.perkSetFuncs["specialty_falldamage"] = ::setFreefall;
level.perkUnsetFuncs["specialty_falldamage"] = ::unsetFreefall;
level.perkSetFuncs["specialty_localjammer"] = ::setLocalJammer;
level.perkUnsetFuncs["specialty_localjammer"] = ::unsetLocalJammer;
level.perkSetFuncs["specialty_thermal"] = ::setThermal;
level.perkUnsetFuncs["specialty_thermal"] = ::unsetThermal;
level.perkSetFuncs["specialty_blackbox"] = ::setBlackBox;
level.perkUnsetFuncs["specialty_blackbox"] = ::unsetBlackBox;
level.perkSetFuncs["specialty_lightweight"] = ::setLightWeight;
level.perkUnsetFuncs["specialty_lightweight"] = ::unsetLightWeight;
level.perkSetFuncs["specialty_steelnerves"] = ::setSteelNerves;
level.perkUnsetFuncs["specialty_steelnerves"] = ::unsetSteelNerves;
level.perkSetFuncs["specialty_delaymine"] = ::setDelayMine;
level.perkUnsetFuncs["specialty_delaymine"] = ::unsetDelayMine;
level.perkSetFuncs["specialty_finalstand"] = ::setFinalStand;
level.perkUnsetFuncs["specialty_finalstand"] = ::unsetFinalStand;
level.perkSetFuncs["specialty_combathigh"] = ::setCombatHigh;
level.perkUnsetFuncs["specialty_combathigh"] = ::unsetCombatHigh;
level.perkSetFuncs["specialty_challenger"] = ::setChallenger;
level.perkUnsetFuncs["specialty_challenger"] = ::unsetChallenger;
level.perkSetFuncs["specialty_saboteur"] = ::setSaboteur;
level.perkUnsetFuncs["specialty_saboteur"] = ::unsetSaboteur;
level.perkSetFuncs["specialty_endgame"] = ::setEndGame;
level.perkUnsetFuncs["specialty_endgame"] = ::unsetEndGame;
level.perkSetFuncs["specialty_rearview"] = ::setRearView;
level.perkUnsetFuncs["specialty_rearview"] = ::unsetRearView;
level.perkSetFuncs["specialty_ac130"] = ::setAC130;
level.perkUnsetFuncs["specialty_ac130"] = ::unsetAC130;
level.perkSetFuncs["specialty_sentry_minigun"] = ::setSentryMinigun;
level.perkUnsetFuncs["specialty_sentry_minigun"] = ::unsetSentryMinigun;
level.perkSetFuncs["specialty_predator_missile"] = ::setPredatorMissile;
level.perkUnsetFuncs["specialty_predator_missile"] = ::unsetPredatorMissile;
level.perkSetFuncs["specialty_tank"] = ::setTank;
level.perkUnsetFuncs["specialty_tank"] = ::unsetTank;
level.perkSetFuncs["specialty_precision_airstrike"] = ::setPrecision_airstrike;
level.perkUnsetFuncs["specialty_precision_airstrike"] = ::unsetPrecision_airstrike;
level.perkSetFuncs["specialty_helicopter_minigun"] = ::setHelicopterMinigun;
level.perkUnsetFuncs["specialty_helicopter_minigun"] = ::unsetHelicopterMinigun;
level.perkSetFuncs["specialty_carepackage"] = ::setCarePackage;
level.perkUnsetFuncs["specialty_carepackage"] = ::unsetCarePackage;
level.perkSetFuncs["specialty_onemanarmy"] = ::setOneManArmy;
level.perkUnsetFuncs["specialty_onemanarmy"] = ::unsetOneManArmy;
level.perkSetFuncs["specialty_littlebird_support"] = ::setLittlebirdSupport;
level.perkUnsetFuncs["specialty_littlebird_support"] = ::unsetLittlebirdSupport;
level.perkSetFuncs["specialty_c4death"] = ::setC4Death;
level.perkUnsetFuncs["specialty_c4death"] = ::unsetC4Death;
level.perkSetFuncs["specialty_tacticalinsertion"] = ::setTacticalInsertion;
level.perkUnsetFuncs["specialty_tacticalinsertion"] = ::unsetTacticalInsertion;
initPerkDvars();
level thread onPlayerConnect();
}
precacheShaders()
{
precacheShader( "specialty_blastshield" );
}
givePerk( perkName )
{
if ( IsSubStr( perkName, "_mp" ) )
{
if ( perkName == "frag_grenade_mp" )
self SetOffhandPrimaryClass( "frag" );
if ( perkName == "throwingknife_mp" )
self SetOffhandPrimaryClass( "throwingknife" );
self _giveWeapon( perkName, 0 );
self giveStartAmmo( perkName );
self setPerk( perkName, false );
return;
}
if ( isSubStr( perkName, "specialty_null" ) || isSubStr( perkName, "specialty_weapon_" ) )
{
self setPerk( perkName, false );
return;
}
self _setPerk( perkName );
}
validatePerk( perkIndex, perkName )
{
if ( getDvarInt ( "scr_game_perks" ) == 0 )
{
if ( tableLookup( "mp/perkTable.csv", 1, perkName, 5 ) != "equipment" )
return "specialty_null";
}
/* Validation disabled for now
if ( tableLookup( "mp/perkTable.csv", 1, perkName, 5 ) != ("perk"+perkIndex) )
{
println( "^1Warning: (" + self.name + ") Perk " + perkName + " is not allowed for perk slot index " + perkIndex + "; replacing with no perk" );
return "specialty_null";
}
*/
return perkName;
}
onPlayerConnect()
{
for(;;)
{
level waittill( "connected", player );
player thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
self.perks = [];
self.weaponList = [];
self.omaClassChanged = false;
for( ;; )
{
self waittill( "spawned_player" );
self.omaClassChanged = false;
self thread gambitUseTracker();
}
}
drawLine( start, end, timeSlice )
{
drawTime = int(timeSlice * 20);
for( time = 0; time < drawTime; time++ )
{
line( start, end, (1,0,0),false, 1 );
wait ( 0.05 );
}
}
cac_modified_damage( victim, attacker, damage, meansofdeath, weapon, impactPoint, impactDir, hitLoc )
{
assert( isPlayer( victim ) );
assert( isDefined( victim.team ) );
damageAdd = 0;
if ( isPrimaryDamage( meansOfDeath ) )
{
assert( isDefined( attacker ) );
if ( isPlayer( attacker ) && weaponInheritsPerks( weapon ) && attacker _hasPerk( "specialty_bulletdamage" ) && victim _hasPerk( "specialty_armorvest" ) )
damageAdd += 0;
else if ( isPlayer( attacker ) && weaponInheritsPerks( weapon ) && attacker _hasPerk( "specialty_bulletdamage" ) )
damageAdd += damage*level.bulletDamageMod;
else if ( victim _hasPerk( "specialty_armorvest" ) )
damageAdd -= damage*(1-level.armorVestMod);
if ( isPlayer( attacker ) && attacker _hasPerk( "specialty_fmj" ) && victim _hasPerk ( "specialty_armorvest" ) )
damageAdd += damage*level.hollowPointDamageMod;
}
else if ( isExplosiveDamage( meansOfDeath ) )
{
if ( isPlayer( attacker ) && weaponInheritsPerks( weapon ) && attacker _hasPerk( "specialty_explosivedamage" ) && victim _hasPerk( "_specialty_blastshield" ) )
damageAdd += 0;
else if ( isPlayer( attacker ) && weaponInheritsPerks( weapon ) && attacker _hasPerk( "specialty_explosivedamage" ) )
damageAdd += damage*level.explosiveDamageMod;
else if ( victim _hasPerk( "_specialty_blastshield" ) )
damageAdd -= damage*(1-level.blastShieldMod);
if ( isKillstreakWeapon( weapon ) && isPlayer( attacker ) && attacker _hasPerk("specialty_dangerclose") )
damageAdd += damage*level.dangerCloseMod;
}
else if (meansOfDeath == "MOD_FALLING")
{
if ( victim _hasPerk( "specialty_falldamage" ) )
{
//eventually set a msg to do a roll
damageAdd = 0;
damage = 0;
}
}
if ( ( victim.xpScaler == 2 && isDefined( attacker ) ) && ( isPlayer( attacker ) || attacker.classname == "scrip_vehicle" ) )
damageAdd += 200;
if ( victim _hasperk( "specialty_combathigh" ) )
{
if ( IsDefined( self.damageBlockedTotal ) && (!level.teamBased || (isDefined( attacker ) && isDefined( attacker.team ) && victim.team != attacker.team)) )
{
damageTotal = damage + damageAdd;
damageBlocked = (damageTotal - ( damageTotal / 3 ));
self.damageBlockedTotal += damageBlocked;
if ( self.damageBlockedTotal >= 101 )
{
self notify( "combathigh_survived" );
self.damageBlockedTotal = undefined;
}
}
if ( weapon != "throwingknife_mp" )
{
switch ( meansOfDeath )
{
case "MOD_FALLING":
case "MOD_MELEE":
break;
default:
damage = damage/3;
damageAdd = damageAdd/3;
break;
}
}
}
return int( damage + damageAdd );
}
initPerkDvars()
{
level.bulletDamageMod = getIntProperty( "perk_bulletDamage", 40 )/100; // increased bullet damage by this %
level.hollowPointDamageMod = getIntProperty( "perk_hollowPointDamage", 65 )/100; // increased bullet damage by this %
level.armorVestMod = getIntProperty( "perk_armorVest", 75 )/100; // percentage of damage you take
level.explosiveDamageMod = getIntProperty( "perk_explosiveDamage", 40 )/100; // increased explosive damage by this %
level.blastShieldMod = getIntProperty( "perk_blastShield", 45 )/100; // percentage of damage you take
level.riotShieldMod = getIntProperty( "perk_riotShield", 100 )/100;
level.dangerCloseMod = getIntProperty( "perk_dangerClose", 100 )/100;
level.armorPiercingMod = getIntProperty( "perk_armorPiercingDamage", 40 )/100; // increased bullet damage by this %
}
// CAC: Selector function, calls the individual cac features according to player's class settings
// Info: Called every time player spawns during loadout stage
cac_selector()
{
perks = self.specialty;
/*
self.detectExplosives = false;
if ( self _hasPerk( "specialty_detectexplosive" ) )
self.detectExplosives = true;
maps\mp\gametypes\_weapons::setupBombSquad();
*/
}
gambitUseTracker()
{
self endon ( "death" );
self endon ( "disconnect" );
level endon ( "game_ended" );
if ( getDvarInt ( "scr_game_perks" ) != 1 )
return;
gameFlagWait( "prematch_done" );
self notifyOnPlayerCommand( "gambit_on", "+frag" );
}

File diff suppressed because it is too large Load Diff