mirror of
https://github.com/ineedbots/t4_bot_warfare.git
synced 2025-12-30 16:41:50 +00:00
Compare commits
15 Commits
746e10633a
...
v2.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64639616f9 | ||
|
|
b8597ee810 | ||
|
|
3e08ac900d | ||
|
|
3de51aa71b | ||
|
|
5d43e00d8d | ||
|
|
0ab94bfea7 | ||
|
|
8038a30557 | ||
|
|
9bbf46a7fe | ||
|
|
e781a8d05e | ||
|
|
6c935c2bbd | ||
|
|
1477323917 | ||
|
|
9e19374125 | ||
|
|
7766d8b888 | ||
|
|
c5b7dd0c19 | ||
|
|
f0eeda9b50 |
21
README.md
21
README.md
@@ -80,22 +80,23 @@ Make sure to disable this DVAR by adding ```set bots_main_firstIsHost 0``` in yo
|
|||||||
|----------------------------------|---------------------------------------------------------------------------------------------|--------------:|
|
|----------------------------------|---------------------------------------------------------------------------------------------|--------------:|
|
||||||
| bots_main | Enable this mod. | 1 |
|
| bots_main | Enable this mod. | 1 |
|
||||||
| bots_main_firstIsHost | The first player to connect will be given host. | 1 |
|
| bots_main_firstIsHost | The first player to connect will be given host. | 1 |
|
||||||
| bots_main_GUIDs | A comma separated list of GUIDs of players who will be given host. | "" |
|
| bots_main_GUIDs | A comma separated list of GUIDs of players who will be given host. | |
|
||||||
| bots_main_waitForHostTime | How many seconds to wait for the host player to connect before adding bots to the match. | 10 |
|
| bots_main_waitForHostTime | How many seconds to wait for the host player to connect before adding bots to the match. | 10 |
|
||||||
| bots_main_menu | Enable the in-game menu for hosts. | 1 |
|
| bots_main_menu | Enable the in-game menu for hosts. | 1 |
|
||||||
| bots_main_debug | Enable the in-game waypoint editor. | 0 |
|
| bots_main_debug | Enable the in-game waypoint editor at start of the game, or enable bot event prints. <ul><li>`0` - disable</li><li>`1` - for just debug events</li><li>`2` - for every event</li><ul> | 0 |
|
||||||
| bots_main_kickBotsAtEnd | Kick the bots at the end of a match. | 0 |
|
| bots_main_kickBotsAtEnd | Kick the bots at the end of a match. | 0 |
|
||||||
| bots_main_chat | The rate bots will chat at, set to 0 to disable. | 1.0 |
|
| bots_main_chat | The rate bots will chat at, set to 0 to disable. | 1.0 |
|
||||||
| bots_manage_add | Amount of bots to add to the game, once bots are added, resets back to `0`. | 0 |
|
| bots_manage_add | Amount of bots to add to the game, once bots are added, resets back to `0`. | 0 |
|
||||||
| bots_manage_fill | Amount of players/bots (look at `bots_manage_fill_mode`) to maintain in the match. | 0 |
|
| bots_manage_fill | Amount of players/bots (look at `bots_manage_fill_mode`) to maintain in the match. | 0 |
|
||||||
| bots_manage_fill_mode | `bots_manage_fill` players/bots counting method.<ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots.</li></ul> | 0 |
|
| bots_manage_fill_mode | `bots_manage_fill` players/bots counting method.<ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots.</li><li>`2` - exactly `0` but auto adjusts `bots_manage_fill` to map.</li><li>`3` - exactly `1` but auto adjusts `bots_manage_fill` to map.</li><li>`4` - bots are used for balancing teams.</li><li>`5` - exactly `4` but auto adjusts `bots_manage_fill` to map.</li></ul> | 0 |
|
||||||
| bots_manage_fill_kick | If the amount of players/bots in the match exceeds `bots_manage_fill`, kick bots until no longer exceeds. | 0 |
|
| bots_manage_fill_watchplayers | Bots will not be added until one player is in the game | 0 |
|
||||||
|
| bots_manage_fill_kick | If the amount of players/bots in the match exceeds `bots_manage_fill`, kick bots until no longer exceeds. | 0 |
|
||||||
| bots_manage_fill_spec | If when counting players for `bots_manage_fill` should include spectators. | 1 |
|
| bots_manage_fill_spec | If when counting players for `bots_manage_fill` should include spectators. | 1 |
|
||||||
| bots_team | One of `autoassign`, `allies`, `axis`, `spectator`, or `custom`. What team the bots should be on. | autoassign |
|
| bots_team | One of `autoassign`, `allies`, `axis`, `spectator`, or `custom`. What team the bots should be on. | autoassign |
|
||||||
| bots_team_amount | When `bots_team` is set to `custom`. The amount of bots to be placed on the axis team. The remainder will be placed on the allies team. | 0 |
|
| bots_team_amount | When `bots_team` is set to `custom`. The amount of bots to be placed on the axis team. The remainder will be placed on the allies team. | 0 |
|
||||||
| bots_team_force | If the server should force bots' teams according to the `bots_team` value. When `bots_team` is `autoassign`, unbalanced teams will be balanced. This dvar is ignored when `bots_team` is `custom`. | 0 |
|
| bots_team_force | If the server should force bots' teams according to the `bots_team` value. When `bots_team` is `autoassign`, unbalanced teams will be balanced. This dvar is ignored when `bots_team` is `custom`. | 0 |
|
||||||
| bots_team_mode | When `bots_team_force` is `1` and `bots_team` is `autoassign`, players/bots counting method. <ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots</li></ul> | 0 |
|
| bots_team_mode | When `bots_team_force` is `1` and `bots_team` is `autoassign`, players/bots counting method. <ul><li>`0` - counts both players and bots.</li><li>`1` - only counts bots</li></ul> | 0 |
|
||||||
| bots_skill | Bots' difficulty.<ul><li>`0` - Random difficulty for each bot.</li><li>`1` - Easiest difficulty for all bots.</li><li>`2` to `6` - Between easy and hard difficulty for all bots.</li><li>`7` - The hardest difficulty for all bots.</li><li>`8` - custom (look at the `bots_skill_<team>_<difficulty>` dvars</li></ul> | 0 |
|
| bots_skill | Bots' difficulty.<ul><li>`0` - Random difficulty for each bot.</li><li>`1` - Easiest difficulty for all bots.</li><li>`2` to `6` - Between easy and hard difficulty for all bots.</li><li>`7` - The hardest difficulty for all bots.</li><li>`8` - custom (look at the `bots_skill_<team>_<difficulty>` dvars)</li><li>`9` - Every difficulty parameter is randomized</li></ul> | 0 |
|
||||||
| bots_skill_axis_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the axis team. | 0 |
|
| bots_skill_axis_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the axis team. | 0 |
|
||||||
| bots_skill_axis_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the axis team. The remaining bots on the team will be set to easy difficulty. | 0 |
|
| bots_skill_axis_med | When `bots_skill` is set to `8`, the amount of medium difficulty bots to set on the axis team. The remaining bots on the team will be set to easy difficulty. | 0 |
|
||||||
| bots_skill_allies_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the allies team. | 0 |
|
| bots_skill_allies_hard | When `bots_skill` is set to `8`, the amount of hard difficulty bots to set on the allies team. | 0 |
|
||||||
@@ -119,6 +120,14 @@ Make sure to disable this DVAR by adding ```set bots_main_firstIsHost 0``` in yo
|
|||||||
| bots_play_aim | If the bots can aim. | 1 |
|
| bots_play_aim | If the bots can aim. | 1 |
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
- v2.3.0
|
||||||
|
- Smoothed bot aim at range
|
||||||
|
- Fixed bots_manage_fill_spec players being counted with bots_manage_fill_mode 1 (bot only)
|
||||||
|
- Added bots_manage_fill_watchplayers dvar
|
||||||
|
- Bots hop off turrets if they get stuck on one
|
||||||
|
- Fixed script variable leak with opening and closing the in-game menu
|
||||||
|
- Works on latest Plutonium r5106
|
||||||
|
|
||||||
- v2.2.0
|
- v2.2.0
|
||||||
- Bots can now melee lunge
|
- Bots can now melee lunge
|
||||||
- Waypoints only load from csv now
|
- Waypoints only load from csv now
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
init()
|
init()
|
||||||
{
|
{
|
||||||
level.bw_version = "2.2.0";
|
level.bw_version = "2.3.0";
|
||||||
|
|
||||||
if ( getdvar( "bots_main" ) == "" )
|
if ( getdvar( "bots_main" ) == "" )
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ init()
|
|||||||
|
|
||||||
if ( getdvar( "bots_main_firstIsHost" ) == "" )
|
if ( getdvar( "bots_main_firstIsHost" ) == "" )
|
||||||
{
|
{
|
||||||
setdvar( "bots_main_firstIsHost", true ); // first player to connect is a host
|
setdvar( "bots_main_firstIsHost", false ); // first player to connect is a host
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getdvar( "bots_main_waitForHostTime" ) == "" )
|
if ( getdvar( "bots_main_waitForHostTime" ) == "" )
|
||||||
@@ -74,6 +74,11 @@ init()
|
|||||||
setdvar( "bots_manage_fill_kick", false ); // kick bots if too many
|
setdvar( "bots_manage_fill_kick", false ); // kick bots if too many
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( getdvar( "bots_manage_fill_watchplayers" ) == "" )
|
||||||
|
{
|
||||||
|
setdvar( "bots_manage_fill_watchplayers", false ); // add bots when player exists, kick if not
|
||||||
|
}
|
||||||
|
|
||||||
if ( getdvar( "bots_team" ) == "" )
|
if ( getdvar( "bots_team" ) == "" )
|
||||||
{
|
{
|
||||||
setdvar( "bots_team", "autoassign" ); // which team for bots to join
|
setdvar( "bots_team", "autoassign" ); // which team for bots to join
|
||||||
@@ -264,6 +269,8 @@ init()
|
|||||||
level thread onPlayerConnect();
|
level thread onPlayerConnect();
|
||||||
level thread handleBots();
|
level thread handleBots();
|
||||||
level thread onPlayerChat();
|
level thread onPlayerChat();
|
||||||
|
|
||||||
|
array_thread( getentarray( "misc_turret", "classname" ), ::turret_monitoruse_watcher );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -449,7 +456,7 @@ fixPerksAndScriptKick()
|
|||||||
onDisconnectPlayer()
|
onDisconnectPlayer()
|
||||||
{
|
{
|
||||||
name = self.name;
|
name = self.name;
|
||||||
|
|
||||||
self waittill( "disconnect" );
|
self waittill( "disconnect" );
|
||||||
waittillframeend;
|
waittillframeend;
|
||||||
|
|
||||||
@@ -514,10 +521,10 @@ connected()
|
|||||||
|
|
||||||
level.bots[ level.bots.size ] = self;
|
level.bots[ level.bots.size ] = self;
|
||||||
self thread onDisconnect();
|
self thread onDisconnect();
|
||||||
|
|
||||||
level notify( "bot_connected", self );
|
|
||||||
|
|
||||||
self thread watchBotDebugEvent();
|
self thread watchBotDebugEvent();
|
||||||
|
|
||||||
|
waittillframeend; // wait for waittills to process
|
||||||
|
level notify( "bot_connected", self );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -918,7 +925,7 @@ addBots_loop()
|
|||||||
|
|
||||||
fillMode = getdvarint( "bots_manage_fill_mode" );
|
fillMode = getdvarint( "bots_manage_fill_mode" );
|
||||||
|
|
||||||
if ( fillMode == 2 || fillMode == 3 )
|
if ( fillMode == 2 || fillMode == 3 || fillMode == 5 )
|
||||||
{
|
{
|
||||||
setdvar( "bots_manage_fill", getGoodMapAmount() );
|
setdvar( "bots_manage_fill", getGoodMapAmount() );
|
||||||
}
|
}
|
||||||
@@ -928,6 +935,8 @@ addBots_loop()
|
|||||||
players = 0;
|
players = 0;
|
||||||
bots = 0;
|
bots = 0;
|
||||||
spec = 0;
|
spec = 0;
|
||||||
|
axisplayers = 0;
|
||||||
|
alliesplayers = 0;
|
||||||
|
|
||||||
playercount = level.players.size;
|
playercount = level.players.size;
|
||||||
|
|
||||||
@@ -946,37 +955,6 @@ addBots_loop()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
players++;
|
players++;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !randomint( 999 ) )
|
|
||||||
{
|
|
||||||
setdvar( "testclients_doreload", true );
|
|
||||||
wait 0.1;
|
|
||||||
setdvar( "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" )
|
if ( player.pers[ "team" ] == "axis" )
|
||||||
{
|
{
|
||||||
@@ -987,26 +965,19 @@ addBots_loop()
|
|||||||
alliesplayers++;
|
alliesplayers++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
result = fillAmount - abs( axisplayers - alliesplayers ) + bots;
|
|
||||||
|
if ( getdvarint( "bots_manage_fill_spec" ) )
|
||||||
if ( players == 0 )
|
{
|
||||||
{
|
players += spec;
|
||||||
if ( bots < fillAmount )
|
}
|
||||||
{
|
|
||||||
result = fillAmount - 1;
|
if ( !randomint( 999 ) )
|
||||||
}
|
{
|
||||||
else if ( bots > fillAmount )
|
setdvar( "testclients_doreload", true );
|
||||||
{
|
wait 0.1;
|
||||||
result = fillAmount + 1;
|
setdvar( "testclients_doreload", false );
|
||||||
}
|
doExtraCheck();
|
||||||
else
|
|
||||||
{
|
|
||||||
result = fillAmount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bots = result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
amount = bots;
|
amount = bots;
|
||||||
@@ -1016,22 +987,46 @@ addBots_loop()
|
|||||||
amount += players;
|
amount += players;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getdvarint( "bots_manage_fill_spec" ) )
|
// use bots as balance
|
||||||
|
if ( fillMode == 4 || fillMode == 5 )
|
||||||
{
|
{
|
||||||
amount += spec;
|
diffPlayers = abs( alliesplayers - axisplayers );
|
||||||
|
amount = fillAmount - ( diffPlayers - bots );
|
||||||
|
|
||||||
|
if ( players + diffPlayers < fillAmount )
|
||||||
|
{
|
||||||
|
amount = players + bots;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( players <= 0 && getdvarint( "bots_manage_fill_watchplayers" ) )
|
||||||
|
{
|
||||||
|
amount = fillAmount + bots;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( amount < fillAmount )
|
if ( amount < fillAmount )
|
||||||
{
|
{
|
||||||
setdvar( "bots_manage_add", 1 );
|
setdvar( "bots_manage_add", fillAmount - amount );
|
||||||
}
|
}
|
||||||
else if ( amount > fillAmount && getdvarint( "bots_manage_fill_kick" ) )
|
else if ( amount > fillAmount && getdvarint( "bots_manage_fill_kick" ) )
|
||||||
{
|
{
|
||||||
tempBot = getBotToKick();
|
botsToKick = amount - fillAmount;
|
||||||
|
|
||||||
if ( isdefined( tempBot ) )
|
if ( botsToKick > 64 )
|
||||||
{
|
{
|
||||||
kick( tempBot getentitynumber() );
|
botsToKick = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i = 0; i < botsToKick; i++ )
|
||||||
|
{
|
||||||
|
tempBot = getBotToKick();
|
||||||
|
|
||||||
|
if ( isdefined( tempBot ) )
|
||||||
|
{
|
||||||
|
kick( tempBot getentitynumber(), "EXE_PLAYERKICKED" );
|
||||||
|
|
||||||
|
wait 0.25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1248,3 +1243,47 @@ onPlayerChat()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Monitors turret usage
|
||||||
|
*/
|
||||||
|
turret_monitoruse_watcher()
|
||||||
|
{
|
||||||
|
self endon( "death" );
|
||||||
|
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
|
self waittill ( "trigger", player );
|
||||||
|
|
||||||
|
self monitor_player_turret( player );
|
||||||
|
|
||||||
|
self.owner = undefined;
|
||||||
|
|
||||||
|
if ( isdefined( player ) )
|
||||||
|
{
|
||||||
|
player.turret = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
While player uses turret
|
||||||
|
*/
|
||||||
|
monitor_player_turret( player )
|
||||||
|
{
|
||||||
|
player endon( "death" );
|
||||||
|
player endon( "disconnect" );
|
||||||
|
|
||||||
|
player.turret = self;
|
||||||
|
self.owner = player;
|
||||||
|
|
||||||
|
while ( isdefined( player ) && player usebuttonpressed() )
|
||||||
|
{
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( isdefined( player ) && !player usebuttonpressed() )
|
||||||
|
{
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -369,6 +369,20 @@ watchPickupGun()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo have bots use turrets instead of just kicking them off of it
|
||||||
|
if ( isdefined( self.turret ) )
|
||||||
|
{
|
||||||
|
self thread use( 0.5 );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// todo have bots use vehicles properly
|
||||||
|
if ( self isinvehicle() )
|
||||||
|
{
|
||||||
|
self thread use( 0.5 );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
weap = self getcurrentweapon();
|
weap = self getcurrentweapon();
|
||||||
|
|
||||||
if ( weap != "none" && self getammocount( weap ) )
|
if ( weap != "none" && self getammocount( weap ) )
|
||||||
@@ -1622,7 +1636,7 @@ aim_loop()
|
|||||||
{
|
{
|
||||||
self thread bot_lookat( target gettagorigin( "j_spine4" ), 0.05 );
|
self thread bot_lookat( target gettagorigin( "j_spine4" ), 0.05 );
|
||||||
}
|
}
|
||||||
else if ( !nadeAimOffset && conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 )
|
else if ( !nadeAimOffset && conedot > 0.999995 && lengthsquared( aimoffset ) < 0.05 )
|
||||||
{
|
{
|
||||||
self thread bot_lookat( aimpos, 0.05 );
|
self thread bot_lookat( aimpos, 0.05 );
|
||||||
}
|
}
|
||||||
@@ -1646,7 +1660,7 @@ aim_loop()
|
|||||||
|
|
||||||
conedot = getConeDot( aimpos, eyePos, angles );
|
conedot = getConeDot( aimpos, eyePos, angles );
|
||||||
|
|
||||||
if ( ( isdefined( self.bot.knifing_target ) && self.bot.knifing_target == target ) || ( !nadeAimOffset && conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 ) )
|
if ( ( isdefined( self.bot.knifing_target ) && self.bot.knifing_target == target ) || ( !nadeAimOffset && conedot > 0.999995 && lengthsquared( aimoffset ) < 0.05 ) )
|
||||||
{
|
{
|
||||||
self thread bot_lookat( aimpos, 0.05 );
|
self thread bot_lookat( aimpos, 0.05 );
|
||||||
}
|
}
|
||||||
@@ -1664,7 +1678,7 @@ aim_loop()
|
|||||||
|
|
||||||
conedot = getConeDot( aimpos, eyePos, angles );
|
conedot = getConeDot( aimpos, eyePos, angles );
|
||||||
|
|
||||||
if ( !nadeAimOffset && conedot > 0.999 && lengthsquared( aimoffset ) < 0.05 )
|
if ( !nadeAimOffset && conedot > 0.999995 && lengthsquared( aimoffset ) < 0.05 )
|
||||||
{
|
{
|
||||||
self thread bot_lookat( aimpos, 0.05 );
|
self thread bot_lookat( aimpos, 0.05 );
|
||||||
}
|
}
|
||||||
@@ -2708,11 +2722,11 @@ fire( what )
|
|||||||
|
|
||||||
if ( what )
|
if ( what )
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "+fire" );
|
self BotBuiltinBotAction( "+attack" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "-fire" );
|
self BotBuiltinBotAction( "-attack" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2731,14 +2745,14 @@ pressFire( time )
|
|||||||
time = 0.05;
|
time = 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "+fire" );
|
self BotBuiltinBotAction( "+attack" );
|
||||||
|
|
||||||
if ( time )
|
if ( time )
|
||||||
{
|
{
|
||||||
wait time;
|
wait time;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "-fire" );
|
self BotBuiltinBotAction( "-attack" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2750,11 +2764,11 @@ ads( what )
|
|||||||
|
|
||||||
if ( what )
|
if ( what )
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "+ads" );
|
self BotBuiltinBotAction( "+speed_throw" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "-ads" );
|
self BotBuiltinBotAction( "-speed_throw" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2773,14 +2787,14 @@ pressADS( time )
|
|||||||
time = 0.05;
|
time = 0.05;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "+ads" );
|
self BotBuiltinBotAction( "+speed_throw" );
|
||||||
|
|
||||||
if ( time )
|
if ( time )
|
||||||
{
|
{
|
||||||
wait time;
|
wait time;
|
||||||
}
|
}
|
||||||
|
|
||||||
self BotBuiltinBotAction( "-ads" );
|
self BotBuiltinBotAction( "-speed_throw" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2834,8 +2848,8 @@ jump()
|
|||||||
*/
|
*/
|
||||||
stand()
|
stand()
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "-gocrouch" );
|
self BotBuiltinBotAction( "-crouch" );
|
||||||
self BotBuiltinBotAction( "-goprone" );
|
self BotBuiltinBotAction( "-prone" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2843,8 +2857,8 @@ stand()
|
|||||||
*/
|
*/
|
||||||
crouch()
|
crouch()
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "+gocrouch" );
|
self BotBuiltinBotAction( "+crouch" );
|
||||||
self BotBuiltinBotAction( "-goprone" );
|
self BotBuiltinBotAction( "-prone" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2852,8 +2866,8 @@ crouch()
|
|||||||
*/
|
*/
|
||||||
prone()
|
prone()
|
||||||
{
|
{
|
||||||
self BotBuiltinBotAction( "-gocrouch" );
|
self BotBuiltinBotAction( "-crouch" );
|
||||||
self BotBuiltinBotAction( "+goprone" );
|
self BotBuiltinBotAction( "+prone" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2940,7 +2954,7 @@ bot_lookat( pos, time, vel, doAimPredict )
|
|||||||
for ( i = 0; i < steps; i++ )
|
for ( i = 0; i < steps; i++ )
|
||||||
{
|
{
|
||||||
myAngle = ( angleclamp180( myAngle[ 0 ] + X ), angleclamp180( myAngle[ 1 ] + Y ), 0 );
|
myAngle = ( angleclamp180( myAngle[ 0 ] + X ), angleclamp180( myAngle[ 1 ] + Y ), 0 );
|
||||||
self setplayerangles( myAngle );
|
self BotBuiltinBotAngles( myAngle );
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1729,7 +1729,7 @@ bot_think_camp_loop()
|
|||||||
|
|
||||||
self SetScriptGoal( campSpot.origin, 16 );
|
self SetScriptGoal( campSpot.origin, 16 );
|
||||||
|
|
||||||
time = randomintrange( 10, 20 );
|
time = randomintrange( 30, 90 );
|
||||||
|
|
||||||
self BotNotifyBotEvent( "camp", "go", campSpot, time );
|
self BotNotifyBotEvent( "camp", "go", campSpot, time );
|
||||||
|
|
||||||
@@ -1788,7 +1788,17 @@ killCampAfterTime( time )
|
|||||||
self endon( "disconnect" );
|
self endon( "disconnect" );
|
||||||
self endon( "kill_camp_bot" );
|
self endon( "kill_camp_bot" );
|
||||||
|
|
||||||
wait time + 0.05;
|
timeleft = maps\mp\gametypes\_globallogic::gettimeremaining() / 1000;
|
||||||
|
|
||||||
|
while ( time > 0 && timeleft >= 60 )
|
||||||
|
{
|
||||||
|
wait 1;
|
||||||
|
timeleft = maps\mp\gametypes\_globallogic::gettimeremaining() / 1000;
|
||||||
|
time--;
|
||||||
|
}
|
||||||
|
|
||||||
|
wait 0.05;
|
||||||
|
|
||||||
self ClearScriptGoal();
|
self ClearScriptGoal();
|
||||||
self ClearScriptAimPos();
|
self ClearScriptAimPos();
|
||||||
|
|
||||||
@@ -3010,6 +3020,12 @@ bot_killstreak_think_loop()
|
|||||||
{
|
{
|
||||||
curWeap = self getcurrentweapon();
|
curWeap = self getcurrentweapon();
|
||||||
|
|
||||||
|
if ( curWeap == "radar_mp" || curWeap == "dogs_mp" || curWeap == "artillery_mp" )
|
||||||
|
{
|
||||||
|
self thread changeToWeapon( self.lastdroppableweapon );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( curWeap == "none" || !isWeaponDroppable( curWeap ) )
|
if ( curWeap == "none" || !isWeaponDroppable( curWeap ) )
|
||||||
{
|
{
|
||||||
curWeap = self.lastdroppableweapon;
|
curWeap = self.lastdroppableweapon;
|
||||||
@@ -3286,6 +3302,7 @@ bot_target_vehicle_loop()
|
|||||||
myEye = self getEyePos();
|
myEye = self getEyePos();
|
||||||
target = undefined;
|
target = undefined;
|
||||||
myAngles = self getplayerangles();
|
myAngles = self getplayerangles();
|
||||||
|
hasRocket = self getammocount( "bazooka_mp" );
|
||||||
|
|
||||||
for ( i = 0; i < level.players.size; i++ )
|
for ( i = 0; i < level.players.size; i++ )
|
||||||
{
|
{
|
||||||
@@ -3318,7 +3335,7 @@ bot_target_vehicle_loop()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getConeDot( vehicle.origin, self.origin, myAngles ) < 0.6 && !hasRecon )
|
if ( getConeDot( vehicle.origin, self.origin, myAngles ) < 0.6 && !hasRecon && !hasRocket )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3350,18 +3367,13 @@ bot_target_vehicle()
|
|||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
wait( randomintrange( 1, 3 ) );
|
wait( randomintrange( 1, 3 ) * 0.5 );
|
||||||
|
|
||||||
if ( self HasScriptEnemy() )
|
if ( self HasScriptEnemy() )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( self.pers[ "bots" ][ "skill" ][ "base" ] <= 1 )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !isdefined( level.vehicles_list ) )
|
if ( !isdefined( level.vehicles_list ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -3378,7 +3390,7 @@ bot_vehicle_attack( target )
|
|||||||
{
|
{
|
||||||
target endon( "death" );
|
target endon( "death" );
|
||||||
|
|
||||||
wait_time = randomintrange( 14, 20 );
|
wait_time = randomintrange( 14, 20 ) * 2;
|
||||||
|
|
||||||
for ( i = 0; i < wait_time; i++ )
|
for ( i = 0; i < wait_time; i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,30 +38,6 @@ BotBuiltinPrintConsole( s )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Writes to the file, mode can be "append" or "write"
|
|
||||||
*/
|
|
||||||
BotBuiltinFileWrite( file, contents, mode )
|
|
||||||
{
|
|
||||||
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "filewrite" ] ) )
|
|
||||||
{
|
|
||||||
[[ level.bot_builtins[ "filewrite" ] ]]( file, contents, mode );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Returns the whole file as a string
|
|
||||||
*/
|
|
||||||
BotBuiltinFileRead( file )
|
|
||||||
{
|
|
||||||
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "fileread" ] ) )
|
|
||||||
{
|
|
||||||
return [[ level.bot_builtins[ "fileread" ] ]]( file );
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Test if a file exists
|
Test if a file exists
|
||||||
*/
|
*/
|
||||||
@@ -135,6 +111,98 @@ BotBuiltinBotMeleeParams( yaw, dist )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sets angles
|
||||||
|
*/
|
||||||
|
BotBuiltinBotAngles( angles )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "botangles" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "botangles" ] ]]( angles );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Opens the file
|
||||||
|
*/
|
||||||
|
BotBuiltinFileOpen( file, mode )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "fs_fopen" ] ) )
|
||||||
|
{
|
||||||
|
return [[ level.bot_builtins[ "fs_fopen" ] ]]( file, mode );
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Closes the file
|
||||||
|
*/
|
||||||
|
BotBuiltinFileClose( fh )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "fs_fclose" ] ) )
|
||||||
|
{
|
||||||
|
[[ level.bot_builtins[ "fs_fclose" ] ]]( fh );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Closes the file
|
||||||
|
*/
|
||||||
|
BotBuiltinReadLine( fh )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "fs_readline" ] ) )
|
||||||
|
{
|
||||||
|
return [[ level.bot_builtins[ "fs_readline" ] ]]( fh );
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Closes the file
|
||||||
|
*/
|
||||||
|
BotBuiltinWriteLine( fh, contents )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "fs_writeline" ] ) )
|
||||||
|
{
|
||||||
|
[[ level.bot_builtins[ "fs_writeline" ] ]]( fh, contents );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinCmdExec( what )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "cmdexec" ] ) )
|
||||||
|
{
|
||||||
|
[[ level.bot_builtins[ "cmdexec" ] ]]( what );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
BotBuiltinNotifyOnPlayerCommand( cmd, notif )
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "notifyonplayercommand" ] ) )
|
||||||
|
{
|
||||||
|
self [[ level.bot_builtins[ "notifyonplayercommand" ] ]]( cmd, notif );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
waw doesnt have
|
||||||
|
*/
|
||||||
|
BotBuiltinIsHost()
|
||||||
|
{
|
||||||
|
if ( isdefined( level.bot_builtins ) && isdefined( level.bot_builtins[ "ishost" ] ) )
|
||||||
|
{
|
||||||
|
return self [[ level.bot_builtins[ "ishost" ] ]]();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns if player is the host
|
Returns if player is the host
|
||||||
*/
|
*/
|
||||||
@@ -187,7 +255,7 @@ doHostCheck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !result )
|
if ( !self BotBuiltinIsHost() && !result )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1425,61 +1493,6 @@ parseTokensIntoWaypoint( tokens )
|
|||||||
return waypoint;
|
return waypoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Function to extract lines from a file specified by 'filename' and store them in a result structure.
|
|
||||||
*/
|
|
||||||
getWaypointLinesFromFile( filename )
|
|
||||||
{
|
|
||||||
// Create a structure to store the result, including an array to hold individual lines.
|
|
||||||
result = spawnstruct();
|
|
||||||
result.lines = [];
|
|
||||||
|
|
||||||
// Read the entire content of the file into the 'waypointStr' variable.
|
|
||||||
// Note: max string length in GSC is 65535.
|
|
||||||
waypointStr = BotBuiltinFileRead( filename );
|
|
||||||
|
|
||||||
// If the file is empty or not defined, return the empty result structure.
|
|
||||||
if ( !isdefined( waypointStr ) )
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables to track the current line's character count and starting position.
|
|
||||||
linecount = 0;
|
|
||||||
linestart = 0;
|
|
||||||
|
|
||||||
// Iterate through each character in the 'waypointStr'.
|
|
||||||
for ( i = 0; i < waypointStr.size; i++ )
|
|
||||||
{
|
|
||||||
// Check for newline characters '\n' or '\r'.
|
|
||||||
if ( waypointStr[ i ] == "\n" || waypointStr[ i ] == "\r" )
|
|
||||||
{
|
|
||||||
// Extract the current line using 'getsubstr' and store it in the result array.
|
|
||||||
result.lines[ result.lines.size ] = getsubstr( waypointStr, linestart, linestart + linecount );
|
|
||||||
|
|
||||||
// If the newline is '\r\n', skip the next character.
|
|
||||||
if ( waypointStr[ i ] == "\r" && i < waypointStr.size - 1 && waypointStr[ i + 1 ] == "\n" )
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset linecount and update linestart for the next line.
|
|
||||||
linecount = 0;
|
|
||||||
linestart = i + 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Increment linecount for the current line.
|
|
||||||
linecount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store the last line (or the only line if there are no newline characters) in the result array.
|
|
||||||
result.lines[ result.lines.size ] = getsubstr( waypointStr, linestart, linestart + linecount );
|
|
||||||
|
|
||||||
// Return the result structure containing the array of extracted lines.
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Read from file a csv, and returns an array of waypoints
|
Read from file a csv, and returns an array of waypoints
|
||||||
*/
|
*/
|
||||||
@@ -1493,26 +1506,40 @@ readWpsFromFile( mapname )
|
|||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = getWaypointLinesFromFile( filename );
|
f = BotBuiltinFileOpen( filename, "read" );
|
||||||
|
|
||||||
if ( !res.lines.size )
|
if ( f < 1 )
|
||||||
{
|
{
|
||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
BotBuiltinPrintConsole( "Attempting to read waypoints from " + filename );
|
BotBuiltinPrintConsole( "Attempting to read waypoints from " + filename );
|
||||||
|
|
||||||
waypointCount = int( res.lines[ 0 ] );
|
line = BotBuiltinReadLine( f );
|
||||||
|
|
||||||
for ( i = 1; i <= waypointCount; i++ )
|
if ( isdefined( line ) )
|
||||||
{
|
{
|
||||||
tokens = strtok( res.lines[ i ], "," );
|
waypointCount = int( line );
|
||||||
|
|
||||||
waypoint = parseTokensIntoWaypoint( tokens );
|
for ( i = 1; i <= waypointCount; i++ )
|
||||||
|
{
|
||||||
waypoints[ i - 1 ] = waypoint;
|
line = BotBuiltinReadLine( f );
|
||||||
|
|
||||||
|
if ( !isdefined( line ) )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tokens = strtok( line, "," );
|
||||||
|
|
||||||
|
waypoint = parseTokensIntoWaypoint( tokens );
|
||||||
|
|
||||||
|
waypoints[ i - 1 ] = waypoint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BotBuiltinFileClose( f );
|
||||||
|
|
||||||
return waypoints;
|
return waypoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ init_menu()
|
|||||||
self.menuinit = true;
|
self.menuinit = true;
|
||||||
|
|
||||||
self.menuopen = false;
|
self.menuopen = false;
|
||||||
self.menu_player = undefined;
|
|
||||||
self.submenu = "Main";
|
self.submenu = "Main";
|
||||||
self.curs[ "Main" ][ "X" ] = 0;
|
self.curs[ "Main" ][ "X" ] = 0;
|
||||||
self AddOptions();
|
self AddOptions();
|
||||||
@@ -75,6 +74,47 @@ init_menu()
|
|||||||
self thread doGreetings();
|
self thread doGreetings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyFixed()
|
||||||
|
{
|
||||||
|
if ( !isdefined( self ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
removeChildFixed( element )
|
||||||
|
{
|
||||||
|
temp = [];
|
||||||
|
|
||||||
|
for ( i = 0; i < self.children.size ; i++ )
|
||||||
|
{
|
||||||
|
if ( isdefined( self.children[ i ] ) && self.children[ i ] != element )
|
||||||
|
{
|
||||||
|
self.children[ i ].index = temp.size;
|
||||||
|
temp[ temp.size ] = self.children[ i ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.children = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
destroyElemFixed()
|
||||||
|
{
|
||||||
|
if ( !isdefined( self ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isdefined( self.parent ) )
|
||||||
|
{
|
||||||
|
self.parent removeChildFixed( self );
|
||||||
|
}
|
||||||
|
|
||||||
|
self destroyelem();
|
||||||
|
}
|
||||||
|
|
||||||
kill_menu()
|
kill_menu()
|
||||||
{
|
{
|
||||||
self notify( "bots_kill_menu" );
|
self notify( "bots_kill_menu" );
|
||||||
@@ -93,7 +133,7 @@ watchDisconnect()
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menutexty[ i ] ) )
|
if ( isdefined( self.menutexty[ i ] ) )
|
||||||
{
|
{
|
||||||
self.menutexty[ i ] destroy();
|
self.menutexty[ i ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +144,7 @@ watchDisconnect()
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menutext[ i ] ) )
|
if ( isdefined( self.menutext[ i ] ) )
|
||||||
{
|
{
|
||||||
self.menutext[ i ] destroy();
|
self.menutext[ i ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,18 +153,18 @@ watchDisconnect()
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
|
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Shader" ] destroy();
|
self.menu[ "X" ][ "Shader" ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
|
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Scroller" ] destroy();
|
self.menu[ "X" ][ "Scroller" ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isdefined( self.menuversionhud ) )
|
if ( isdefined( self.menuversionhud ) )
|
||||||
{
|
{
|
||||||
self.menuversionhud destroy();
|
self.menuversionhud destroyFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -332,7 +372,7 @@ OpenSub( menu, menu2 )
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menutext[ i ] ) )
|
if ( isdefined( self.menutext[ i ] ) )
|
||||||
{
|
{
|
||||||
self.menutext[ i ] destroy();
|
self.menutext[ i ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,18 +381,18 @@ OpenSub( menu, menu2 )
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
|
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Shader" ] destroy();
|
self.menu[ "X" ][ "Shader" ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
|
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Scroller" ] destroy();
|
self.menu[ "X" ][ "Scroller" ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isdefined( self.menuversionhud ) )
|
if ( isdefined( self.menuversionhud ) )
|
||||||
{
|
{
|
||||||
self.menuversionhud destroy();
|
self.menuversionhud destroyFixed();
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0 ; i < self.option[ "Name" ][ self.submenu ].size ; i++ )
|
for ( i = 0 ; i < self.option[ "Name" ][ self.submenu ].size ; i++ )
|
||||||
@@ -402,7 +442,7 @@ OpenSub( menu, menu2 )
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menutexty[ i ] ) )
|
if ( isdefined( self.menutexty[ i ] ) )
|
||||||
{
|
{
|
||||||
self.menutexty[ i ] destroy();
|
self.menutexty[ i ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,11 +466,11 @@ CursMove( direction )
|
|||||||
|
|
||||||
if ( self.submenu == "Main" )
|
if ( self.submenu == "Main" )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Scroller" ].x = self.menutext[ self.curs[ "Main" ][ "X" ] ].x;
|
|
||||||
self.menu[ "X" ][ "Scroller" ].y = self.menutext[ self.curs[ "Main" ][ "X" ] ].y;
|
|
||||||
|
|
||||||
if ( isdefined( self.menutext ) )
|
if ( isdefined( self.menutext ) )
|
||||||
{
|
{
|
||||||
|
self.menu[ "X" ][ "Scroller" ].x = self.menutext[ self.curs[ "Main" ][ "X" ] ].x;
|
||||||
|
self.menu[ "X" ][ "Scroller" ].y = self.menutext[ self.curs[ "Main" ][ "X" ] ].y;
|
||||||
|
|
||||||
for ( i = 0; i < self.menutext.size; i++ )
|
for ( i = 0; i < self.menutext.size; i++ )
|
||||||
{
|
{
|
||||||
if ( isdefined( self.menutext[ i ] ) )
|
if ( isdefined( self.menutext[ i ] ) )
|
||||||
@@ -578,7 +618,7 @@ ExitSub()
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menutexty[ i ] ) )
|
if ( isdefined( self.menutexty[ i ] ) )
|
||||||
{
|
{
|
||||||
self.menutexty[ i ] destroy();
|
self.menutexty[ i ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,7 +643,7 @@ ExitMenu()
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menutext[ i ] ) )
|
if ( isdefined( self.menutext[ i ] ) )
|
||||||
{
|
{
|
||||||
self.menutext[ i ] destroy();
|
self.menutext[ i ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -612,18 +652,18 @@ ExitMenu()
|
|||||||
{
|
{
|
||||||
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
|
if ( isdefined( self.menu[ "X" ][ "Shader" ] ) )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Shader" ] destroy();
|
self.menu[ "X" ][ "Shader" ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
|
if ( isdefined( self.menu[ "X" ][ "Scroller" ] ) )
|
||||||
{
|
{
|
||||||
self.menu[ "X" ][ "Scroller" ] destroy();
|
self.menu[ "X" ][ "Scroller" ] destroyElemFixed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isdefined( self.menuversionhud ) )
|
if ( isdefined( self.menuversionhud ) )
|
||||||
{
|
{
|
||||||
self.menuversionhud destroy();
|
self.menuversionhud destroyFixed();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.menuopen = false;
|
self.menuopen = false;
|
||||||
@@ -728,6 +768,10 @@ AddOptions()
|
|||||||
_temp = "bots used as team balance";
|
_temp = "bots used as team balance";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
_temp = "bots used as team balance, adjust to map";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_temp = "out of range";
|
_temp = "out of range";
|
||||||
break;
|
break;
|
||||||
@@ -1302,6 +1346,11 @@ man_bots( a, b )
|
|||||||
self iprintln( "bot_fill will now use bots as team balance." );
|
self iprintln( "bot_fill will now use bots as team balance." );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
setdvar( "bots_manage_fill_mode", 5 );
|
||||||
|
self iprintln( "bot_fill will now use bots as team balance, adjusting to map." );
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
setdvar( "bots_manage_fill_mode", 0 );
|
setdvar( "bots_manage_fill_mode", 0 );
|
||||||
self iprintln( "bot_fill will now count everyone." );
|
self iprintln( "bot_fill will now count everyone." );
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ init()
|
|||||||
if ( !getdvarint( "developer" ) )
|
if ( !getdvarint( "developer" ) )
|
||||||
{
|
{
|
||||||
setdvar( "developer_script", 1 );
|
setdvar( "developer_script", 1 );
|
||||||
setdvar( "developer", 1 );
|
setdvar( "developer", 2 );
|
||||||
|
|
||||||
setdvar( "sv_mapRotation", "map " + getdvar( "mapname" ) );
|
BotBuiltinCmdExec( "devmap " + getdvar( "mapname" ) );
|
||||||
exitlevel( false );
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setdvar( "bots_main", 0 );
|
setdvar( "bots_main", 0 );
|
||||||
@@ -354,8 +354,13 @@ watchSaveWaypointsCommand()
|
|||||||
|
|
||||||
println( "********* Start Bot Warfare WPDump *********" );
|
println( "********* Start Bot Warfare WPDump *********" );
|
||||||
println( level.waypointcount );
|
println( level.waypointcount );
|
||||||
|
|
||||||
|
f = BotBuiltinFileOpen( filename, "write" );
|
||||||
|
|
||||||
BotBuiltinFileWrite( filename, level.waypointcount + "\n", "write" );
|
if ( f > 0 )
|
||||||
|
{
|
||||||
|
BotBuiltinWriteLine( f, level.waypointcount );
|
||||||
|
}
|
||||||
|
|
||||||
for ( i = 0; i < level.waypointcount; i++ )
|
for ( i = 0; i < level.waypointcount; i++ )
|
||||||
{
|
{
|
||||||
@@ -388,7 +393,16 @@ watchSaveWaypointsCommand()
|
|||||||
str += ",";
|
str += ",";
|
||||||
|
|
||||||
println( str );
|
println( str );
|
||||||
BotBuiltinFileWrite( filename, str + "\n", "append" );
|
|
||||||
|
if ( f > 0 )
|
||||||
|
{
|
||||||
|
BotBuiltinWriteLine( f, str );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( f > 0 )
|
||||||
|
{
|
||||||
|
BotBuiltinFileClose( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
println( "\n\n\n\n\n\n" );
|
println( "\n\n\n\n\n\n" );
|
||||||
|
|||||||
@@ -1,37 +1,46 @@
|
|||||||
init()
|
init()
|
||||||
{
|
{
|
||||||
level.bot_builtins[ "printconsole" ] = ::do_printconsole;
|
level.bot_builtins[ "printconsole" ] = ::do_printconsole;
|
||||||
level.bot_builtins[ "filewrite" ] = ::do_filewrite;
|
|
||||||
level.bot_builtins[ "fileread" ] = ::do_fileread;
|
|
||||||
level.bot_builtins[ "fileexists" ] = ::do_fileexists;
|
level.bot_builtins[ "fileexists" ] = ::do_fileexists;
|
||||||
level.bot_builtins[ "botaction" ] = ::do_botaction;
|
level.bot_builtins[ "botaction" ] = ::do_botaction;
|
||||||
level.bot_builtins[ "botstop" ] = ::do_botstop;
|
level.bot_builtins[ "botstop" ] = ::do_botstop;
|
||||||
level.bot_builtins[ "botmovement" ] = ::do_botmovement;
|
level.bot_builtins[ "botmovement" ] = ::do_botmovement;
|
||||||
level.bot_builtins[ "botmeleeparams" ] = ::do_botmeleeparams;
|
level.bot_builtins[ "botmeleeparams" ] = ::do_botmeleeparams;
|
||||||
|
level.bot_builtins[ "botangles" ] = ::do_botangles;
|
||||||
level.bot_builtins[ "isbot" ] = ::do_isbot;
|
level.bot_builtins[ "isbot" ] = ::do_isbot;
|
||||||
|
level.bot_builtins[ "fs_fopen" ] = ::do_fs_fopen;
|
||||||
|
level.bot_builtins[ "fs_fclose" ] = ::do_fs_fclose;
|
||||||
|
level.bot_builtins[ "fs_readline" ] = ::do_fs_readline;
|
||||||
|
level.bot_builtins[ "fs_writeline" ] = ::do_fs_writeline;
|
||||||
|
level.bot_builtins[ "notifyonplayercommand" ] = ::do_notifyonplayercommand;
|
||||||
|
level.bot_builtins[ "cmdexec" ] = ::do_cmdexec;
|
||||||
|
level.bot_builtins[ "ishost" ] = ::do_ishost;
|
||||||
|
}
|
||||||
|
|
||||||
|
do_notifyonplayercommand( a, b )
|
||||||
|
{
|
||||||
|
self notifyonplayercommand( a, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_cmdexec( a )
|
||||||
|
{
|
||||||
|
cmdexec( a );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_ishost()
|
||||||
|
{
|
||||||
|
return self ishost();
|
||||||
}
|
}
|
||||||
|
|
||||||
do_printconsole( s )
|
do_printconsole( s )
|
||||||
{
|
{
|
||||||
printconsole( s );
|
printf( s );
|
||||||
}
|
|
||||||
|
|
||||||
do_filewrite( file, contents, mode )
|
|
||||||
{
|
|
||||||
file = "scriptdata/" + file;
|
|
||||||
filewrite( file, contents, mode );
|
|
||||||
}
|
|
||||||
|
|
||||||
do_fileread( file )
|
|
||||||
{
|
|
||||||
file = "scriptdata/" + file;
|
|
||||||
return fileread( file );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_fileexists( file )
|
do_fileexists( file )
|
||||||
{
|
{
|
||||||
file = "scriptdata/" + file;
|
file = "scriptdata/" + file;
|
||||||
return true;
|
return fs_testfile( file );
|
||||||
}
|
}
|
||||||
|
|
||||||
do_botaction( action )
|
do_botaction( action )
|
||||||
@@ -54,7 +63,33 @@ do_botmeleeparams( yaw, dist )
|
|||||||
self botmeleeparams( yaw, dist );
|
self botmeleeparams( yaw, dist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_botangles( angles )
|
||||||
|
{
|
||||||
|
self botangles( angles );
|
||||||
|
}
|
||||||
|
|
||||||
do_isbot()
|
do_isbot()
|
||||||
{
|
{
|
||||||
return self isbot();
|
return self isbot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_fs_fopen( file, mode )
|
||||||
|
{
|
||||||
|
file = "scriptdata/" + file;
|
||||||
|
return fs_fopen( file, mode );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_fs_fclose( fh )
|
||||||
|
{
|
||||||
|
fs_fclose( fh );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_fs_readline( fh )
|
||||||
|
{
|
||||||
|
return fs_readline( fh );
|
||||||
|
}
|
||||||
|
|
||||||
|
do_fs_writeline( fh, contents )
|
||||||
|
{
|
||||||
|
fs_writeline( fh, contents );
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user