Giter Club home page Giter Club logo

left4bots's Introduction

Left 4 Bots 2

This is a complete rework of Left 4 Bots (v1). It has pretty much the same functionalities of the V1 but they have been improved, plus some new functionalities have been added.

Please note: the goal of Left 4 Bots has always been to make the survivor bots more human-like, not to turn them into super zombie killing machines.

The addon gives them some functions that the vanilla AI was missing, like defib dead players, scavenge gascans, deadstop special intefected etc, so their combat capabilities are also improved but they can also fail and fu** things up, sometimes. But isn't this part of the human behavior? 😛

Despite the use of the term AI there is no real AI/machine learning algorithm, it's just a bunch of if then else, so do not expect them to start learning and eventually become self-conscious and do things on their own acting perfectly in every situation.

What changed?

Almost everything. The bots are more active while executing the orders, they can attack and shove infected and scavenge items. The lead order has been completely reworked and it will work on most maps, including finales. Now you can order each bot to follow another survivor or to go and hold a certain position. Bots have weapon preferences you can change. And more.

For more details, please check the videos i made about L4B2 on my Youtube Channel.

Addon settings

The list of L4B2 settings can be found HERE.

You can change the settings by editing the file ems/left4bots2/cfg/settings.txt or directly ingame with the following commands:

  • Via chat: !l4b settings [setting] [value]
  • Via console: scripted_user_func l4b,settings,[setting],[value]

Addon commands

The list of L4B2 commands can be found HERE and can be seen HERE.

Want to customize the addon even further

and you know a bit about VScript?

Create a file named left4bots_afterload.nut and one named left4bots_afterinit.nut into the script/vscript directory and put only the L4B2 code you want to change in there.

left4bots_afterload.nut is automatically called by L4B2 right after its .nut files are loaded and before the L4B2 settings are loaded and the addon fully initialized.

Here you can put the L4B2 functions you want to modify so your modified version will overwrite the base one.

For example if you want to change the logic to decide whether the bot is about to use meds, you simply add this function to the file with your own changes:

::Left4Bots.BotWillUseMeds <- function (bot)
{
	local totalHealth = bot.GetHealth() + bot.GetHealthBuffer();
	if (totalHealth >= 55) // <- look, i changed 45 to 55 because for me it's better
		return false;
	
	(...)
}

left4bots_afterload.nut is also called before the VScript __CollectEventCallbacks, so you can even alter the events here, like:

::Left4Bots.Events.OnGameEvent_round_start <- function (params)

and you can alter the Left 4 Lib functions as well, if you need to.

left4bots_afterinit.nut is called after the addon loaded the settings and finished its initialization. Here, for example, you can force your values to the addon settings:

Left4Bots.Settings.handle_l4d1_survivors = 1;
// ... or do whatever you want to do after the addon initialization

You aren't forced to add both the .nut files, only the one you use.

Now, if you want, you can pack your .nut files and upload your addon to the workshop adding both Left 4 Bots 2 and Left 4 Lib as required addons.

This is better than duplicating the L4B2 files into your addon because this way you aren't creating conflicting addons, the end user will be able to switch between normal L4B2 and your version simply by enabling/disabling your addon in the addon list and (potentially) you won't need to update your addon every time i update mine.

left4bots's People

Contributors

legurdah avatar smilz0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

left4bots's Issues

Workaround for vocalizer issue with 8+ survivor bots

If using the "VScript Survivor Manager" add bots which has same Actor name, the vocalizer function will become confused.

A simple example, if my character is "Nick", and look at another "Nick" bot, the vocalizer order does not work.

The reason is that "concepts system" will only tell us Actor name of "who" and "subject", so I thought if I add "userid" for them, is that could solve the problem of the same Actor name?

Use DoEntFire("!self", "AddContext", "whoid:"+player.GetPlayerUserId(), 0, null, player); to add the id, yeah, it does work, i can use GetPlayerFromUserID(id) get player easily.
But at the same time I found, I don't know how to add "subjectid" for "subject". :(

So, to solve this problem, there are two points:

  1. Add "whoid" and "subjectid".
  2. Prevent deleted by DoEntFire("!self", "ClearContext", "", 0, null, player).

Do you think this idea is feasible?

If only the TLS team could add this just like they did with "TankActive" and "Chapter" in the last update. ;P

SHOVE improvements

Make the bots prioritize the melee over the shove and don't shove if the bot is already firing its gun (to confirm if the latter is really an improvement tho).

Improvements to the pickup and move algorithms

  • Add 0x8 (CONTENTS_GRATE) to the trace mask for the pickup items to fix the problem with the bots trying to get the weapons on Questionable Ethics campaigns before pouring the gascan to the thing.

  • Move the dest pos of each BotMoveTo() to the nearest nav area. This also fixes a problem on Questionable Ethics with the items inside the holes on the wall and the bots incorrectly pathing behind the wall to get the item. Also reduces the chance of getting stuck in general.

Add the game mode to the settings overrides file name

New search order:

1. settings_[map]_[difficulty]_[mode].txt
2. settings_[difficulty]_[mode].txt
3. settings_[map]_[mode].txt
4. settings_[mode].txt
5. settings_[map]_[difficulty].txt
6. settings_[difficulty].txt
7. settings_[map].txt

Search stops at the first file found.

Bots float when executing 'wait' order on elevators

Set "movetype" makes bots do nothing,

NetProps.SetPropInt(self, "movetype", 0);

but set "m_fFlags" can solve the problem,

ATCONTROLS = 64; // Player can't move, but keeps key inputs for controlling another entity
NetProps.SetPropInt(self, "m_fFlags", NetProps.GetPropInt(self, "m_fFlags") | ATCONTROLS);

and also need this to prevent bot Teleport

Convars.SetValue("sb_unstick", 0);

Left 4 Bots 2 temporary heal command

Describe the bug
Version 1 has a 'bot tempheal' command in addition to just 'heal'. I have looked and can't find a similar option in version 2

To Reproduce
Steps to reproduce the behavior:
'bot tempheal'
scripted_user_func l4b,bots,tempheal

Expected behavior
Bot uses a temporary heal item

Allow 2 different l4b commands for the same vocalizer line

Change the vocalizer.txt binding file in order to let the user map 2 different commands on the same vocalizer line, one for the line without the bot selection and one with the bot selection... pretty much like L4B1 does with the "Lead On" line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.