AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Timed Hordes v1.0.1 [6-June-2023] (https://forums.alliedmods.net/showthread.php?t=342980)

NoroHime 06-03-2023 17:44

[L4D2] Timed Hordes v1.0.1 [6-June-2023]
 
2 Attachment(s)
about
  • as my friends joined my lobby, the difficulty of the map design obviously did not satisfy me, even though we had some other plugins that dynamically adjusted the number of special infected, finally this appear
  • plugin dynamically adjusts the timer duration with the number of survivors, when the countdown trigger the hordes will be called unless tank alive on ground
  • plugin provides some native and forward events for modular development, such as updating the progress bar display in the custom HUD within the OnTimedHordesContinuing event

https://i.imgur.com/dWYQKoM.jpeg

ConVar

PHP Code:

// which survivors wont affect countdown duration, 1=ignore dead survivor, 2=ignore bot, 3=ignore both
timed_hordes_checks "1"

// situations to skip hordes 1=tank on ground 2=last survivor
timed_hordes_skips "-1"

// server max survivors, to scale correct countdown duration
timed_hordes_survivor_max "8"

// min countdown duration to trigger hordes
timed_hordes_survivor_min "2"

// max countdown duration to trigger hordes
timed_hordes_time_max "180"

// min time to trigger hordes
timed_hordes_time_min "30"

// action when countdown trigger 1=z_spawn mob 2=director_force_panic_event 3=spawn tank!!
timed_hordes_type "1" 

Developer
library timed_hordes
PHP Code:

/**
 * @brief Called when hordes timer be trigger
 *
 * @param &timeHordesPast    hordes timer past
 * @param timeHordesCap        hordes time trigger line
 * @param &iHordeType        override *_type once time
 *
 * @return                    Plugin_Continue / Plugin_Changed to accept trigger,
 *                             otherwise to deny trigger.
 */

forward Action OnTimedHordesTrigger(float &timeHordesPastfloat timeHordesCapint &iHordeType);

/**
 * @brief Called when hordes timer be trigger
 *
 * @param &timeHordesPast    hordes timer past
 * @param timeHordesCap        hordes time trigger line
 *
 * @return                    Plugin_Continue / Plugin_Changed to continue timing, otherwise to skip.
 */

forward Action OnTimedHordesContinuing(float &timeHordesPastfloat timeHordesCap);

native void TH_SetHordesTime(float timeHordesPast);
native int TH_GetHordesTime();
native bool TH_TriggerHordes(); 

changelog
  • v1.0 (4-June-2023)
    - just released
  • v1.0.1 (6-June-2023)
    - fix survivors count equal *_survivor_min plugin not working

Installation
  • put l4d2_timed_hordes.smx on /plugins/

sonic155 06-03-2023 23:11

Re: [L4D2] Timed Hordes [4-June-2023]
 
can you add a cvar timer to show when the next mob attack will be so survivors can get ready for it kind of thing? =o

noto3 06-04-2023 16:41

Re: [L4D2] Timed Hordes [4-June-2023]
 
Think we have a similar one here

NoroHime 06-05-2023 01:47

Re: [L4D2] Timed Hordes [4-June-2023]
 
1 Attachment(s)
Quote:

Originally Posted by sonic155 (Post 2805476)
can you add a cvar timer to show when the next mob attack will be so survivors can get ready for it kind of thing? =o

an example module add horde indicator to custom HUD, just like Back4Blood
they features include hordes cooldown and alert icon on last 10 sec.
but to make HUD available you should creating a file to "\left4dead2\scripts\vscripts\<gamemode>.nut" , how to creat it detail see [L4D2] Scripted HUD
https://i.imgur.com/N6r99AT.jpg
PHP Code:

#define PLUGIN_VERSION        "1.0"

#include <sdkhooks>
#include <sourcemod>
#include <sdktools>

forward Action OnTimedHordesTrigger(float &timeHordesPastfloat timeHordesCapint &iHordeType);
forward Action OnTimedHordesContinuing(float &timeHordesPastfloat timeHordesCap);

// native void TH_SetHordesTime(float timeHordesPast);
// native int TH_GetHordesTime();
// native bool TH_TriggerHordes(); 

public void OnMapStart() {
    
GameRules_SetProp("m_bChallengeModeActive"1);
}

#define HUD_FLAG_NONE                 0     // no flag
#define HUD_FLAG_PRESTR               1     // do you want a string/value pair to start(pre) with the string (default is PRE)
#define HUD_FLAG_POSTSTR              2     // do you want a string/value pair to end(post) with the string
#define HUD_FLAG_BEEP                 4     // Makes a countdown timer blink
#define HUD_FLAG_BLINK                8     // do you want this field to be blinking
#define HUD_FLAG_AS_TIME              16    // ?
#define HUD_FLAG_COUNTDOWN_WARN       32    // auto blink when the timer gets under 10 seconds
#define HUD_FLAG_NOBG                 64    // dont draw the background box for this UI element
#define HUD_FLAG_ALLOWNEGTIMER        128   // by default Timers stop on 0:00 to avoid briefly going negative over network, this keeps that from happening
#define HUD_FLAG_ALIGN_LEFT           256   // Left justify this text
#define HUD_FLAG_ALIGN_CENTER         512   // Center justify this text
#define HUD_FLAG_ALIGN_RIGHT          768   // Right justify this text
#define HUD_FLAG_TEAM_SURVIVORS       1024  // only show to the survivor team
#define HUD_FLAG_TEAM_INFECTED        2048  // only show to the special infected team
#define HUD_FLAG_TEAM_MASK            3072  // ?
#define HUD_FLAG_UNKNOWN1             4096  // ?
#define HUD_FLAG_TEXT                 8192  // ?
#define HUD_FLAG_NOTVISIBLE           16384 // if you want to keep the slot data but keep it from displaying

static const char anims[][] = {
    
"⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"
    
// "⠁", "⠂","⠄","⡀","⢀","⠠","⠐","⠈"
}

#define ALERT_WARN        10
#define HORDE_COOLDOWN    10

float timeLastTrigger;

public 
Action OnTimedHordesContinuing(float &timeHordesPastfloat timeHordesCap) {

    static 
char buffer[512];

    
int flag_hud HUD_FLAG_ALIGN_LEFT|HUD_FLAG_NOBG|HUD_FLAG_TEXT;

    if (
GetEngineTime() - timeLastTrigger HORDE_COOLDOWN) {
        
timeHordesPast 0.0;
        
flag_hud |= HUD_FLAG_BLINK;
    }

    if (
timeHordesCap timeHordesPast <= ALERT_WARN)
        
flag_hud |= HUD_FLAG_BLINK;

    
GameRules_SetProp("m_iScriptedHUDFlags",  flag_hud_0);
    
GameRules_SetPropFloat("m_fScriptedHUDPosX",  0.01990);
    
GameRules_SetPropFloat("m_fScriptedHUDPosY",  0.01490);
    
GameRules_SetPropFloat("m_fScriptedHUDWidth"1.50000);
    
GameRules_SetPropFloat("m_fScriptedHUDHeight"0.02600);


    
float percent timeHordesPast timeHordesCap 100;

    if (
percent 100.0)
        
percent 100.0;

    if (
percent 0)
        
percent 0.0;

    
FormatEx(buffersizeof(buffer), "[ %s ] %.f%"anims[RoundToFloor(timeHordesPast) % sizeof(anims)], percent);
    
GameRules_SetPropString("m_szScriptedHUDStringSet"buffer);

    return 
Plugin_Continue;
}

public 
Action OnTimedHordesTrigger(float &timeHordesPastfloat timeHordesCapint &iHordeType) {
    
timeLastTrigger GetEngineTime();
    return 
Plugin_Continue;



Elite Biker 06-09-2023 06:13

Re: [L4D2] Timed Hordes [4-June-2023]
 
Quote:

Originally Posted by NoroHime (Post 2805512)
an example module add horde indicator to custom HUD, just like Back4Blood
they features include hordes cooldown and alert icon on last 10 sec.
but to make HUD available you should creating a file to "\left4dead2\scripts\vscripts\<gamemode>.nut" , how to creat it detail see [L4D2] Scripted HUD
https://i.imgur.com/N6r99AT.jpg
PHP Code:

#define PLUGIN_VERSION        "1.0"#include <sdkhooks>#include <sourcemod>#include <sdktools>forward Action OnTimedHordesTrigger(float &timeHordesPast, float timeHordesCap, int &iHordeType);forward Action OnTimedHordesContinuing(float &timeHordesPast, float timeHordesCap);// native void TH_SetHordesTime(float timeHordesPast);// native int TH_GetHordesTime();// native bool TH_TriggerHordes(); public void OnMapStart() {    GameRules_SetProp("m_bChallengeModeActive", 1);}#define HUD_FLAG_NONE                 0     // no flag#define HUD_FLAG_PRESTR               1     // do you want a string/value pair to start(pre) with the string (default is PRE)#define HUD_FLAG_POSTSTR              2     // do you want a string/value pair to end(post) with the string#define HUD_FLAG_BEEP                 4     // Makes a countdown timer blink#define HUD_FLAG_BLINK                8     // do you want this field to be blinking#define HUD_FLAG_AS_TIME              16    // ?#define HUD_FLAG_COUNTDOWN_WARN       32    // auto blink when the timer gets under 10 seconds#define HUD_FLAG_NOBG                 64    // dont draw the background box for this UI element#define HUD_FLAG_ALLOWNEGTIMER        128   // by default Timers stop on 0:00 to avoid briefly going negative over network, this keeps that from happening#define HUD_FLAG_ALIGN_LEFT           256   // Left justify this text#define HUD_FLAG_ALIGN_CENTER         512   // Center justify this text#define HUD_FLAG_ALIGN_RIGHT          768   // Right justify this text#define HUD_FLAG_TEAM_SURVIVORS       1024  // only show to the survivor team#define HUD_FLAG_TEAM_INFECTED        2048  // only show to the special infected team#define HUD_FLAG_TEAM_MASK            3072  // ?#define HUD_FLAG_UNKNOWN1             4096  // ?#define HUD_FLAG_TEXT                 8192  // ?#define HUD_FLAG_NOTVISIBLE           16384 // if you want to keep the slot data but keep it from displayingstatic const char anims[][] = {    "⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"    // "⠁", "⠂","⠄","⡀","⢀","⠠","⠐","⠈"}#define ALERT_WARN        10#define HORDE_COOLDOWN    10float timeLastTrigger;public Action OnTimedHordesContinuing(float &timeHordesPast, float timeHordesCap) {    static char buffer[512];    int flag_hud = HUD_FLAG_ALIGN_LEFT|HUD_FLAG_NOBG|HUD_FLAG_TEXT;    if (GetEngineTime() - timeLastTrigger < HORDE_COOLDOWN) {        timeHordesPast = 0.0;        flag_hud |= HUD_FLAG_BLINK;    }    if (timeHordesCap - timeHordesPast <= ALERT_WARN)        flag_hud |= HUD_FLAG_BLINK;    GameRules_SetProp("m_iScriptedHUDFlags",  flag_hud, _, 0);    GameRules_SetPropFloat("m_fScriptedHUDPosX",  0.0199, 0);    GameRules_SetPropFloat("m_fScriptedHUDPosY",  0.0149, 0);    GameRules_SetPropFloat("m_fScriptedHUDWidth", 1.5000, 0);    GameRules_SetPropFloat("m_fScriptedHUDHeight", 0.0260, 0);    float percent = timeHordesPast / timeHordesCap * 100;    if (percent > 100.0)        percent = 100.0;    if (percent < 0)        percent = 0.0;    FormatEx(buffer, sizeof(buffer), "[ %s ] %.f%", anims[RoundToFloor(timeHordesPast) % sizeof(anims)], percent);    GameRules_SetPropString("m_szScriptedHUDStringSet", buffer);    return Plugin_Continue;}public Action OnTimedHordesTrigger(float &timeHordesPast, float timeHordesCap, int &iHordeType) {    timeLastTrigger = GetEngineTime();    return Plugin_Continue;} 


My god, A genius! :):):bacon!: An Improvement for the plugin!

NoroHime 06-10-2023 10:31

Re: [L4D2] Timed Hordes [4-June-2023]
 
3 Attachment(s)
Quote:

Originally Posted by Elite Biker (Post 2805769)
My god, A genius! :):):bacon!: An Improvement for the plugin!

if you intresting about that, here improved version progress bar module.
they also creating progress bar of game vanilla direct hordes, and auto hide and show both progress bar if countdown not started, if other custom HUD plugins set properly, even can work together, and this version not <gamemode>.nut needed, but Left 4 DHooks Direct is required.
(by using L4DD, cant compiles online)


All times are GMT -4. The time now is 09:21.

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