Raised This Month: $12 Target: $400
 3% 

Solved Possible to temporary block bots from bypassing "blocked path"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-31-2020 , 08:00   Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #1

Hello again,

I have a container blocking the first path in l4d1 sacrafice.
You have to push a button, then the crane will lift it out of the way and a horde will be called.

I will attach the file so you can see in action…

The problem now is that human players can't bypass this block and have to press the button, bots simple wiggle around a bit and then teleport to the other side. (damn them)

So the question is how to prevent them from doing so? Is there anything I can do to prevent that from inside the plugin until the crane has finished?

In other cresendo cases like the shuttergate in l4d_vs_hospital02_subway, they wait.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_river01_docks_pimp2.sp - 182 views - 13.2 KB)
__________________

Last edited by finishlast; 11-13-2020 at 13:52.
finishlast is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 10-31-2020 , 08:26   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #2

I don't know if is helpful, because it blocks any bot teleport I think (which increased the chance of they die)
But you can set this CVAR to 0 (default 1)

sb_unstick

Other solution may require writing a plugin that teleports the bots to a "fixed" position while the event is running
__________________

Last edited by Marttt; 10-31-2020 at 08:26.
Marttt is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-31-2020 , 09:15   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #3

Oh that actually seems to do the trick, thanks a lot!

Do you know if this cvar can be changed midgame and then back during a map?

They seem to just stand there now trying to get past but they can't, that is fairly good enough.

SetConVarInt(FindConVar("sb_unstick"), 0);


and after the event

SetConVarInt(FindConVar("sb_unstick"), 1);

******

My idea now instead of setting the cvar on map start is to set it when they enter a field around the container lets say 100 px in front of it.

Anyone knows how to set this cvar via an "area"-switch or something? Like when they get near to the container?
Attached Files
File Type: sp Get Plugin or Get Source (l4d_river01_docks_pimp2.sp - 155 views - 13.2 KB)
__________________

Last edited by finishlast; 10-31-2020 at 12:22.
finishlast is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 10-31-2020 , 09:58   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #4

Well I'm not used to do this but you can hook some output from an existing entity that triggers the event.

Here is a snippet, but you have to check the outputs from the classname entity you want.
This one for example has an output called "OnCoop"

You can find more values in the valve wiki (that is unavailable now)
This one is from info_gamemode (as sample)

https://developer.valvesoftware.com/wiki/Info_gamemode

PHP Code:
public void AddSomeOutputListener()
{
    
int entity CreateEntityByName("info_gamemode");
    
DispatchSpawn(entity);
    
HookSingleEntityOutput(entity"OnCoop"SomeFunctionHeretrue);
    
ActivateEntity(entity);
    
AcceptEntityInput(entity"PostSpawnActivate");
    
AcceptEntityInput(entity"Kill");
}

/****************************************************************************************************/

public void SomeFunctionHere(const char[] outputint callerint activatorfloat delay)
{
    
//change the cvar

Probably your event is activated by some button (OnPressed/OnTimeUp) or trigger (OnTrigger) entity classname

You can check these through dumping the map with stripper and looking for the entity that fires the event.
__________________

Last edited by Marttt; 10-31-2020 at 10:34.
Marttt is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 10-31-2020 , 10:52   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #5

The problem is that they just run against the barrier even if the event has not been activated and then teleport to the other side.


SetConVarInt(FindConVar("sb_unstick"), 0);

seems to stop them from teleporting, to minimize problem with this setting, I thought maybe it can be set only when they get near the block and then set back to normal after the event.

Since they walk against the container that must fire some sort of collision event maybe I can user that to set the cvar?

I wonder how to track that touch. o0

func_nav_blocker mb that is something to add via script and then delete entity after event?!

oh maybe this can do it

https://forums.alliedmods.net/showth...nc_nav_blocker
__________________

Last edited by finishlast; 11-01-2020 at 05:23.
finishlast is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-02-2020 , 04:55   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #6

Not quite sure about this but as long as there is nav connected, bot always can teleport because it sound like the bot try to get to some location but they stuck. Try check they distance from the main are, if the distance greater or closer to the "always teleport location", send them back or just check if the bot touch the container, sent them away. If soft solution doesn't work.. try evil one... my favorite... burn the surrounding container continuously until the event end. The bot can feel damage and turn around.
GsiX is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 11-12-2020 , 12:18   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #7

I though mabye I just wait for one of the bots to touch the container then set the cvar and when the lift is complete, I set it back to normal.

That being said, I tried to hook this touch event.

I thought this would work but nothing happens, any idea if this is the right approach to detect the touch via hook?!

When I load sacrafice first map and run against container nothing happens in chat...

PHP Code:

#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#pragma newdecls required

int ent_dynamic_block1

public 
void OnPluginStart()
{
    
HookEvent("round_freeze_end"event_round_freeze_endEventHookMode_PostNoCopy);
}


public 
void event_round_freeze_end(Event event, const char[] namebool dontBroadcast)
{
     
float pos[3], ang[3]; 

    
pos[0] = 12170.0;
    
pos[1] = -80.0;
    
pos[2] = -62.0;
    
ang[0] = 0.0;
    
ang[1] = 90.0;
    
ang[2] = 0.0;

    
PrecacheModel("models/props_equipment/cargo_container01.mdl",true);

    
ent_dynamic_block1 CreateEntityByName("prop_dynamic"); 
 
    
DispatchKeyValue(ent_dynamic_block1"model""models/props_equipment/cargo_container01.mdl");
    
DispatchKeyValue(ent_dynamic_block1"disableshadows""1");
    
DispatchKeyValue(ent_dynamic_block1"solid""6");
    
DispatchSpawn(ent_dynamic_block1);
    
TeleportEntity(ent_dynamic_block1posangNULL_VECTOR);

    
HookSingleEntityOutput(ent_dynamic_block1"OnTouchedByEntity"OnEntityOutPutfalse);
}


public 
void OnEntityOutPut(const char[] outputint callerint activatorfloat delay)
{
    
PrintToChatAll("Touched");

__________________

Last edited by finishlast; 11-12-2020 at 12:20.
finishlast is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 11-13-2020 , 01:22   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #8

Hi, where did the "OnTouchedByEntity" output come from? i couldn't find in the l4d2 entity?
Side note, i have no knowledge in this but wort a look. It has the output might serve your need.

trigger_playermovement
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 11-13-2020 , 06:42   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #9

You can try to hook the entity with SDK_HookTouch, and check if the "toucher" is a survivor bot, then teleport they back.

And after the event ends you unhook.
__________________
Marttt is offline
finishlast
Senior Member
Join Date: Nov 2018
Location: In Reno with the vitamin
Old 11-13-2020 , 13:18   Re: Possible to temporary block bots from bypassing "blocked path"
Reply With Quote #10

I found the OnTouchedByEntity in a plugin where someone touches a laser or something but not sure if that was valid anyways. => here:
https://forums.alliedmods.net/showthread.php?t=156431

But thanks Marttt for the sdk_hooktouch, that did the trick and is rather simple!

I just hook the container now check if bot touches it, if so I set the unstick 0 and unhook

then after event stops I just set unstick back to 1.

That seems to solve my problems!

Final result attached...

Thx a ton!
Attached Files
File Type: sp Get Plugin or Get Source (l4d_river01_docks_pimp2.sp - 150 views - 13.5 KB)
__________________

Last edited by finishlast; 11-13-2020 at 14:39.
finishlast is offline
Reply


Thread Tools
Display Modes

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 12:19.


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