Raised This Month: $ Target: $400
 0% 

[L4D2] Delay Round Start


Post New Thread Reply   
 
Thread Tools Display Modes
Mortiegama
Senior Member
Join Date: Feb 2010
Old 03-04-2010 , 18:48   Re: [L4D2] Delay Round Start
Reply With Quote #11

Wow, getting popular here. Both great suggestions, I like resetting the cvar and Hook with the round_end event though:

PHP Code:
#include <sourcemod>
#pragma semicolon 1

#define DELAY_ROUND
#define PLUGIN_VERSION "1.1"

public Plugin:myinfo 
{
    
name "[L4D2] Delay Round",
    
author "Mortiegama, Thraka, mi123645",
    
description "Delays the start of the match so everyone can load properly before the game starts.",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
HookEvent("item_pickup"Event_ItemPickup);
    
HookEvent("round_end"Event_RoundEnd);
}

public 
Event_ItemPickup(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
Handle:sbStop FindConVar("sb_stop");
    new 
client GetClientOfUserId(GetEventInt(event"userid"));

    if (
GetConVarInt(sbStop) == && !IsFakeClient(client))
    {
        
ServerCommand("sm_cvar sb_stop 0");
        
UnhookEvent("item_pickup"Event_ItemPickup);
    }
}  

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
ServerCommand("sm_cvar sb_stop 1");
    
HookEvent("item_pickup"Event_ItemPickup);

Mortiegama is offline
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 03-04-2010 , 20:58   Re: [L4D2] Delay Round Start
Reply With Quote #12

Here is my final (i think) solution I'll use on my servers.

On MapStart, I call sb_stop 1, then create an infinite timer.

Timer checks for
1) Any connected, non bot client
2) Checks that clients team for SURVIVOR
3) If found, turns off timer, calls sb_stop 0, and resets max counter
4) If not found, and the timer has fired 20 times, timer forces the timer off, sb_stop 1 and resets timer counter.

EDIT: Quick fix... Removed the killtimer auto close.. solved a error thrown that prevented them from starting.
EDIT: I just tested this on my server. IT WORKED PERFECTLY!!!

PHP Code:
#include <sourcemod>
#define TEAM_SURVIVOR 2

public Plugin:myinfo 
{
    
name "[L4D] Delay Bots Starting Game",
    
author "Mortiegama, Thraka, mi123645",
    
description "Prevents bots from leaving the safe room via sb_all_bot_team until a survivor has loaded (or 20 seconds goes by)",
    
version "1.0",
    
url "http://forums.alliedmods.net/showthread.php?p=1107614"
}

new 
TimerLengthMax 20;
new 
TimerLengthCurrent 0;

public 
OnMapStart()
{
    
CreateTimer(1.0Timer_CheckForHumanSurvivor_,TIMER_REPEAT);
    
SetConVarInt(FindConVar("sb_stop"), 1);
}

public 
Action:Timer_CheckForHumanSurvivor(Handle:timer)
{
    
TimerLengthCurrent++;
    new 
bool:shutdownTimer false;
    
    for (new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))
        {
            if (
GetClientTeam(i) == TEAM_SURVIVOR)
            {
                
shutdownTimer true;
                break;
            }
        }
    }
    
    if (
TimerLengthCurrent TimerLengthMax || shutdownTimer)
    {
        
KillTimer(timer);
        
TimerLengthCurrent 0;
        
SetConVarInt(FindConVar("sb_stop"), 0);
    }

Attached Files
File Type: sp Get Plugin or Get Source (l4d_delay_bot_start.sp - 410 views - 1.0 KB)

Last edited by Thraka; 03-04-2010 at 22:50. Reason: Updated
Thraka is offline
Jehuty
Junior Member
Join Date: Mar 2010
Old 03-05-2010 , 03:22   Re: [L4D2] Delay Round Start
Reply With Quote #13

I just tested it on my L4D2 server (v 2.0.1.1), and it don't work at all!!! When the second map of the campaign loads I find my survivor in the middle of the battle with the infected instead of being in the safe room. Please fix it, it could be a really useful plugin!

Here is the list of my plugins, maybe it'll be useful for finding out what's the problem:
01 "Admin File Reader" (1.4.0-dev) by AlliedModders LLC
02 "Admin Help" (1.4.0-dev) by AlliedModders LLC
03 "Admin Menu" (1.4.0-dev) by AlliedModders LLC
04 "Advertisements" (0.5.5) by Tsunami
05 "Anti-Flood" (1.4.0-dev) by AlliedModders LLC
06 "autorestartmap.smx"
07 "Basic Ban Commands" (1.4.0-dev) by AlliedModders LLC
08 "Basic Chat" (1.4.0-dev) by AlliedModders LLC
09 "Basic Comm Control" (1.4.0-dev) by AlliedModders LLC
10 "Basic Commands" (1.4.0-dev) by AlliedModders LLC
11 "Basic Info Triggers" (1.4.0-dev) by AlliedModders LLC
12 "Basic Votes" (1.4.0-dev) by AlliedModders LLC
13 "Client Preferences" (1.4.0-dev) by AlliedModders LLC
14 "Fun Commands" (1.4.0-dev) by AlliedModders LLC
15 "Fun Votes" (1.4.0-dev) by AlliedModders LLC
16 "L4D2 Score/Team Manager" (1.2.1) by Downtown1 & AtomicStryker
17 "[L4D2] Bulldozer Certification" (1.0.7) by AtomicStryker
18 "[L4D2] Weapon Spawner" (0.4) by Zuko. Rus: OldFox
19 "L4DSwitchPlayers" (1.4) by SkyDavid (djromero)
20 "[L4D] Delay Bots Starting Game" (1.0) by Mortiegama, Thraka, mi123645
21 "L4D Survivor AI Pounced Fix" (1.0.2) by AtomicStryker
22 "mv_l4d_takeoverbot.smx"
23 "Player Commands" (1.4.0-dev) by AlliedModders LLC
24 "Player Joined Notifier" (1.0.0.0) by {[FIIK]}Vance
25 "Reserved Slots" (1.4.0-dev) by AlliedModders LLC
26 "Roadkill's Competive Scoring l4d2" (VERSION) by Roadkill
27 "Round All Talk" (1.1) by Mr. Zero
28 "L4D Force Mission Changer" (1.4.0) by Dionys
29 "Sound Commands" (1.4.0-dev) by AlliedModders LLC
Jehuty is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-05-2010 , 04:47   Re: [L4D2] Delay Round Start
Reply With Quote #14

