Jump to content

How to make mortar mode/map?


CPUSkull

Recommended Posts

NQ has live cam for mortar

http://et.clan-etc.de/noquarter_wiki/wiki/cvars_gameplay.html#column-one

 

jp_insanity (Changed in 1.2.8)


Description
No Quarter fun modes are controlled by this bitmask CVAR.

 

Parameters

 

Type: bitmask
1    Instant Spawn
2    Unlimited Ammo
4    Mortar Cam
8    Rocket Cam
16    Unlimited Charge
32    Guided Rockets
64    Homing Rockets
128    Unlocked Weapons (1.2.7 and lower)  -  Dog Tags Mode (1.2.8 and higher)
256    Venom Mode
512    Shows attackers HP left message (1.2.3 and higher)
1024    Shows attackers HP left message & distance (1.2.5 and higher)
2048    Kickable Dynamite (1.2.7 and higher)
4096    Killer Cam (similar to mortar cam) (1.2.8 and higher)
8192    Riflenade Cam (similar to mortar cam) (1.2.8 and higher)
Default: 0

Link to comment
Share on other sites

You can change the omnibots to soldier and restrict their weapon choices too. Although you would need to allow more than 1 mortar per team if youre looking for a mortar war test.. :0

  • Like 1
Link to comment
Share on other sites

to make omni-bots play a specific class

 

syntax: bot addbot <optional team> <optional class> <optional name>
example: /bot addbot 2 1 bob will add a soldier named bob to the allied team in ET

 

http://omni-bot.invisionzone.com/wiki/index.php?title=Omni-bot_Command_Reference

 

You can also do this by adding a custom.cfg to the omnibot folder it has to be set in that folder to execute the bot addbot

 

and execute it threw properties tab with +exec custom.cfg

 

and just have

 

bot addbot 1 1

 

and restrict weapons like Barnie described above

 

using 

 

set g_heavyWeaponRestriction "0"

set team_maxFlamers "0"

set team_maxMG42s "0"
set team_maxMortars "10"
set team_maxPanzers "0"

 

set maxMortars to the desired number of bots used and it will make them all use mortar

 

if you have problems with maxbots being limited you will need to open 

 

Wolfenstein - Enemy Territory\omni-bot\et\user\omni-bot.cfg

 

and set min and max there 

 

example from omni-bot.cfg 

 

[ServerManager]
MaxBots                        = 16    <--- you can up this number to as much as your pc can handle 32 is recommended max my opinion 
BalanceTeams                   = 0
SaveConfigChanges              = 1
CountSpectators                = 0
SleepBots                      = 0
MinBots                        = -1    <--- do note if your experience no bots loading up this number to make them appear use -1 if you plan on kicking bots best setting would be to set to server max for videos for instance 16
InitialDelayTime               = 2.1

 

in server.cfg in the mod folder being executed you will need to set these two to get bots to start

 

omnibot_enable 1
omnibot_path "C:\Program Files (x86)\Wolfenstein - Enemy Territory\omni-bot" 

 

set Omnibot_Flags 0  // flags aren't required by default it is 0

 

the omnibot_path is set using the location of the et.exe folder  if you want to shorthand this path just use  omnibot_path ".\omni-bot"

 

for example the one Im using to modify waypoints

 

This is editing the properties of a shortcut created of et.exe ink file

 

"C:\Program Files (x86)\Wolfenstein - Enemy Territory\" +set fs_game omnibot +set g_gametype 2 +set sv_pure 0 +exec server.cfg +exec custom.cfg +devmap egypt_v2

 

set fs_game omnibot <---- this is the mod folder being executed must set first

 

do note this is not omni-bot this mod will be created after the game loads the first time you may have to start the game first with +exec server.cfg and then add the set fs_game when you close it

 

set g_gametype 2       <---- Set server to 2 and make sure to edit server.cfg to //g_gametype marked out with //'s

set sv_pure 0               <---- So you can use /noclip and /god

if your going for a close recording only OB_DMS.pk3 has ignore player http://omni-bot.invisionzone.com/wiki/index.php?title=DMS

exec server.cfg           <---- Your server preferences for soldiers are set here

exec custom.cfg         <---- This is used for miscellaneous settings for bots

 

freecam is only used in etpro and etlegacy through demo's just so you know before asking how to get a external recording

 

sorry for not being more informative then before sometimes I got to much on my hands to write as much

 

Always remember there is no omnibot folder until after the game has been played the first time then it is created if bots are enabled then you can modify the bots to anything you want using

a omni-bot.cfg in that mod folder under etmain not in the omni-bot folder only modify the files in the omni-bot folder if it is necessary or you may corrupt your bots configuration and will have to do a fresh install

  • Thanks 1
  • Love 1
Link to comment
Share on other sites

I was going to suggest modifying et_classmanager.gm in omni-bot/et/scripts to change class weapons available.
Works OK on Home ET Server, But crashed Rental VirtualServer when We tried to disable Panzerfaust for bots.

You could ask Omnibot Forums how to make all bots Mortarhttp://omni-bot.invisionzone.com/index.php?/index:

Edited by Buckwild
addition
Link to comment
Share on other sites

I was going to offer a different solution but for NQ there's no panzerwar command can't take that path

 

But there is a way to define each bot to use mortar by defaulting it's weapons

 

It's a cheesy way of doing it but a temporary work around in omni-bot\et\scripts\def_bot.gm

 

change Primary to WEAPON.MORTAR

 

on line 102

 

this.SelectWeapons = function()
{
    Primary = this.ClassPrimaryWeaponChoice();
    Secondary = this.ClassSecondaryWeaponChoice();

    if ( Primary )
        { this.ChangePrimaryWeapon( Primary ); }

    if ( Secondary )
        { this.ChangeSecondaryWeapon( Secondary ); }
};

 

and in et_autoexec.gm

 

slash out 

 

//global ClassManager = import("et_classmanager");

 

this will remove the callstack error

or set

global DisableClassManager = 1;

 

defualt is 0

 

and bots should all be using mortar I think 

 

now there could be a bug with bots running around with single pistols just remove 

 

    if ( Secondary )
        { this.ChangeSecondaryWeapon( Secondary ); }

 

also to disable panzers for bots you set the omni-bot\et\scripts\et_weapontables.gm

 

tbl1[WEAPON.PANZERFAUST] = false

 

the weapons table defines the bot available usage if you want bots to use just smg's you set them all to false

Link to comment
Share on other sites

Or ask at Splasdamage Forums: How to make a mortar only map. https://forums.splashdamage.com/
Enemy Territory map: glider_panzerduel_101 by 2Bit (2008) has only panzers as weapons in the map...

 

Link to comment
Share on other sites

I was almost frustrated until I realized something even if setting a perfect script up for mortars the maps will require goals that support x-amount of mortars

 

example; there are only 5 on this map I was working on and they work fine with these settings below

MOBILEMORTAR_mortar1axis = 
    {
        CreateOnLoad = 1,
        GoalType = "MOBILEMORTAR",
        GroupName = "",
        MinRadius = 32,
        MortarAim = 
        {
            [0] = Vec3(0.944, 0.268, -0.191),
        },
        Name = "MOBILEMORTAR_mortar1axis",
        Orientation = Vec3(-1.294, -0.192, -0.000),
        Position = Vec3(-6227.221, 5188.964, -1246.728),
        Radius = 0,
        TagName = "mortar1axis",
        TeamAvailability = 30,
        Version = 1,
    },

 

 2019-08-26-012454-mlb_egypt.thumb.jpg.816f6032ef649fd2e85305a0912db8e4.jpg

 

If you know anything about map waying then you would be in for a hurt to place bots in maps with no waygoals for mortars

 

I'd be glad to assist even further with the maps as well this was modded directly for NQ 

 

