AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Defib using Bots (Updated 09-25-2020) (https://forums.alliedmods.net/showthread.php?t=261566)

DeathChaos25 04-15-2015 15:41

[L4D2] Defib using Bots (Updated 09-25-2020)
 
1 Attachment(s)
About : Ever tired of dying, when a survivor bot has a defib, and the game just goes on without you because bots won't defib you? Well, No more!

How it works :
This plugin scans the map for any survivor death models, after it finds one, if certain criterias are met, a bot with a defib will then be forced to walk up to the dead body, then he is forced to aim at the dead body, take out his defib, and use +ATTACK to successfully defib a dead survivor.

Video Demonstration here

The criterias for bots to defib survivors are as following :
1) There is distance limit, we don't want bots going halfway across the map just to defib one person
2) No survivors must need help (IE Trapped by a SI, incapacitated or hanging from a ledge)
3) There must be no visible threats to the survivor bots for them to accomplish this
Spoiler


Admin Commands (Added in Version 1.3 and 1.4, Root access required) :
sm_regroup - Orders all survivor bots to regroup and move to where the person who issued this command is located
sm_resetbots - Resets all bots and interrupts their current action.
sm_retreat - Orders all survivor bots to retreat from the special infected you are currently aiming at
sm_attack - Orders all survivor bots to focus and attack the special infected you are currently aiming at

Note that these 2 commands also have the same limitations put into place as the defib usage on bots


Code:

Version 1.0    04-15-2015 (55 views)
- Initial Release

Version 1.1  04-16-2015 (16 views)
- Improved the AI a bit
- Fixed a bug where in certain situations the bots would shoot non stop

Version 1.2  04-17-2015 (42 views)
- Fixed an oversight where bots would never stop swinging melee weapons
- Added defib tracking for bots into the plugin!

Version 1.3  04-18-2015 (33 views)
- Fixed an oversight where in certain odd conditions bots would not heal
- Added 2 new admin commands to control bots! (Root access required)

Version 1.4  04-19-2015 (99 views)
- Fixed an Invalid Client Array Issue in a timer
- Added sm_retreat and sm_attack admin commands

Version 1.5  04-29-2015 (297 views)
- Small Code Cleanup to make plugin more easily readble
- Completely new system is being used for defib pickup (left4dowtown2 is needed for it to work!)
- As a result, if the defib pickup function is desired, left4downtown2 is needed (Plugin will work without downtown, but bots will not pick up defibs)

Version 1.6  06-24-2015 (15543 views)
- Fixed a small oversight where bots would attempt to pick up a defib another person had already picked up, resulting in them never picking up any other defibs (thanks to yurikon for pointing it out!)

Version 1.7  09-25-2020
- Small update, completely removed code for bots picking up defibs that relied on Left4downtown, it is encouraged to run gear transfer instead.

To DO :
Code:

- Requests(?)
Thanks to dcx2 for suggesting "use weapon_defibrillator" !

It is suggested you run Gear Transfer!

If there is an instance where the bots go all dumb and defib people while ignoring zombies please let me know, as this shouldn't be the case.


starstrucktiger 04-15-2015 16:13

Re: [L4D2] Defib using Bots
 
Incredible. Love it!

Now if we can get those pesky bots to throw grenades ;)

DeathChaos25 04-15-2015 16:16

Re: [L4D2] Defib using Bots
 
Quote:

Originally Posted by starstrucktiger (Post 2286627)
Incredible. Love it!

Now if we can get those pesky bots to throw grenades ;)

Uh, trust me, we want anything BUT that...

starstrucktiger 04-15-2015 16:23

Re: [L4D2] Defib using Bots
 
Quote:

Originally Posted by DeathChaos25 (Post 2286632)

Yeah I can just imagine all the idiotic throws they'd end up doing

leonardo martinez 04-15-2015 16:45

Re: [L4D2] Defib using Bots
 
Ooooh this looks nice! :)

DeathChaos25 04-16-2015 22:09

Re: [L4D2] Defib using Bots (Updated 04-16-2015)
 
Alright, so I noticed that bots sometimes would randomly hold down the trigger and not stop, so I decided to fix that by adding multiple checks, also eased up a little bit on the distance restriction.

DeathChaos25 04-17-2015 12:20

Re: [L4D2] Defib using Bots (Updated 04-17-2015)
 
So, I noticed that because of the way the plugin forces the bots to use defibs, they would sometimes never stop swinging melee weapons, this has been fixed!

I also noticed that for some reason, Gear Transfer isn't correctly forcing bots to pick up defibs most of the time, so I added my very own defib check into this plugin so that bots will now pick up defibs too!

Do note that if you drop a defib, under some very specific odd circumstances, the defib may be visually stuck in the air, don't worry as the defib can still be picked up and used normally, this is just a side effect of how the bots are forced to pick up defibs.

Marcus101RR 04-17-2015 15:18

Re: [L4D2] Defib using Bots
 
Quote:

Originally Posted by DeathChaos25 (Post 2286632)

My L4D 1 server has that feature where bots CAN throw grenades. It is not perfect, but it is based on stress level from infected, if it gets too high, a bot will throw their grenade, this includes molly. You would require alot more checks to make it safe:
  • Check if bot has grenade
  • Check if the stress level of that bot reached threshhold
  • is a target infected available
  • If target, is it far away?
  • if far away, is it in plain sight?
  • If in plain sight, is it targeting?

A. If pipebomb, throw it regardless of wall.

B. If molotov, lets make sure it lands where it aims.

Very difficulty, but possible with alot of coding

DeathChaos25 04-17-2015 16:02

Re: [L4D2] Defib using Bots
 
Quote:

Originally Posted by Marcus101RR (Post 2287353)
My L4D 1 server has that feature where bots CAN throw grenades. It is not perfect, but it is based on stress level from infected, if it gets too high, a bot will throw their grenade, this includes molly. You would require alot more checks to make it safe:
  • Check if bot has grenade
  • Check if the stress level of that bot reached threshhold
  • is a target infected available
  • If target, is it far away?
  • if far away, is it in plain sight?
  • If in plain sight, is it targeting?

A. If pipebomb, throw it regardless of wall.

B. If molotov, lets make sure it lands where it aims.

Very difficulty, but possible with alot of coding

Yeah, I plan on eventually doing this, with a LOT of limitations and checks.
I will be specifically heavy on the limitations with molotovs, since on Expert a single molly can wipe every survivor very easily.

They easily use grenades by themselves too, you just need to force them as their active weapon.

bazrael 04-17-2015 22:15

Re: [L4D2] Defib using Bots (Updated 04-17-2015)
 
Let's think about a possible case:
Tank kills a player and another bot survivor. Only one alive bot HAL9000 carrying a defibrillator and saves dead bot!

Now we Left player 4 Dead. T-T


All times are GMT -4. The time now is 01:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.