Raised This Month: $ Target: $400
 0% 

[L4D2]prevent bots from replacing tank player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_Mazare
New Member
Join Date: Apr 2023
Old 04-15-2023 , 23:57   [L4D2]prevent bots from replacing tank player
Reply With Quote #1

is there any way to prevent bots taking over tank players when frustration reaches 0 and
reset tank frustration to 100 when tank frustration reaches 0.

any ideas?

Last edited by _Mazare; 04-16-2023 at 05:24.
_Mazare is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-16-2023 , 00:01   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #2

There are ConVars for this.
The "master" would be z_frustration, and z_frustration_* controls everything else.
"*" being the rest of the ConVars.

They're all marked as cheats, though.
So you'll have to use this: "sm_cvar z_frustration 0".
TotalChaos SourcePawner is offline
_Mazare
New Member
Join Date: Apr 2023
Old 04-16-2023 , 05:04   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #3

it just deactivates the frustration tank.

what I actually want is to reset tanks frustrated to 100 when the frustrated tanks reach 0 and prevent bots from replace tank player.
_Mazare is offline
_Mazare
New Member
Join Date: Apr 2023
Old 04-16-2023 , 05:48   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #4

Sorry for the previous message. If I didn't communicate it clearly, I have edited it.
_Mazare is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-16-2023 , 10:17   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #5

Why would you want to reset it to 100?
By turning it off, Tank bots never replace Tank players.

I don't know of any way to reset it to 100 after it hits zero.
But through editing some ConVar values, you could probably make it go down a bit slower,
almost as if it was at 200 or 300 instead.
I don't usually mess with those ConVars, though.
So I don't know what exact combination you would need to do that.
TotalChaos SourcePawner is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 04-17-2023 , 00:08   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #6

Use L4D_OnTryOfferingTankBot from left4dhooks

PHP Code:
public Action L4D_OnTryOfferingTankBot(int tank_indexbool &enterStasis)
{
    if (
tank_index && IsClientInGame(tank_index) && !IsFakeClient(tank_index))
    {
        
PrintToChatAll("%N tank player gets full frustration"tank_index);
        
SetEntProp(tank_indexProp_Send"m_frustration"0);
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;

__________________

Last edited by HarryPotter; 04-17-2023 at 00:32.
HarryPotter is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-17-2023 , 19:01   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #7

Quote:
Originally Posted by HarryPotter View Post
Use L4D_OnTryOfferingTankBot from left4dhooks

PHP Code:
public Action L4D_OnTryOfferingTankBot(int tank_indexbool &enterStasis)
{
    if (
tank_index && IsClientInGame(tank_index) && !IsFakeClient(tank_index))
    {
        
PrintToChatAll("%N tank player gets full frustration"tank_index);
        
SetEntProp(tank_indexProp_Send"m_frustration"0);
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;

Kinda off-topic, but wouldn't that redefine it? Causing errors if you include "left4dhooks" or "left4dhooks_stocks"?
I tried something similar one time, and the compiler just told me that I was redefining it, and threw an error.
EDIT: Nevermind. It's working for me now. No idea what I was doing wrong with my code, because now it just works and I barely changed anything.

Last edited by TotalChaos SourcePawner; 04-18-2023 at 01:16.
TotalChaos SourcePawner is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 04-18-2023 , 01:56   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #8

Quote:
Originally Posted by TotalChaos SourcePawner View Post
Kinda off-topic, but wouldn't that redefine it? Causing errors if you include "left4dhooks" or "left4dhooks_stocks"?

LOL, you first time write the SourcePawn program?
__________________
HarryPotter is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-18-2023 , 11:50   Re: [L4D2]prevent bots from replacing tank player
Reply With Quote #9

Quote:
Originally Posted by HarryPotter View Post
LOL, you first time write the SourcePawn program?
I'm not very good with any coding language, and SourcePawn is especially a challenge for me sometimes.
I don't have experience with most "normal" coding languages (Java/JavaScript, C, C#, etc.). As in, I never coded with them before (though, most languages are pretty similar).
I learned most of what I know now through GLua, a mixture of C++ and Lua.
Spoiler
TotalChaos SourcePawner is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:31.


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