But I have no set up killcam or mortarcam because I am using the latest version not sure exactly which one has the mortar cam that will take a few days to figure out unless someone knows specificly which one it is

 

if you decide you want to continue here is what I had to do to get this far

 

sense the mod folder is NQ I will be showing cvars for nq.cfg some of these you don't need but I want to be complete with a whole cfg the rcon is not set

if you need it just use set rconpassword "password" anywhere

 

nq.cfg in nq mod folder

Spoiler

// No Quarter 1.2.9 
//* Omni-Bots * //
set Omnibot_Enable 1
set Omnibot_Path "./Omni-Bot ET/Wolfenstein - Enemy Territory/omni-bot"
set Omnibot_Flags 0

set g_csMethod 0
set g_csStrings 3
set g_ForceCvarFile ""
set g_simpleBullets 0
set g_killerLockTime 5

set ip_max_clients 3
set g_friendlyFire 0
set g_adrenaline 32
set g_noAttacklInvul 1
set g_weaponItems 7
set g_missileHealth 5
set g_missileSpeed 0
set g_bulletReflect 0
set g_falloff 1
set g_missileGravity 2
set g_fastBackStab 0
set g_realism 32
set g_announcer 255
set g_flushItems 1

set g_multikillTime 2500
set g_mortarBBox 0
set g_weaponScriptsDir ""
set g_spectator 0

set jp_insanity 1
set g_unlockWeapons 1

set nq_War 0

set g_throwDistance 75
set g_dragCorpse 1
set g_dropObj 1
set g_slashkill 0
set g_spawnInvul 3 
set g_dropAmmo 1
set g_dropHealth 1
set g_shortcuts 1
set g_shrubbot "shrubbot.cfg"
set g_dbDirectory ".\nq"
set g_skills 16
set g_msgs 30
set g_msgPos 1
seta g_msg0 ""
seta g_msg1 ""
seta g_msg2 ""
seta g_msg3 ""
seta g_msg4 ""
set g_censor ""
set g_censorMuteTime "120"
set g_censorNames "hitler,osama"
set g_censorPenalty 48
set g_intermissionTime 35
set g_intermissionReadyPercent 75
set g_inactivity 180
set g_spectatorInactivity 0
set g_mapScriptDirectory ""
set g_canisterKick 80
set g_canisterKickOwner 0
set g_classChange 0
set g_constructibleXPsharing 1
set g_doubleJump 0
set g_doubleJumpHeight 1.4
set g_shove 150
set g_shoveNoZ 0
set g_asblock 0
set g_fear 2000
set g_goomba 0
set g_weapons 8

set g_goombaFlags 25
set g_headshot 0
set g_playdead 1
set g_medics 65
set g_realHead 1

set vote_limit 3
set vote_percent 66
set vote_allow_antilag 0
set vote_allow_balancedteams 0
set vote_allow_comp 0
set vote_allow_friendlyfire 0
set vote_allow_gametype 0
set vote_allow_kick 0
set vote_allow_map 0
set vote_allow_maprestart 0
set vote_allow_matchreset 0
set vote_allow_mutespecs 0
set vote_allow_muting 0
set vote_allow_nextcampaign 0
set vote_allow_nextmap 0
set vote_allow_poll 0
set vote_allow_pub 0
set vote_allow_referee 0
set vote_allow_restartcampaign 0
set vote_allow_shuffleteamsxp 0
set vote_allow_shuffleteamsxp_norestart 0
set vote_allow_surrender 0
set vote_allow_swapteams 0
set vote_allow_timelimit 0
set vote_allow_warmupdamage 0

set team_maxIsPercentage 0
set team_maxPanzers -1
set team_maxMortars 16
set team_maxRifleGrenades -1
set team_maxMG42 -1
set team_maxFlamers -1
set team_maxShotguns -1
set team_maxVenoms -1
set team_maxLMGs -1
set team_maxScopes -1
set team_maxLandmines 10
set team_artyTime 10
set team_airstrikeTime  10
set team_panzerRestriction 100

set g_XPSave "15"
set g_XPSaveDirectory ""
set g_XPSaveMaxAge 86400
set g_XPDecay 0
set g_XPDecayFloor 540
set g_XPDecayRate 0
set g_maxXP 10000

seta skill_lightWeapons "0 0 0 0 0 0 0 0 0"
seta skill_battleSense "0 0 0 0 0 0 0 0 0"
seta skill_soldier "0 0 0 0 0 0 0 0 0"
seta skill_medic "0 0 0 0 0 0 0 0 0"
seta skill_engineer "0 0 0 0 0 0 0 0 0"
seta skill_fieldops "0 0 0 0 0 0 0 0 0"
seta skill_covertops "0 0 0 0 0 0 0 0 0"

set g_countryflags 0 

set lua_modules ""
set lua_allowedModules ""

set nq_scriptMode 7

//* Map voting CVARS (don't set if you don't use map voting* //
set g_mapVoteFlags 0
set g_maxMapsVotedFor 6
set g_minMapAge 3
set g_excludedMaps ":fueldump:"
set g_resetXPMapCount 0


///////////////////////////////////////////////////////////////////////

// MISC SETTINGS

set g_heavyWeaponRestriction "100"
set g_antilag "1"
set g_altStopwatchMode "0"
set g_autofireteams "1"
set g_complaintlimit "6"
set g_ipcomplaintlimit "3"
set g_fastres "0"
set g_friendlyFire "0"
//set g_gametype "4"            // Game type should be set from map rotation script
set g_minGameClients "8"
set g_maxlives "0"
set g_alliedmaxlives "0"
set g_axismaxlives "0"
set g_teamforcebalance "1"
set g_noTeamSwitching "0"
set g_voiceChatsAllowed "4"
set g_doWarmup "0"
set g_warmup "10"
set g_spectatorInactivity "0"

set sv_floodProtect "1"
set sv_allowDownload "1"
set sv_pure "1"
set sv_minping "0"
set sv_maxping "0"
set match_latejoin "1"
set match_minplayers "1"
set match_mutespecs "0"
set match_readypercent "0"
set match_timeoutcount "0"
set match_warmupDamage "1"
set team_maxplayers "0"
set team_nocontrols "1"
set pmove_fixed "0"
set pmove_msec "8"

// LMS ONLY SETTINGS

set g_lms_teamForceBalance "1"
set g_lms_roundlimit "3"
set g_lms_matchlimit "2"
set g_lms_currentMatch "0"
set g_lms_lockTeams "0"
set g_lms_followTeamOnly "1"

// VOTING

set g_allowVote "1"
set vote_limit "5"
set vote_percent "50"
set vote_allow_comp "1"
set vote_allow_gametype "1"
set vote_allow_kick "1"
set vote_allow_map "1"
set vote_allow_matchreset "1"
set vote_allow_mutespecs "1"
set vote_allow_nextmap "1"
set vote_allow_pub "1"
set vote_allow_referee "0"
set vote_allow_shuffleteams "1"
set vote_allow_swapteams "1"
set vote_allow_friendlyfire "1"
set vote_allow_timelimit "0"
set vote_allow_warmupdamage "1"
set vote_allow_antilag "1"
set vote_allow_balancedteams "1"
set vote_allow_muting "1"

 

This is using Omni-Bot 0.86 http://omni-bot.invisionzone.com/index.php?/files/file/27-omni-bot-enemy-territory/

 

et_utilities.gm

Spoiler

// This script contains useful game specific utility functions.

///////////////////////////////////////////////////////////////////////////////
// Set up some core utility module with game specific stuff.
Util.PlayerClassTable =
{
    CLASS.SOLDIER, <------ Only changes this there has to be multiples for classmanager to work
    CLASS.SOLDIER,
    CLASS.SOLDIER,
    CLASS.SOLDIER,
    CLASS.SOLDIER,

};
if (GetModName() == "etblight")
{
    Util.PlayerClassTable[5] = CLASS.SCIENTIST;
    Util.PlayerClassTable[6] = CLASS.SUPER_SOLDIER;
}

