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

[L4D2] How to force proceed + How to tell if Survivor is in safe room / group area?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Proaxel
Member
Join Date: Oct 2014
Old 03-31-2021 , 17:02   [L4D2] How to force proceed + How to tell if Survivor is in safe room / group area?
Reply With Quote #1

I would like to try making a few of these plugins myself, but I lack the knowledge of certain things. Here are the details:

Anti-Molotov Griefing: If a survivor tries to throw a molotov, check if they are in a safe room, grouping area, or escape vehicle. If they are in any of those, block the molotov throw (by returning Plugin_Handled in the weapon_fire event?), and show a message saying throwing molotovs in this area is prohibited.

Anti-Stall: In grouping areas where all players need to group together and then push a button in order to proceed, like the elevators in Dead Center, No Mercy or Hard Rain. If enough different players push the button (maybe 75% of alive survivors), start a 60 second countdown. When the timer expires, teleport any survivors not in the area to a survivor that is in the area (or the location saved at the moment the first person that pushed the button if there is none), and force the button to activate.

Similarly in escape vehicles: Start a 60 second countdown when 75% of alive survivors enter an escape vehicle. When the timer expires, run ForcePlayerSuicide on any survivors not in the rescue zone and force the vehicle to leave. Kill the timer if the amount of alive survivors in the vehicle falls below a certain amount (50%?).

(Grouping area = any area where if you try to proceed while not all survivors are in the area, the game will tell you to "Wait for everyone to be ready first")
  • How do you determine via SourceMod if a survivor is currently in a safe room, rescue vehicle, or a grouping area?
  • In Sourcemod, how do you forcibly trigger something that allows the survivors to proceed, like the pushing the button in the elevator, or interacting with something required to trigger a finale (like the No Mercy radio)?
  • How do you forcibly make an active rescue vehicle depart (and thus trigger the end of the campaign)?
Proaxel is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 03-31-2021 , 17:19   Re: [L4D2] How to force proceed + How to tell if Survivor is in safe room / group are
Reply With Quote #2

Blocking molotov throws probably would be done "OnPlayerRunCmd", but I'm kinda against it cause there are some specific situations where you really need throw a Molotov in these locations.

What I see some servers doing is blocking players to throw molotovs until they played for "X" time in the server or have X points (based on another points plugin system)

For button things usually, you achieve that by using "AcceptEntityInput" passing the entity as index and the Input. Like "Unlock" or "Trigger" ( e.g: AcceptEntityInput(entity, "Trigger"); ), of course every entity has a specific input you need do some research. (Valve wiki/Hammer, sometimes, is your friend)
Also in finale maps, some button actions like no mercy rooftop or parish bridge you need that all survivors are in "NAV" areas that are defined as "FINALE" (you can check with z_debug 1 in console, local server). Another point is that if you have stripper installed and do some "stripper_dump" you will notice that sometimes a lot of things are happening and is not just a button that you have to trigger.

Gonna say that the grouping area things are not easy to detect cause some use a "trigger_multiple" to check if all the survivors are in a specific place. (you can check my plugin [L4D1 & L4D2] Trigger Multiple Ignore Incapacitated)