Jehuty, can you try this one? This one dosen't allow bots to move out from saferoom before you have done it. As soon as you have left the saferoom, they will grab ammo and weapons and run out. I don't see why that would be a bad solution.

Last edited by Visual77; 08-25-2011 at 09:51.
Visual77 is offline
Jehuty
Junior Member
Join Date: Mar 2010
Old 03-05-2010 , 12:58   Re: [L4D2] Delay Round Start
Reply With Quote #15

Visual77, your plugin works perfectly! But please add some features to it:
1. There should be a message at the center of the screen (and with big enough letters) when the plugin waits for players to connect for about 30 seconds and after that unfreezes the survivor bots - something like "Waiting for players to join the survivors team. The game will start in {time left} seconds", and after the time expires - "The game has started!". (Some infected players just leave the server when seeing frozen bots in the safe room for a long time).
2. There is a message necessary for survivors team only when a player joins the survivors team - "The game has started. Leave the safe room to activate the bots!" - some survivors start to melee frozen bots, trying to unfreeze them, so the players should be informed that meleeing won't help here.
3. The timeout for waiting the players to join the survivors team should be adjustable through CVAR in server.cfg file.

Thanks in advance!
Jehuty is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-05-2010 , 13:16   Re: [L4D2] Delay Round Start
Reply With Quote #16

Well, I could add some chat messages and improve the method so bots wont be frozen untill safe room door is opend, just frozen for the first few seconds so they don't open the door. For the other parts, did you try this plugin? It seems to have a lot of what you're requesting. Btw, you cannot get big letters with center text, not in l4d 2
http://forums.alliedmods.net/showpos...9&postcount=85

Last edited by Visual77; 03-05-2010 at 13:21.
Visual77 is offline
Jehuty
Junior Member
Join Date: Mar 2010
Old 03-05-2010 , 14:17   Re: [L4D2] Delay Round Start
Reply With Quote #17

I had tried to use AtomicStryker's l4d2_loading plugin before I wrote my very first post in this thread, and it don't work at all on L4D2 servers from v. 2.0.0.9 and higher (where new survivor bot AI feature is implemented). And you do can get big letters with center text in l4d2 - e.g. in ready up! plugin ("The game is LIVE" message, etc).
Please improve the method of bot freezing to the one you've talked about and add the messages. After that your plugin could be put into "Approved plugins" (at least I hope so )

Last edited by Jehuty; 03-05-2010 at 15:17.
Jehuty is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-05-2010 , 18:19   Re: [L4D2] Delay Round Start
Reply With Quote #18

In what way does AtomicStryker's plugin not work? Are bots teleporting outside the safe room door before the countdown is finished?
I've tried to fix that with this version.

What I did now was that I implemented this into the already existing door lock plugin. On roundstart, I choosed to freeze all the bots untill
all players are in the game. The countdown starts and the round begins. When the countdown is finished,
bots will be unfrozen. This means that they will run out as soon as the door is opend/ or when the countdown is at 0.

Last edited by Visual77; 03-07-2010 at 06:41.
Visual77 is offline
Jehuty
Junior Member
Join Date: Mar 2010
Old 03-06-2010 , 05:11   Re: [L4D2] Delay Round Start
Reply With Quote #19

Wow, you made l4d2_loading plugin working under L4D2 v. 2.0.1.1!!! It works fine, but not as you described: initially (on the round start), all the survivor bots are frozen. Then, when the first survivor player connects, they become unfrozen, but survivors cannot leave the safe room because they can't open the door. And when all players are in the game the countdown starts, and when it's finished, the door becomes unlockable. It's even better then the mechanism you described, there is no need to change this.
But I noticed a strange bug in the beginning of some rounds: sometimes, when even first player joins survivors, the door of the safe room is already opened for some reason, and it's impossible for players to close it! (Maybe it's a generic Valve bug, I don't know) So could you add the command that forces the door of the safe room to close (after bots freezing or on first player joined survivors team), please?

And about the problems with original AtomicStryker's loading plugin - they were just the same that its precursor, l4d loading plugin had. They are described here.

Thank you beforehand!

Last edited by Jehuty; 03-07-2010 at 19:37.
Jehuty is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-06-2010 , 05:32   Re: [L4D2] Delay Round Start
Reply With Quote #20

Well, are you sure the door is opened by itself? I've never seen that happen with l4d2_loading. Coulden't it be you or anyone else loading slow in to the game? This plugin waits 50 sec for slowloaders, if players load longer then 50 sec, countdown is started and then the door is opened. So if they load slow, the might join the game when the game has already begun. And also, the door is automaticly opened if survivors don't leave saferoom for 90 sec.

I updated l4d2_loading once more.
-Door will now lock itself 2 seconds after one survivor has joined the game. It was 5 seconds before.
This could prevent a player from opening the door really quick if he is the first survivor in the game.

Last edited by Visual77; 08-25-2011 at 09:51.
Visual77 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 02:38.


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