Util.SniperClass = CLASS.COVERTOPS;

// offset for converted waypoint goals
Util.WaypointGoalOffset = Vector3(0,0,-24);

Util.AllTeams = (1 << TEAM.AXIS) | (1 << TEAM.ALLIES);

Util.PrimaryRouteGoalQuery = "BUILD_.*\nPLANT_.*\nFLAG_.*\nCHECKPOINT_.*";

// debug string color
Util.DebugColorString = "^b";


///////////////////////////////////////////////////////////////////////////////
// these values are for makegm.gm

Util.FlagCarrier = "CLASS.ENGINEER";
Util.Sniper = "CLASS.COVERTOPS";

Util.HaveTeam = { false, true, true, false, false };

Util.TeamNames =
{
    { "", "", "" },
    { "AXIS", "Axis", "axis" },
    { "ALLIES", "Allies", "allies" },
};

///////////////////////////////////////////////////////////////////////////////
// these values are for testmap.gm

Util.NoTimeLimit = "timelimit 0";
Util.TimeLimit1 = "timelimit 1";

Util.BotNames =
{
    {
        "", "", "", "",
        "", "",
    },
    {
        "", "axis_soldier", "axis_medic", "axis_engineer",
        "axis_fieldops", "axis_covertops",
    },
    {
        "", "allies_soldier", "allies_medic", "allies_engineer",
        "allies_fieldops", "allies_covertops",
    },
};

///////////////////////////////////////////////////////////////////////////////
// store time at start of map since GetTime() is server uptime. set in PostMapLoad
member MapStartTime = 0.0;

member GetTimeElapsed = function()
{
    t = GetTime();
    return t - ETUtil.MapStartTime;
};

///////////////////////////////////////////////////////////////////////////////
// todo: make generic with a Util.GenericGoals table
member ClearMainGoals = function()
{
    Util.DisableGoal({
        "BUILD.*",
        "PLANT.*",
        "MOUNTMG42.*",
        "MOVER.*",
        "CHECKPOINT.*",
        "FLAG.*",
        "AMMOCAB.*",
        "HEALTHCAB.*"
    });
};

///////////////////////////////////////////////////////////////////////////////
// todo: make generic with a Util.SecondaryGoals table
member ClearSecondaryGoals = function()
{
    Util.DisableGoal({
        "HEALTH.*",
        "AMMO.*",
        "REPAIRMG42.*",
        "PLANTMINE.*",
        "MOBILEMG42.*",
        "ARTILLERY.*",
    });
};

///////////////////////////////////////////////////////////////////////////////
//
member CheatsEnabled = function()
{
    if ( CheatsEnabled() ) {
        return true;
    }
    Error("cheats must be enabled to use this command");
    print("type /devmap", GetMapName(), "in console");
    return false;
};

///////////////////////////////////////////////////////////////////////////////
//
member CheckVehiclePath = function( _params )
{
    if (this.CheckVehiclePathFlag)
    {
        this.CheckVehiclePathFlag = null;
        return;
    }

    if ( !this.CheatsEnabled() ) {
        return;
    }

    goalname = _params[ 0 ];
    goal = Util.GetGoal( goalname, "ETUtil.CheckVehiclePath" );
    if ( !goal )
    {
        return;
    }
    if (goal.GoalType != "BUILD")
    {
        print( "CheckVehiclePath: goal type is not BUILD" );
        return;
    }

    goalname2 = goal.Vehicle;
    if (!goalname2)
    {
        print( "CheckVehiclePath: Goal", goalname, "is not vehicle" );
        return;
    }
    goal2 = Util.GetGoal( goalname2, "ETUtil.CheckVehiclePath" );
    if ( !goal2 )
    {
        return;
    }

    if ( goal.IsAvailable( TEAM.ALLIES ) )
    {
        print("Allies objective");
        team = TEAM.ALLIES;
        botname = "allies_engineer";
    }
    else if ( goal.IsAvailable( TEAM.AXIS ) )
    {
        print("Axis objective");
        team = TEAM.AXIS;
        botname = "axis_engineer";
    }
    else
    {
        print( "CheckVehiclePath: Goal:", goalname, "not available" );
        return;
    }

    this.CheckVehiclePathFlag = true;
    AddBot( team, CLASS.ENGINEER, botname );

    entity = goal2.GetEntity();

    sleeptime = _params[ 1 ];
    if ( !sleeptime )
        { sleeptime = 2; }

    print( "Started checking vehicle path for:", goalname2 );

    while ( this.CheckVehiclePathFlag )
    {
        EntityKill( entity );

        yield();
        SetAvailableMapGoals( team, false, ".*" );
        SetAvailableMapGoals( team, true, { goalname, goalname2 } );

        while ( Util.GetEntHealth(entity) <= 0 && this.CheckVehiclePathFlag )
        {
            yield();
        }

        if ( !this.CheckVehiclePathFlag )
            { break; }

        sleep( sleeptime );
    }

    print( "Finished checking vehicle path for:", goalname2 );
};

///////////////////////////////////////////////////////////////////////////////
//
member BuildVehiclePath = function( _params )
{
    if (this.BuildVehiclePathFlag)
    {
        this.BuildVehiclePathFlag = null;
        return;
    }

    if ( !this.CheatsEnabled() )
    {
        return;
    }

    goalname = _params[ 0 ];
    goal = Util.GetGoal( goalname, "ETUtil.BuildVehiclePath" );
    if ( !goal ) {
        return;
    }
    if (goal.GoalType != "MOVER")
    {
        print( "BuildVehiclePath: goal type is not MOVER" );
        return;
    }

    entity = goal.GetEntity();

    this.BuildVehiclePathFlag = true;

    sleeptime = _params[ 1 ];
    if ( !sleeptime )
        { sleeptime = 2; }

    print( "Started build vehicle path for:", goalname );

    while ( this.BuildVehiclePathFlag )
    {
        EntityKill( entity );

        while ( Util.GetEntHealth(entity) <= 0 && this.BuildVehiclePathFlag )
        {
            yield();
        }

        if ( !this.BuildVehiclePathFlag )
            { break; }

        sleep( sleeptime );
    }

    print( "Finished buidling vehicle path for:", goalname );
};