In saferoom I think there is another trigger that can tell you if you are in or out (you have to hook the input and manually set in a plugin variable that the client is in or out.

You could check left4dhooks which has a lot of useful natives and may give you some ready infos.

Probably other people will give you more information and ways to achieve that.

Wish you good luck.
__________________

Last edited by Marttt; 03-31-2021 at 17:20.
Marttt is offline
jeremyvillanueva
AlliedModders Donor
Join Date: Jan 2021
Location: dcord:Jeremy333#7632
Old 04-01-2021 , 12:37   Re: [L4D2] How to force proceed + How to tell if Survivor is in safe room / group are
Reply With Quote #3

Oh thanks Martt for the insights, it would be my next project to work
on your plugin that you mentioned to add what Axel pledges,

I may add some info for this particular points about this post

Anti Stall in in escape vehicles:
I'm using GsiXG6/l4d2_saferoom_hazard
I have implemented something like what you need on my fork
https://github.com/jeremyvillanuevar...aferoom_hazard
It teleports on rescue on 75% survivors on the vehicle,
I've yet to implement a Timer, Translations and Cvars

I would be more than happy if you could implement what you need
because it's also what I want,

[*]How do you determine via SourceMod if a survivor is currently in a safe room, rescue vehicle, or a grouping area?
You could use GsiXG6 method on his plugin that I'm using, he creates an area and verifies the survivors inside.


BW,

Last edited by jeremyvillanueva; 04-01-2021 at 12:38.
jeremyvillanueva is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 04-01-2021 , 14:04   Re: [L4D2] How to force proceed + How to tell if Survivor is in safe room / group are
Reply With Quote #4

Aren't the L4D_IsInFirstCheckpoint and L4D_IsInLastCheckpoint natives from Left 4 DHooks Direct enough to tell if a survivor is in either one of the saferooms?
cravenge is offline
Proaxel
Member
Join Date: Oct 2014
Old 04-05-2021 , 03:23   Re: [L4D2] How to force proceed + How to tell if Survivor is in safe room / group are
Reply With Quote #5

Quote:
Similarly in escape vehicles
I've just now come across a plugin that already does this! l4d_rescue_vehicle_leave_timer by Harry Potter
I forgot the link: https://github.com/fbef0102/L4D1_2-P...le_leave_timer

Here is how they determined if a player is in a rescue vehicle:
PHP Code:
int entity = -1;
        while ((
entity FindEntityByClassname(entity"trigger_multiple")) != -1)
        {
            
int iHammerID Entity_GetHammerId(entity);
            for(
int i=0;i<MAX_DATAS;++i)
            {
                if( 
iHammerID == g_iData[i] )
                {
                    
HookSingleEntityOutput(entity"OnStartTouch"OnStartTouch);
                    
HookSingleEntityOutput(entity"OnEndTouch"OnEndTouch);
                    
g_bFinalHasEscapeVehicle true;
                    break;
                }
            }
        } 
OnStartTouch and OnEndTouch are simply functions where they set a per client boolean on whether the client is in the rescue vehicle. I'm more curious about the HammerID == g_iData[i] part though...
PHP Code:
bool LoadData()
{
    
char sPath[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMsPathsizeof(sPath), CONFIG_SPAWNS);
    if( !
FileExists(sPath) )
        return 
false;

    
// Load config
    
KeyValues hFile = new KeyValues("rescue_vehicle");
    if( !
hFile.ImportFromFile(sPath) )
    {
        
delete hFile;
        return 
false;
    }

    
// Check for current map in the config
    
char sMap[64];
    
GetCurrentMap(sMapsizeof(sMap));

    if( !
hFile.JumpToKey(sMap) )
    {
        
delete hFile;
        return 
false;
    }

    
// Retrieve how many rescue entities
    
int iCount hFile.GetNum("num"0);
    if( 
iCount == )
    {
        
delete hFile;
        return 
false;
    }
    
    
// check limit
    
if( iCount MAX_DATAS )
        
iCount MAX_DATAS;
        
    
//get hammerid of each rescue entity
    
char sTemp[4];
    for( 
int i 1<= iCounti++ )
    {
        
IntToString(isTempsizeof(sTemp));

        if( 
hFile.JumpToKey(sTemp) )
        {
            
g_iData[i-1] = hFile.GetNum("hammerid"0);
            
g_iCvarTime hFile.GetNum("time"60);
            
hFile.GoBack();
        }
    }

    
delete hFile;
    return 
true;

From what I can tell, they read a list of hammer IDs for each of the rescue vehicles' trigger_multiples off a provided data file, and then they check if the trigger_multiple's IDs of the current map match up. Perhaps a similar method could be adapted for telling whether or not a player is in grouping up points in elevators or otherwise?

Quote:
Aren't the L4D_IsInFirstCheckpoint and L4D_IsInLastCheckpoint natives from Left 4 DHooks Direct enough to tell if a survivor is in either one of the saferooms?
That is true and I do plan on having molotov blocking just be based off of those.

Last edited by Proaxel; 04-05-2021 at 19:49.
Proaxel is offline
Zynda
Member
Join Date: Jul 2011
Old 04-06-2021 , 11:28   Re: [L4D2] How to force proceed + How to tell if Survivor is in safe room / group are
Reply With Quote #6

Should be easy to reconfigure that plugin for the group up points in non finale levels, just provide it with the hammerid of the trigger_multiple for the group up point and modify the plugin to change what action is taken when the timer runs out.

Might want to fork the plugin to only handle these events instead of escape events or change it to handle both kinds, maybe with a new key in the config telling the plugin what action is to be taken (slay / warp).

You should be able to find any group up points by looking for any trigger_multiple with the OnEntireTeamStartTouch output, in vanilla l4d2 campaigns i'm positive they all use this method.

As an example here is the trigger_multiple for the elevator in c8m4_interior

PHP Code:
// From stripper_dump
{
"model" "*40"
"wait" "1"
"StartDisabled" "0"
"spawnflags" "1"
"origin" "13432 15273.8 484.54"
"entireteam" "2"
"allowincap" "1"
"classname" "trigger_multiple"
"hammerid" "1199298"
"OnEntireTeamStartTouch" "elevator_button:Unlock::0:-1"
"OnEntireTeamEndTouch" "elevator_button:Lock::0:-1"

In this case the origin of the trigger is well located in the center of the elevator, as is the case with all the elevators i'm sure, so it might not be a terrible spot to warp survivors to when the timer runs out.
Zynda 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 04:31.


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