View Single Post
Proaxel
Member
Join Date: Oct 2014
Old 03-18-2021 , 04:51   Re: [L4D2] How to scale the gas can goal in scavenge finales to number of survivors?
Reply With Quote #3

Okay, thanks! I think I'll just go the VScript preset method for now since I am still unfamiliar when it comes to everything about VScripts, unless you or someone else here would be willing to walk me through how to do the inject method you mentioned.

So in this preset method I presume I need to do the following:
In the server's Vscripts folder, Make a bunch of copies of the c1m4_atrium_finale.nut, name them according to the preset like finalet1.nut, finalet2.nut, and so on
In each copy change the following line to whatever goal it needs to be for that tier
Code:
// number of cans needed to escape.
NumCansNeeded <- 13 //< change this number to the new goal

Then in my sourcemod plugin it would go something like
PHP Code:
public Action OnVScriptExecuted(const char[] sScriptchar sOverride[PLATFORM_MAX_PATH], bool bOverride)
{
 
    if( 
strcmp(sScript"c1m4_atrium_finale") == || (bOverride && strcmp(sOverride"c1m4_atrium_finale") == 0) )
    {
        
int totalSurvivors GetSurvivorCount();
        if(
totalSurvivors && totalSurvivors <= 8)
        {
            
//Set new scavenge goal of 17 cans
            
PrintToServer("Increase to 17");
            
sOverride "c1m4_atrium_finalet1";
            
Ent_Fire("progress_display""SetTotalItems"17); 
            return 
Plugin_Changed;
        }
        else if(
totalSurvivors && totalSurvivors <= 12)
        {
            
//Set new scavenge goal of 21 cans
            
PrintToServer("Increase to 21");
            
sOverride "c1m4_atrium_finalet2";
            
Ent_Fire("progress_display""SetTotalItems"21); 
            return 
Plugin_Changed;
        }
        
//And so on
    
}
    return 
Plugin_Continue;

For changing the progress display is it simply a matter of using disawar's method in their plugin, or has Sourcemod added a better way of doing this since then (with SetEntProp perhaps?)

PHP Code:
Ent_Fire(const String:sName[], const String:sInput[], Params = -1)
{
    
decl String:sEntName[64];

    for (new 
04096i++){
    
        if (
IsValidEntity(i)){
        
            
GetEntPropString(iProp_Data"m_iName"sEntNamesizeof(sEntName));
            
            if (
StrEqual(sEntNamesName)){
                    
                
#if debug
                    
PrintToChatAll("[GS] ent_fire (%s %d, %s, %d)"sNameisInputParams);
                
#endif
                
                
if (Params != -1)
                    
SetVariantInt(Params);

                
AcceptEntityInput(isInput);
                break;
            }
        }
    }
}

Ent_Fire("game_scavenge_progress_display""SetTotalItems"newTotalCans); 
One last thing, is L4D2 smart enough to respawn gas cans in the same spawn points if it sees that there aren't enough cans to reach the goal, or does a plugin also have to tell it to do that? And/Or do I still have to make use of ScavengeRemixDS to make sure sufficient gas cans are spawned?
Proaxel is offline