///////////////////////////////////////////////////////////////////////////////
//
member WarpToPosition = function( pos )
{
    if ( this.CheatsEnabled() )
    {
        s = "setviewpos " + pos[0] + " " + pos[1] + " " + pos[2] + " " + " 0";
        print(s);
        ExecCommandOnClient(GetLocalEntity(), s);
    }
};
///////////////////////////////////////////////////////////////////////////////
//
member WarpTo = function( _params )
{
    pos = Util.GetPositionFromParam( _params[0] );
    if ( pos )
    {
        this.WarpToPosition(pos + Vector3(0,0,24));
    }
    else
        { Error( "ETUtil.Warpto: Invalid goal name, waypoint name, waypoint UID or paththrough name!^2" ); }
};
///////////////////////////////////////////////////////////////////////////////
//
member WarpTestBot = function( _params )
{
    if ( !this.CheatsEnabled() )
    {
        return;
    }

    b = Util.GetBotByName("testbot");

    if ( !b )
    {
        Error("no testbot found");
        return;
    }

    localEnt = GetLocalEntity();

    if ( _params[0] )
    {
        wp = Util.WpNameInfo(_params[0], "ETUtil.WarpTestBot");
        if ( wp )
        {
            pos = wp.position + Vector3(0,0,24);
        }
    }
    else
    {
        pos = GetEntPosition(localEnt);
        if ( pos )
        {
            pos += Vector3(100,0,24);
        }
        else
        {
            Error( "ETUtil.WarpTestBot: Unable to get local position^2");
        }
    }

    if (pos)
    {
        s = "setviewpos " + pos[0] + " " + pos[1] + " " + pos[2] + " " + " 0";
        print(s);
        ExecCommandOnClient(localEnt, s);
        yield();
        ExecCommandOnClient(b.GetGameEntity(), s);
        yield();yield();
        ExecCommandOnClient(localEnt, "say_team bot come");
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member WarpAnyBot = function(_params)
{
    if ( !this.CheatsEnabled() )
    {
        return;
    }

    if ( _params[0] ) {
        foundMatch = null;

        foreach ( bot in BotTable ) {
            if ( bot.Name.Find(_params[0])!= -1 ) {
                foundMatch = bot;
                break;
            }
        }

        if (foundMatch) {
            // can't warp if dead or limbo
            if ( foundMatch.Health < 1 || foundMatch.HasEntityFlag(ENTFLAG.LIMBO) ) {
                Error("bot must be alive to warp!");
                return;
            }

            pos = GetLocalPosition();
            if (pos) {
                pos += Vector3(0,0,24);
                s = "setviewpos " + pos[0] + " " + pos[1] + " " + pos[2] + " " + " 0";

                // disable the bot while it's getting ready to warp
                foundMatch.Enable(false);
                ExecCommandOnClient(foundMatch.GetGameEntity(), s);
                sleep(2);
                foundMatch.Enable(true);
                return;
            }
        }

        Error("no bot found with the name ", _params[0]);
    }
    else {
        Error("/bot wab requires a partial or full bot name");
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member WarpToGoalOffset = function( _params )
{
    goal = Util.GetGoal( _params[0], "ETUtil.WarpToGoalOffset" );
    offset = Vector3( _params[ 1 ], _params[ 2 ], _params[ 3 ] );

    if ( goal )
    {
        this.WarpToPosition(GetEntityWorldSpace( goal.GetEntity(), offset));
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member CountClass = function( team, class )
{
    count = 0;
    foreach ( bot in BotTable )
    {
        if ( bot.GetTeam() == team && bot.GetClass() == class )
            { count += 1; }
    }

    return count;
};

///////////////////////////////////////////////////////////////////////////////
//
member NoSnipeWeapons =
{
    WEAPON.STEN,
    WEAPON.FG42,
};

///////////////////////////////////////////////////////////////////////////////
//
member NoSnipe = function( bot )
{
    if ( bot.GetClass() != CLASS.COVERTOPS )
        { return; }

    if (!Map.DontSelectWeapons) {
        Util.MapDeprecateMessage( "ETUtil.NoSnipe", "SetAvailableMapGoals" );
        return;
    }

    if ( Util.CanBotSnipe(bot) )
    {
        bot.ChangePrimaryWeapon( Util.GetRandomTableValue(this.NoSnipeWeapons) );
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member StopSniping = function(team)
{
    if (!Map.DontSelectWeapons) {
        Util.MapDeprecateMessage( "ETUtil.StopSniping", "SetAvailableMapGoals" );
        return;
    }
    foreach ( bot in BotTable )
    {
        if ( team && bot.GetTeam() != team )
            { continue; }

        this.NoSnipe(bot);
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member SetPrimaryGoals = function(priority)
{
    SetGoalPriority( "CAPPOINT_.*", priority );
    SetGoalPriority( "PLANT_.*", priority - 0.08f );
    SetGoalPriority( "CHECKPOINT_.*", priority - 0.1f );
    SetGoalPriority( "FLAG_.*", priority - 0.15f, 0, 0, true );
    SetGoalPriority( "FLAGRETURN_.*", priority - 0.05f, 0, 0, true  );
};

///////////////////////////////////////////////////////////////////////////////
// parameter isFog is ignored, goal_zooming sets MaxViewDistance
member SelectWeapon = function( bot, w, isFog )
{
    if (!Map.DontSelectWeapons) {
        // goal_selectweapons changes weapon every spawn
        Util.MapDeprecateMessage( "ETUtil.SelectWeapon", "WeaponTable.SetWeaponAvailability" );
        return;
    }
    tbl = WeaponTable.GetPrimaryWeapons( bot.GetTeam(), bot.GetClass() );
    if (!tbl || !IsNull(tbl[w]))
    {
        bot.ChangePrimaryWeapon( w );
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member SwitchWeapon = function( w, team )
{
    if (!Map.DontSelectWeapons) {
        Util.MapDeprecateMessage( "ETUtil.SwitchWeapon", "WeaponTable.SetWeaponAvailability" );
        return;
    }
    foreach ( bot in BotTable )
    {
        if ( team && bot.GetTeam() != team )
        {
            continue;
        }

        this.SelectWeapon( bot, w );
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member SetCabinets = function()
{
    SetGoalPriority( "HEALTHCAB.*", 0.0, 0, CLASS.MEDIC);
    SetGoalPriority( "AMMOCAB.*", 0.0, 0, CLASS.FIELDOPS);
};

///////////////////////////////////////////////////////////////////////////////
//
member SetDualObjective = function( bot )
{
    team = bot.GetTeam();

    if ( !Map.Defend )
        { Map.Defend = table(); }

    // counters for number of users
    if ( !Map.Defend.AlliesDefenders )
        { Map.Defend.AlliesDefenders = 0; }

    if ( !Map.Defend.AxisDefenders )
        { Map.Defend.AxisDefenders = 0; }

    // some default values
    if ( !Map.Defend.MaxBots )
        { Map.Defend.MaxBots = 4; }

    if ( team == TEAM.ALLIES  )
    {
        if (IsNull(this.numallies)) { this.numallies = 0; }
        this.numallies += 1;

        if ( Map.Defend.AlliesDefenders < Map.Defend.MaxBots ||  Map.Defend.AlliesDefenders < Map.Defend.MaxAlliesDefenders )
        {
            if ( this.numallies % 2 == 0 )
            {
                bot.SetRoles(ROLE.DEFENDER);

                //first bot defending will switch to crucial class
                if ( Map.Defend.AlliesDefenders == 0 && Map.Defend.CrucialClass )
                    { bot.ChangeClass(Map.Defend.CrucialClass); }

                if ( Map.Defend.AlliesSpawnPt )
                    { bot.ChangeSpawnPoint( Map.Defend.AlliesSpawnPt ); }

                Map.Defend.AlliesDefenders += 1;
            }
        }
    }

    if ( team == TEAM.AXIS  )
    {
        if (IsNull(this.numaxis)) { this.numaxis = 0; }
        this.numaxis += 1;

        if ( Map.Defend.AlliesDefenders < Map.Defend.MaxBots ||  Map.Defend.AlliesDefenders < Map.Defend.MaxAxisDefenders )
        {
            if ( this.numaxis % 2 == 0 )
            {
                bot.SetRoles(ROLE.DEFENDER);

                //first bot defending will switch to crucial class
                if ( Map.Defend.AxisDefenders == 0 && Map.Defend.CrucialClass )
                    { bot.ChangeClass(Map.Defend.CrucialClass); }

                if ( Map.Defend.AxisSpawnPt )
                    { bot.ChangeSpawnPoint( Map.Defend.AxisSpawnPt ); }

                Map.Defend.AxisDefenders += 1;
            }
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member TraceArty = function(usePlayer)
{
    radius = 200;
    playerEnt = GetLocalEntity();
    playerPos = GetEntPosition(playerEnt);
    foundGoal = null;
    sourceOffset = Vector3(0,0,60); // 60 is what the goal uses

    if ( !usePlayer )
    {
        dist = radius;
        foreach ( mapgoal in Util.GoalTable("CALLART.*") )
        {
            evalDist = DistanceBetween(mapgoal, playerPos);
            if ( evalDist < dist )
            {
                dist = evalDist;
                foundGoal = mapgoal;
            }
        }
    }

    if (foundGoal || usePlayer)
    {
        if ( !usePlayer )
        {
            print("ETUtil.TraceArty: Selected", foundGoal.GetName());
            sourcePos = foundGoal.GetPosition();
        }
        else
        {
            print("ETUtil.TraceArty: Tracing from", GetEntName(playerEnt), "^2");
            sourcePos = playerPos - Vector3(0,0,24);
        }

        targets = Util.GoalTable("ARTILLERY.*");
        if ( tableCount(targets) > 0 )
        {
            foreach ( targetgoal in targets )
            {
                targetPos = targetgoal.GetPosition();
                targetName = targetgoal.GetName();

                tr = TraceLine(sourcePos + sourceOffset, targetPos, null, TRACE.SHOT, playerEnt, false);
                if ( tr.fraction < 1 )
                {
                    print("ETUtil.TraceArty: ^1No line of sight to", targetName, "^2");
                    DrawDebugLine(sourcePos + sourceOffset, tr.end, COLOR.PINK, 30);
                    DrawDebugLine(tr.end, targetPos, COLOR.RED, 30);
                }
                else
                {
                    print("ETUtil.TraceArty: ^2Has line of sight to", targetName);
                    DrawDebugLine(sourcePos + sourceOffset, targetPos, COLOR.GREEN, 30);
                }
            }
        }
        else
        {
            Error("ETUtil.TraceArty: No Arty Targets");
        }
    }
    else
    {
        Error("ETUtil.TraceArty: No Arty Goal Close Enough");
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member TraceAllArty = function()
{
    targets = Util.GoalTable("ARTILLERY.*");
    sourceOffset = Vector3(0,0,64);

    foreach( mapgoal in Util.GoalTable("CALLART.*") )
    {
        sourcePos = mapgoal.GetPosition();
        found = "";
        foreach (targetgoal in targets)
        {
            targetPos = targetgoal.GetPosition();
            tr = TraceLine(sourcePos + sourceOffset, targetPos, null, TRACE.SHOT, GetLocalEntity(), false);
            if ( tr.fraction == 1 )
            {
                found += targetgoal.GetName() + " ";
            }
        }

        if ( found == "" )
        {
            Error( mapgoal.GetName(), "has zero visible targets!, try running /bot fgp" );
        }
        else
        {
            print( mapgoal.GetName(), "has visible targets", found );
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member DrawObjectiveInfoDisplays = function()
{
    for ( i = 64; i < 1024; i += 1 )
    {
        if (EntityIsValid(i) && GetEntClass(i) == CLASS.GOAL)
        {
            DrawEntityAABB( i, 60, COLOR.RED );
            center = GetEntWorldAABB(i).CenterPoint();
            DrawText3d(center, i + " : " + GetEntName(i) ,COLOR.WHITE,60,textDrawRadius);
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member DrawSpawns = function()
{
    for ( i = 64; i < 1024; i += 1 )
    {
        if (EntityIsValid(i) && GetEntClass(i) == CLASS.PLAYERSTART)
        {
            pos = GroundPoint(GetEntPosition(i));
            DrawLine(pos,pos+Vector3(0,0,64),COLOR.RED,60);
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member IsTeamDead = function(team, minbots, class)
{
    numalive = 0;
    // loop through the reserved player ents since there is no team table stored
    for ( i = 0; i < 64; i += 1 )
    {
        if (EntityIsValid(i) && GetEntTeam(i) == team
            && !GetEntFlags(i, ENTFLAG.DEAD, ENTFLAG.LIMBO) && (!class || GetEntClass(i)==class))
        {
            numalive += 1;
            if (!minbots)
            {
                return false;
            }
        }
    }

    if ( (minbots && numalive < minbots) || numalive == 0 )
    {
        return true;
    }
    else
    {
        return false;
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member IsTeamClassDead = function(team, class)
{
    return this.IsTeamDead(team, 0, class);
};

///////////////////////////////////////////////////////////////////////////////
// used for setting start indexes for goals that are pathing to offsets
member SetStartIndex = function( goalName, startIndex )
{
    startIndex = ToInt(startIndex, -1);
    g = GetGoal(goalName);
    if (g && g.Offsets) {
        offsetCount = tableCount(g.Offsets);
        if ( startIndex > offsetCount -1 ) {
            startIndex = -1; // random
        }

        g.StartIndex = startIndex;
    }
    else {
        Util.MapDebugPrint("ETUtil.SetStartIndex: Invalid Goal: " + goalName, 2);
    }
};

///////////////////////////////////////////////////////////////////////////////
// used for excluding indexes for goals that are pathing to offsets
// use null or an empty table to re-enable all
member SetExcludeIndexes = function( goalName, excludeTable )
{
    g = GetGoal(goalName);
    if (g && g.Offsets) {
        // passing null or an empty table will enable all
        if ( IsNull(excludeTable) ) {
            excludeTable = {};
        }

        if ( IsTable(excludeTable) ) {
            g.ExcludeIndexes = excludeTable;
        }
        else {
            Util.MapDebugPrint("ETUtil.ExcludeIndexes: Expecting table, got " + typeName(excludeTable), 2);
        }
    }
    else {
        Util.MapDebugPrint("ETUtil.ExcludeIndexes: Invalid Goal: " + goalName, 2);
    }
};

///////////////////////////////////////////////////////////////////////////////
// find a usable corpse starting from the body queue
member FindUsableCorpse = function(bot, range)
{
    // search through the body queue entities
    for ( i = 64; i < 71; i += 1 ) {
        corpse = GetEntityInSphere(bot.GetPosition(), range, CLASS.CORPSE, i);
        if ( corpse && bot.GetTeam() != GetEntTeam(corpse) ) {
            return corpse;
        }
        yield();
    }

    return null;
};

///////////////////////////////////////////////////////////////////////////////
//
member SetAimModeForMount = function(goalName, aimType)
{
    goal = Util.GetGoal(goalName, "ETUtil.SetAimModeForMount");
    if ( goal ) {
        if ( aimType == "opposite"
            || IsVec3(aimType)
            || IsTable(aimType)
            || aimType == "random"
            || aimType == "velocity" )
        {
            goal.AimMode = aimType;
            goal.ExtraDebugText = null; // update the render string
        }
        else {
            Util.MapDebugPrint("ETUtil.SetAimModeForMount: invalid aimType: " + aimType, 2 );
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member SuicideSpawn = function( team, spawn, numbots, class )
{
    c = 0;
    b = 0;

    foreach ( bot in BotTable )
    {
        if ( bot.GetTeam() == team )
        {
            b += 1;

            // every other bot to avoid low bot count numbers spawning all at a point
            if ( numbots && numbots != -1 && (b % 2 == 0) ) {
                continue;
            }

            // is it class limited?
            if ( class && bot.GetClass() != class ) {
                continue;
            }

            c += 1;

            bot.ChangeSpawnPoint( spawn );
            thread(ETUtil.SuicideNextSpawn, bot);

            if ( numbots && numbots != -1 && c >= numbots )
                { return; }
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member GetBotSideArm = function(bot)
{
    team = Util.TeamName(bot.GetTeam());

    if ( !Util.TeamSideArms[ team ] ) {
        return 0;
    }

    foreach ( id and weap in Util.TeamSideArms[ team ] ) {
        if ( bot.HasWeapon( weap ) ) {
            return weap;
        }
    }

    // shouldn't get here
    return 0;
};

///////////////////////////////////////////////////////////////////////////////
//
member GetBotPrimaryWeapon = function(bot, params)
{
    if (!params){
        params = { CheckCharged=false, CheckAmmo=false };
    }
    tbl = WeaponTable.GetPrimaryWeapons(bot.GetTeam(), bot.GetClass());
    if (tbl) {
         weap = bot.HasAnyWeapon(tbl, params);
         if (!weap) {
             weap = bot.HasAnyWeapon(Util.IndexedSniperWeapons, params);
         }
         return weap;
    }
    return 0;
};

///////////////////////////////////////////////////////////////////////////////
// note: this should be called via thread
member SuicideNextSpawn = function( bot )
{
    while( bot.GetReinforceTime() > 2 ) {
        yield();
    }

    bot.ExecCommand("kill");
};

///////////////////////////////////////////////////////////////////////////////
// some maps are set up for panzer wars
member PanzerMap = function( )
{
    this.IsPanzereMap = true;

    // reset the min class counts
    Util.InitializeClassTables();

    foreach ( name and teamId in TEAM )
    {
        if ( name != "SPECTATOR" )
        {
            Server.MinClassCount[teamId][CLASS.SOLDIER] = Server.MaxPlayers;
        }
    }

    foreach ( bot in BotTable )
    {
        this.ChangeToPanzer(bot); //also add to OnBotJoin
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member ChangeToPanzer = function( bot )
{
    if ( bot.GetClass() != CLASS.SOLDIER ) {
        bot.ChangeClass(CLASS.SOLDIER);
        yield();
    }
    if ( bot.GetTeam() == TEAM.ALLIES ) {
        bot.ChangePrimaryWeapon(WeaponTable.AlliedPanzer);
    } else {
        bot.ChangePrimaryWeapon(WEAPON.PANZERFAUST);
    }
};

///////////////////////////////////////////////////////////////////////////////
//
member DisableRifleNade = function( bot, disable )
{
    if (!bot ) { return; }

    foreach( weapon in { WEAPON.M7, WEAPON.GPG40 })
    {
        // get the weapon object
        w = bot.GetWeapon(weapon);
        if (!w) { Util.MapDebugPrint("ETUtil.DisableRifleNade: bot does not have rifle nade weapon", 2); continue; }

        // note: this will do nothing if weapon script sets default to 0.0
        // this is to avoid scripts like the plant goal stomping on user
        // defined settings.
        if ( disable ) {
            if ( w.PrimaryFire.DefaultDesirability > 0.1 ) {
                w.PrimaryFire.Bias = 0.0;
                w.PrimaryFire.SetDesirabilityRange(0, 2600, 0.0);
            }
        }
        else {
            if ( w.PrimaryFire.Bias < 0.1 ) {
                w.PrimaryFire.Bias = 1.0;
                w.PrimaryFire.SetDesirabilityRange(0, 2600, 0.8);
            }
        }
    }
};

///////////////////////////////////////////////////////////////////////////////
// randomly global chat some victory message
member WinningChat = function( team )
{
    Util.RandomChat(team, { VOICE.G_CHEER, VOICE.G_ENEMY_WEAK, VOICE.G_AFFIRMATIVE, VOICE.G_GOODGAME, VOICE.G_GREATSHOT });
};

// randomly global chat some displeasure about losing
member LosingChat = function( team )
{
    Util.RandomChat(team, { VOICE.G_NEGATIVE, VOICE.G_OOPS, VOICE.G_GOODGAME, VOICE.G_HOLD_FIRE });
};

///////////////////////////////////////////////////////////////////////////////
//
member CheckTripminePosition = function()
{
    // must be within 64 units of wall
    tr = Util.TraceFromPlayer(64, TRACE.SHOT);
    if ( tr.fraction >= 1.0 ) {
        return false;
    }

    // wire distance is max of 512 units
    tr2 = Util.TraceFromPlane(tr.end, tr.normal, 512);
    if ( tr2.fraction >= 1.0 ) {
        return false;
    }

    // original trace position is used for the goals aim position
    return tr.end;
};

///////////////////////////////////////////////////////////////////////////////
//DEPRECATE
member RandomSpawn = function( team, spawn )
{
    Util.MapDeprecateMessage( "ETUtil.RandomSpawn", "Util.RandomSpawn" );
    Util.RandomSpawn(team, spawn);
};

member ChangeSpawn = function( team, spawn, numbots )
{
    Util.MapDeprecateMessage( "ETUtil.ChangeSpawn", "Util.ChangeSpawn" );
    Util.ChangeSpawn(team, spawn, numbots);
};

member EnableGoal = function( goal )
{
    Util.MapDeprecateMessage( "ETUtil.EnableGoal", "Util.EnableGoal" );
    SetAvailableMapGoals( 0, true, goal );
};

member LimitGoal = function( team, goal )
{
    Util.MapDeprecateMessage( "ETUtil.LimitGoal", "Util.LimitGoal" );
    Util.LimitGoal(team, goal);
};

member DisableGoal = function( goal, routes )
{
    Util.MapDeprecateMessage( "ETUtil.DisableGoal", "Util.DisableGoal" );
    Util.DisableGoal(goal, routes);
};

member CountTeam = function( team )
{
    Util.MapDeprecateMessage( "ETUtil.CountTeam", "Server.Team[ teamId ].NumBots" );
    return Server.Team[team].NumBots;
};

member ShowActiveGoals = function(routes)
{
    Util.MapDeprecateMessage( "ETUtil.ShowActiveGoals", "Util.ShowActiveGoals" );
};

member ChangeClass = function( team, originalclass, newclass, revert, maxbots )
{
    Util.MapDeprecateMessage( "ETUtil.ChangeClass", "Server.MinClassCount" );
};

member LimitToClass = function( goalname, team, class1, class2, class3, class4 )
{
    Util.MapDeprecateMessage( "ETUtil.LimitToClass", "Util.LimitToClass" );
    Util.LimitToClass(goalname, team, class1, class2, class3, class4);
};

member ExcludeClass = function( goalname, team, class1, class2, class3, class4 )
{
    Util.MapDeprecateMessage( "ETUtil.ExcludeClass", "Util.ExcludeClass" );
    Util.ExcludeClass(goalname, team, class1, class2, class3, class4);
};
 

 

et_classmanager.gm

Spoiler

// class management functions. used by goal_classmanager.gm but moved
// here for flexibility

// server_manager expects Util
Util.ManageClasses = true;

member UpdateClasses = function(team)
{
    // reset counters
    foreach (class in Util.PlayerClassTable)
    {
        Server.ClassCount[team][class] = 0;
    }

    // random delay (many bots can die at the same time)
    // cs: this should not matter since everything is run sequentially
    // plus it breaks execution in death event.
    //sleep(RandFloat(0, 0.5));

    // count humans too
    for ( i = 0; i <= Server.NumPlayers; i += 1 )
    {
        if (EntityIsValid(i) && GetEntTeam(i) == team)
        {
            class = GetEntClass(i);
            if (class)
            {
                if (Server.ClassCount[team][class] < 1)
                {
                    Server.ClassCount[team][class] = 1;
                }
                else
                {
                    Server.ClassCount[team][class] += 1;
                }
            }
        }
    }
};

member EvaluateClass = function(team, class, num)
{
    min = Server.MinClassCount[team][class];
    if (!min)
    {
        min = -99; // get rid of 0 min count classes first
    }
    if (!num)
    {
        num = -20; // prioritize classes that have no players
        if (class==CLASS.ENGINEER){ num -= 1; }
    }
    return min-num;
};

member EvalClassChange = function(bot)
{
    // update class counts
    team = bot.GetTeam();
    ClassManager.UpdateClasses(team);

    //evaluate this bot
    botClass = bot.GetClass();
    botEval = ClassManager.EvaluateClass(team, botClass, Server.ClassCount[team][botClass] - 1);
    isDead = GetEntFlags(bot.GetGameEntity(), ENTFLAG.DEAD, ENTFLAG.LIMBO);

    //evaluate all classes
    newClass = null;
    foreach ( class and num in Server.ClassCount[team] )
    {
        if (class!=botClass) // don't change to same class
        {
            eval = ClassManager.EvaluateClass(team, class, num);
            if (eval >= botEval && (eval > botEval || isDead && RandInt(0,3)==0) )
            {
                botEval = eval;
                newClass = class;
            }
        }
    }

    return newClass;
};

// used for adding new bots
member EvalClassByTeam = function(team)
{
    ClassManager.UpdateClasses(team);

    newClass = RandInt(CLASS.SOLDIER, CLASS.SOLDIER); //<--- Changed from Covertops

    botEval = 0;
    foreach ( class and num in Server.ClassCount[team] )
    {
        eval = ClassManager.EvaluateClass(team, class, num);
        if (eval > botEval)
        {
            botEval = eval;
            newClass = class;
        }
    }

    return newClass;
};
 

 

et_weapontables.gm

Spoiler

// weapon selection functions and tables

global WeaponTable = {};
global PrimaryWeaponChoices = {};
PrimaryWeaponChoices[TEAM.AXIS] = {};
PrimaryWeaponChoices[TEAM.ALLIES] = {};

// mod detection
modName = GetModName();
isNq = modName == "noquarter";
isEtnam = modName == "etpub" && GetCvar("g_etnamFlags") > 0;
isSilentMod = modName == "silEnT";
isJaymod = modName == "Jaymod";
isNitmod = modName == "nitmod";
isETblight = modName == "etblight";
isBastard = modName == "bastardmod";
isLegacy = modname == "legacy";

///////////////////////////////////////////////////////////////////////////////////////////
// TABLES
///////////////////////////////////////////////////////////////////////////////////////////

////////////////////
// secondary weapons
////////////////////
Util.TeamSideArms =
{
    AXIS =
    {
        WEAPON.LUGER,
        WEAPON.LUGER_SILENCED,
        WEAPON.LUGER_AKIMBO,
        WEAPON.LUGER_AKIMBO_SILENCED,
        WEAPON.REVOLVER,
    },

    ALLIES =
    {
        WEAPON.COLT,
        WEAPON.COLT_SILENCED,
        WEAPON.COLT_AKIMBO,
        WEAPON.COLT_AKIMBO_SILENCED,
        WEAPON.REVOLVER,
    },
};

////////////////////
// sniper weapons
////////////////////
Util.SniperWeapons =
{
    //these values are for bot.HasWeapon
    WEAPON.FG42_SCOPE,
    WEAPON.K43_SCOPE,
    WEAPON.GARAND_SCOPE,
};

Util.TeamSniperWeapons =
{
    //these values are for bot.ChangePrimaryWeapon
    AXIS =
    {
        WEAPON.K43,
    },

    ALLIES =
    {
        WEAPON.GARAND,
    },
};
if (!isNq) {
    Util.TeamSniperWeapons["ALLIES"][1] = WEAPON.FG42;
}
if (GetModName() == "etpub" && GetCvar("g_etnamFlags") > 0) {
    Util.AddToTable(Util.SniperWeapons, WEAPON.SAK47SCOPED);
    Util.TeamSniperWeapons["AXIS"][1] = WEAPON.SAK47;
} else {
    Util.TeamSniperWeapons["AXIS"][1] = WEAPON.FG42;
}
if (GetModName() == "etblight") {
    Util.AddToTable(Util.SniperWeapons, WEAPON.PROTO);
    Util.AddToTable(Util.SniperWeapons, WEAPON.MP40SS);
    // TeamSniperWeapons are only for COVERTOPS
    Util.TeamSniperWeapons["AXIS"][2] = WEAPON.PROTO;
    Util.TeamSniperWeapons["ALLIES"][2] = WEAPON.PROTO;
}
if (GetModName() == "bastardmod") {
    Util.AddToTable(Util.SniperWeapons, WEAPON.BASTARD_FG42_SCOPE);
}

////////////////////
// soldiers weapons
////////////////////
tbl1 = {};
tbl1[WEAPON.PANZERFAUST] = false; //RPG
tbl1[WEAPON.MOBILE_MG42] = false;
tbl1[WEAPON.FLAMETHROWER] = false;
tbl1[WEAPON.MORTAR] = true;
tbl2 = {};
tbl2[WEAPON.MOBILE_MG42] = false; //MOBILE_BROWNING
tbl2[WEAPON.FLAMETHROWER] = false;
tbl2[WEAPON.MORTAR] = true;

if (isNq) {
    if (GetCvar("jp_insanity") & 256) {
        // if allowed, add venom to the list.
        tbl1[WEAPON.VENOM] = false;
        tbl2[WEAPON.VENOM] = false;
    }
    tbl1[WEAPON.STG44] = false;
    tbl2[WEAPON.BAR] = false;
}else{
    if (isEtnam) {
        tbl1[WEAPON.M79] = true;
        tbl2[WEAPON.M79] = true;
        tbl1[WEAPON.ITHACA] = false;
        tbl2[WEAPON.ITHACA] = false;
        WeaponTable.AlliedPanzer = WEAPON.LAW;
    }else{
        WeaponTable.AlliedPanzer = WEAPON.PANZERFAUST;
    }
    tbl1[WEAPON.MP40] = false;
    tbl2[WEAPON.THOMPSON] = false;
}
if(WEAPON.BAZOOKA){ WeaponTable.AlliedPanzer = WEAPON.BAZOOKA; } //NoQuarter or Legacy

tbl2[WeaponTable.AlliedPanzer] = false;

if (isJaymod) {
    // cs: shouldn't these be enabled?
    tbl1[WEAPON.M97] = false;
    tbl2[WEAPON.M97] = false;
}
if (isSilentMod && GetCvar("g_classWeapons") & 1) {
    // TODO: handle mod version with next release of silEnT
    tbl1[WEAPON.PPSH] = true;
    tbl2[WEAPON.PPSH] = true;
}
if (isETblight) {
    tbl1[WEAPON.DESTROYER] = true;
    tbl2[WEAPON.DESTROYER] = true;
    tbl1[WEAPON.SAW] = false;
    tbl2[WEAPON.SAW] = false;
}
if (isBastard) {
    tbl1[WEAPON.BASTARD_FG42] = true;
    tbl2[WEAPON.BASTARD_FG42] = true;
    tbl1[WEAPON.MINIGUN] = true;
    tbl2[WEAPON.MINIGUN] = true;
}
PrimaryWeaponChoices[TEAM.AXIS][CLASS.SOLDIER] = tbl1;
PrimaryWeaponChoices[TEAM.ALLIES][CLASS.SOLDIER] = tbl2;

/////////////////////
// covertops weapons
/////////////////////
tbl1 = {};
tbl1[WEAPON.K43] = true; //DRAGUNOV
tbl2 = {};
tbl2[WEAPON.GARAND] = true; //M21 RIFLE
tbl2[WEAPON.STEN] = true;

if (isEtnam) {
    tbl1[WEAPON.SAK47] = true;
    tbl1[WEAPON.RPD] = true;
    tbl2[WEAPON.M3A1] = true;
}else{
    tbl1[WEAPON.FG42] = true;
}
if (isNq) {
    tbl1[WEAPON.MP34] = true;
    tbl2[WEAPON.BAR] = true;
}else{
    tbl1[WEAPON.STEN] = true;
    tbl2[WEAPON.FG42] = true; //M16 SCOPED
}
if (isETblight) {
    tbl1[WEAPON.PROTO] = true;
    tbl2[WEAPON.PROTO] = true;
    tbl1[WEAPON.BSMG2] = true;
    tbl2[WEAPON.BSMG2] = true;
}
if (isBastard) {
    tbl1[WEAPON.MP28] = true;
    tbl2[WEAPON.MP28] = true;
    tbl1[WEAPON.MADSEN] = true;
    tbl2[WEAPON.MADSEN] = true;
}
PrimaryWeaponChoices[TEAM.AXIS][CLASS.COVERTOPS] = tbl1;
PrimaryWeaponChoices[TEAM.ALLIES][CLASS.COVERTOPS] = tbl2;

///////////////////
// common weapons
//////////////////
foreach (class in { CLASS.MEDIC, CLASS.ENGINEER, CLASS.FIELDOPS } )
{
    tbl1 = {};
    tbl1[WEAPON.MP40] = true; //AK-47
    tbl2 = {};
    tbl2[WEAPON.THOMPSON] = true; //M16

    if (isEtnam) {
        WeaponTable.Shotgun = WEAPON.ITHACA;
        tbl1[WEAPON.ITHACA] = true;
        tbl2[WEAPON.ITHACA] = true;
        tbl1[WEAPON.RPD] = true;
        tbl2[WEAPON.M3A1] = true;
    }
    if (isNq && class!=CLASS.MEDIC) {
        WeaponTable.Shotgun = WEAPON.SHOTGUN;
        tbl1[WEAPON.SHOTGUN] = true;
        tbl2[WEAPON.SHOTGUN] = true;
    }
    if (isJaymod) {
        WeaponTable.Shotgun = WEAPON.M97;
        tbl1[WEAPON.M97] = true;
        tbl2[WEAPON.M97] = true;
    }
    if (isSilentMod || isNitmod) {
        tbl1[WEAPON.THOMPSON] = true;
        tbl2[WEAPON.MP40] = true;
    }
    if (isNitmod && (GetCvar("g_weapons") & 512) && class!=CLASS.ENGINEER) {
        tbl1[WEAPON.STEN] = true;
        tbl2[WEAPON.STEN] = true;
    }
    if (isETblight) {
        tbl1[WEAPON.MP41] = true;
        tbl2[WEAPON.MP41] = true;
        tbl1[WEAPON.BSMG2] = true;
        tbl2[WEAPON.BSMG2] = true;
        tbl1[WEAPON.MADSEN] = true;
        tbl2[WEAPON.MADSEN] = true;
        if (class!=CLASS.ENGINEER) {
            tbl1[WEAPON.THOMPSON] = true;
            tbl2[WEAPON.MP40] = true;
        }
    }
    if (isBastard) {
        tbl1[WEAPON.MP28] = true;
        tbl2[WEAPON.MP28] = true;
        tbl1[WEAPON.SCROOGE] = true;
        tbl2[WEAPON.SCROOGE] = true;
        tbl1[WEAPON.MADSEN] = true;
        tbl2[WEAPON.MADSEN] = true;
    }
    PrimaryWeaponChoices[TEAM.AXIS][class] = tbl1;
    PrimaryWeaponChoices[TEAM.ALLIES][class] = tbl2;
}

/////////////////////
// engineer weapons
/////////////////////
tbl1 = PrimaryWeaponChoices[TEAM.AXIS][CLASS.ENGINEER];
tbl2 = PrimaryWeaponChoices[TEAM.ALLIES][CLASS.ENGINEER];
tbl1[WEAPON.KAR98] = true;
tbl2[WEAPON.CARBINE] = true;

if (isEtnam) {
    tbl1[WEAPON.M79] = true;
    tbl2[WEAPON.M79] = true;
}
if (isSilentMod && GetCvar("g_classWeapons") & 2 ) {
    tbl1[WEAPON.PPSH] = true;
    tbl2[WEAPON.PPSH] = true;
}
if (isETblight) {
    tbl1[WEAPON.PPSH41] = true;
    tbl2[WEAPON.PPSH41] = true;
}
if (isBastard) {
    tbl1[WEAPON.TOKAREV] = true;
    tbl2[WEAPON.TOKAREV] = true;
}

/////////////////////
// fieldops weapons
/////////////////////
tbl1 = PrimaryWeaponChoices[TEAM.AXIS][CLASS.FIELDOPS];
tbl2 = PrimaryWeaponChoices[TEAM.ALLIES][CLASS.FIELDOPS];
if (isSilentMod && GetCvar("g_classWeapons") & 4 ) {
    tbl1[WEAPON.PPSH] = true;
    tbl2[WEAPON.PPSH] = true;
}


if (isETblight)
{
    /////////////////////
    // scientist weapons
    /////////////////////
    tbl1 = {};
    tbl1[WEAPON.Q3X1] = true;
    tbl1[WEAPON.PPSH41] = true;
    tbl1[WEAPON.STEN] = true;
    tbl1[WEAPON.MP40SS] = true;
    PrimaryWeaponChoices[TEAM.AXIS][CLASS.SCIENTIST] = tbl1;
    PrimaryWeaponChoices[TEAM.ALLIES][CLASS.SCIENTIST] = tableDuplicate(tbl1);

    /////////////////////
    // super soldier weapons
    /////////////////////
    tbl1 = {};
    tbl1[WEAPON.MORTAR] = true;
    tbl1[WEAPON.MORTAR] = true;
    PrimaryWeaponChoices[TEAM.AXIS][CLASS.SUPER_SOLDIER] = tbl1;
    PrimaryWeaponChoices[TEAM.ALLIES][CLASS.SUPER_SOLDIER] = tableDuplicate(tbl1);
}

///////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////

WeaponTable.SetWeaponTeamAvailability = function(team, class, weapon, enable)
{
    if (IsNull(class)) {
        foreach (classId in Util.PlayerClassTable) {
            this.SetWeaponTeamAvailability(team, classId, weapon, enable);
        }
        return;
    }

    classTable = PrimaryWeaponChoices[team][class];
    if (!classTable) {
        Util.MapDebugPrint("WeaponTable.SetWeaponAvailabilty: No weapon table for class " + Util.ClassName(class), true);
        return;
    }

    if ( typeName(weapon) == "table" ) {
        foreach ( wpn in weapon ) {
            this.SetWeaponTeamAvailability(team, class, wpn, enable);
        }
        return;
    }

    if (weapon == WEAPON.PANZERFAUST && team == TEAM.ALLIES) {
        weapon = WeaponTable.AlliedPanzer;
    }
    if (GetModName() == "noquarter") {
        if (team == TEAM.AXIS && weapon == WEAPON.STEN) {
            weapon = WEAPON.MP34;
        }
    }

    if (!IsNull(classTable[weapon])) { // enable only weapons which are permitted for this team and class
        classTable[weapon] = enable;
    }
};

/*
    WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, WEAPON.FLAMETHROWER, false );
    WeaponTable.SetWeaponAvailability( CLASS.SOLDIER, {WEAPON.MORTAR, WEAPON.MOBILE_MG42}, true);
*/
WeaponTable.SetWeaponAvailability = function(class, weapon, enable)
{
    WeaponTable.SetWeaponTeamAvailability(TEAM.AXIS, class, weapon, enable);
    WeaponTable.SetWeaponTeamAvailability(TEAM.ALLIES, class, weapon, enable);
};

WeaponTable.GetPrimaryWeapons = function(team, class)
{
    return PrimaryWeaponChoices[team][class];
};

// for debug
WeaponTable.ListWeaponAvailability = function()
{
    print("\n//////////// Weapon Availability ////////////");
    foreach ( team and tbl in PrimaryWeaponChoices )
    {
        print(format("\n Team: %s", Util.TeamName(team)));
        foreach ( id and class in tbl) {
            print(format("\n------ %s ------", Util.ClassName(id)));

            foreach ( w and e in class ) {
                print(format("%s = %d", Util.WeaponName(w), e));
            }
        }
    }
};
 

 

 

  • Like 1
Link to comment
Share on other sites

9 hours ago, Buckwild said:

Or ask at Splasdamage Forums: How to make a mortar only map. https://forums.splashdamage.com/
Enemy Territory map: glider_panzerduel_101 by 2Bit (2008) has only panzers as weapons in the map...

 

Omni-Bots support sniper and panzer script

 

easy to make sniper and panzer maps

 

but... not for mortar map

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.