ineedbots / iw4_bot_warfare

The Bot Warfare mod for MW2
https://www.moddb.com/mods/bot-warfare
106 stars 25 forks source link

Option to disable CoD4 guns #29

Closed ghost closed 2 years ago

ghost commented 2 years ago

I dont know whether this is related to your mod or IW4X, but bots are using guns from CoD 4 and its annoying. Please give us option to disable those guns so bots can only use the vanilla (base game) guns. Also nerf those bloody quick scopes. I swear bots can make a montage of how they quick scope me with that M40A3 from cod4.

HarleySalas commented 2 years ago

If you go to your mods/bots folder and open the z_svr_bots.iwd with winrar/7-zip and then proceed to navigate to maps/mp/bots/ and open _bot_script.gsc with a text editor (code editor like vscode preferred), you can change a couple of lines to get rid of them.

ctrl+f/find the following function: chooseRandomPrimary()

You'll see the following code within it: ` if (!allowOp) { if (primary == "riotshield") continue;
}

    if (reasonable)
    {
        if (primary == "riotshield")
            continue;
        if (primary == "wa2000")
            continue;
        if (primary == "uzi")
            continue;
        if (primary == "sa80")
            continue;
        if (primary == "fn2000")
            continue;
        if (primary == "m240")
            continue;
        if (primary == "mg4")
            continue;
    }

    if (!self isItemUnlocked(primary))
        continue;

    return primary;

`

the if (!allowOp) and if (reasonable) lines determine that those guns will not be allowed to be added to the pool of guns that will randomly be chosen by a bot, in any instance that you've decided to either disable op weapons, or only allow reasonable weapons. I chose to add the code disabling guns in to the reasonable option, so that any time I only allow reasonable guns to be used, the cod4 guns will be removed. You could also place the code outside of the if statements to disable them entirely. you can replace the original function with the following to copy the same behavior as I've chosen:

` chooseRandomPrimary() { primaries = getPrimaries(); allowOp = (getDvarInt("bots_loadout_allow_op") >= 1); reasonable = getDvarInt("bots_loadout_reasonable");

while (true)
{
    primary = random(primaries);

    if (!allowOp)
    {
        if (primary == "riotshield")
            continue;   
    }

    if (reasonable)
    {
        if (primary == "riotshield")
            continue;
        if (primary == "wa2000")
            continue;
        if (primary == "uzi")
            continue;
        if (primary == "sa80")
            continue;
        if (primary == "fn2000")
            continue;
        if (primary == "m240")
            continue;
        if (primary == "mg4")
            continue;
        if (primary == "ak74u")
            continue;
        if (primary == "peacekeeper")
            continue;
        if (primary == "m40a3")
            continue;
        if (primary == "ak47classic")
            continue;
        if (primary == "dragunov")
            continue;
    }

    if (!self isItemUnlocked(primary))
        continue;

    return primary;
}

} `