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

[L4D2] Timed Hordes v1.0.1 [6-June-2023]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Plugin ID:
8480
Plugin Version:
1.0.1
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    2 
    Plugin Description:
    flexible hordes independent of director
    Old 06-03-2023 , 17:44   [L4D2] Timed Hordes v1.0.1 [6-June-2023]
    Reply With Quote #1

    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



    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/
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_timed_hordes.sp - 375 views - 9.0 KB)
    __________________

    Last edited by NoroHime; 06-06-2023 at 11:49.
    NoroHime is offline
    sonic155
    Senior Member
    Join Date: Mar 2019
    Old 06-03-2023 , 23:11   Re: [L4D2] Timed Hordes [4-June-2023]
    Reply With Quote #2

    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
    sonic155 is offline
    noto3
    Member
    Join Date: Jan 2021
    Old 06-04-2023 , 16:41   Re: [L4D2] Timed Hordes [4-June-2023]
    Reply With Quote #3

    Think we have a similar one here
    noto3 is offline
    NoroHime
    Veteran Member
    Join Date: Aug 2016
    Location: bed
    Old 06-05-2023 , 01:47   Re: [L4D2] Timed Hordes [4-June-2023]
    Reply With Quote #4

    Quote:
    Originally Posted by sonic155 View Post
    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

    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;

    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_timed_hordes.modules.sp - 162 views - 3.4 KB)
    __________________

    Last edited by NoroHime; 06-05-2023 at 01:47.
    NoroHime is offline
    Elite Biker
    Member
    Join Date: Nov 2020
    Location: The 13 Blessings
    Old 06-09-2023 , 06:13   Re: [L4D2] Timed Hordes [4-June-2023]
    Reply With Quote #5

    Quote:
    Originally Posted by NoroHime View Post
    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

    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! An Improvement for the plugin!
    __________________
    *Bop*
    Elite Biker is offline
    NoroHime
    Veteran Member
    Join Date: Aug 2016
    Location: bed
    Old 06-10-2023 , 10:31   Re: [L4D2] Timed Hordes [4-June-2023]
    Reply With Quote #6

    Quote:
    Originally Posted by Elite Biker View Post
    My god, A genius! 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)
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_timed_hordes.modules.sp - 105 views - 5.9 KB)
    File Type: smx l4d2_timed_hordes.modules.smx (6.3 KB, 150 views)
    __________________

    Last edited by NoroHime; 06-10-2023 at 10:36.
    NoroHime 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 06:55.


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