Raised This Month: $ Target: $400
 0% 

[L4D] Loading Bug Removal/ Door Lock


Post New Thread Reply   
 
Thread Tools Display Modes
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 10-23-2011 , 20:30   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #171

There.

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

#define PLUGIN_VERSION "1.0.1"

#define TEST_DEBUG 0
#define TEST_DEBUG_LOG 0

public Plugin:myinfo 
{
    
name "L4D Repelling Saferoom Door",
    
author "AtomicStryker",
    
description " Creates a repulsive force around a Saferoom exit door to prevent early round starts ",
    
version PLUGIN_VERSION,
    
url ""
}


const 
Float:DOOR_FORCE_DISTANCE 100.0;

new 
checkpointDoorEnt = -1;
new 
pushEnt = -1;
new 
bool:isPusherActive false;
new 
bool:roundHandled false;
new 
Float:vecPusher[3];

public 
OnPluginStart()
{
    
HookEvent("player_entered_checkpoint"Event_RoundStart);
    
HookEvent("player_use"Event_PlayerUse);
    
HookEvent("round_end"Event_RoundEnd);
}

TurnOffPush()
{
    if (
pushEnt && IsValidEntity(pushEnt))
    {
        
AcceptEntityInput(pushEnt"Kill");
        
pushEnt = -1;
    }
    
    
checkpointDoorEnt = -1;
    
isPusherActive false;
}

stock Create_Point_Push(ent, const String:radius[] = "200.0", const String:innerRadius[] = "200.0", const String:magnitude[] = "1000.0"Float:zOffset 30.0)
{
    new 
point_push CreateEntityByName("point_push");
    
    if (
IsValidEdict(point_push))
    {
        new 
Float:pos[3]; 
        
GetEntPropVector(entProp_Send"m_vecOrigin"pos);
        
pos[2] += zOffset;
        
        
DispatchKeyValue(point_push"targetname""l4dpusher");
        
        
///VALUES
        
DispatchKeyValue(point_push"enabled""1");
        
DispatchKeyValue(point_push"magnitude"magnitude);
        
DispatchKeyValue(point_push"radius"radius);
        
DispatchKeyValue(point_push"inner_radius"innerRadius);
        
DispatchKeyValue(point_push"spawnflags""8");
        
        
DispatchSpawn(point_push);
        
        
ActivateEntity(point_push);
        
AcceptEntityInput(point_push"TurnOn");
        
        
ActivateEntity(point_push);
        
AcceptEntityInput(point_push"Enable");
        
        
TeleportEntity(point_pushposNULL_VECTORNULL_VECTOR);
    }
    
    return 
point_push;
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
AddForceFieldToSaferoomDoor();
}

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
roundHandled false;
    
TurnOffPush();
}

public 
Event_PlayerUse(Handle:event, const String:name[], bool:dontBroadcast)
{
    
//new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
new ent GetEventInt(event"targetid");
    if (
ent == checkpointDoorEnt)
    {
        
TurnOffPush();
        
DebugPrintToAll("Door used, ForceField turned off");
    }
}

AddForceFieldToSaferoomDoor()
{
    if (
isPusherActive || roundHandled) return;
    
    new 
survivor FindSurvivor();
    if (
survivor == -1) return;

    new 
checkPointDoorEntityIds[10] = -1;

    new 
entcount;
    while ((
ent FindEntityByClassname(ent"prop_door_rotating_checkpoint")) != -1)
    {
        
checkPointDoorEntityIds[count] = ent;
        
count++;
    }
    
    
decl Float:survivorvec[3];
    
GetClientAbsOrigin(survivorsurvivorvec);
    
    
decl Float:doorvec[3];
    new 
Float:mindist 9999.0;
    
decl Float:checkdist;
    
count 0;
    while (
checkPointDoorEntityIds[count] != -&& IsValidEntity(checkPointDoorEntityIds[count]))
    {
        
GetEntPropVector(checkPointDoorEntityIds[count], Prop_Data"m_vecAbsOrigin"doorvec);
        
checkdist GetVectorDistance(survivorvecdoorvec);
        
        if (
checkdist mindist)
        {
            
ent checkPointDoorEntityIds[count];
            
mindist checkdist;
        }
        
count++;
        if (
count == 10) break;
    }
    
    
GetEntPropVector(entProp_Data"m_vecAbsOrigin"doorvec);
    
    
checkpointDoorEnt ent;
    
vecPusher doorvec;
    
isPusherActive true;
    
pushEnt Create_Point_Push(ent"120.0""120.0");
    
roundHandled true;
    
DebugPrintToAll("AddForceFieldToSaferoomDoor completed, ForceField active");
}

FindSurvivor()
{
    for(new 
1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == 2)
            return 
i;    
    }
    
    return -
1;
}

stock DebugPrintToAll(const String:format[], any:...)
{
    
#if (TEST_DEBUG || TEST_DEBUG_LOG)
    
decl String:buffer[256];
    
    
VFormat(buffersizeof(buffer), format2);
    
    
#if TEST_DEBUG
    
PrintToChatAll("[REPELDOOR] %s"buffer);
    
PrintToConsole(0"[REPELDOOR] %s"buffer);
    
#endif
    
    
LogMessage("%s"buffer);
    
#else
    //suppress "format" never used warning
    
if(format[0])
        return;
    else
        return;
    
#endif


EDIT:

1.0.1 - changed trigger event from first_spawn to entered_checkpoint, should keep working now
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_door_blockoff_fix.sp - 469 views - 4.2 KB)

Last edited by AtomicStryker; 10-24-2011 at 04:49.
AtomicStryker is offline
Chronic1
SourceMod Donor
Join Date: Jun 2011
Old 10-23-2011 , 20:44   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #172

Awesome Atomic! You are the best!

edit: It worked for the first try. Then I started switching to all the other bugged maps and it just randomly stopped working.
__________________

Last edited by Chronic1; 10-23-2011 at 21:03.
Chronic1 is offline
Glide Loading
Member
Join Date: May 2010
Old 10-24-2011 , 09:36   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #173

Quote:
Originally Posted by Chronic1 View Post
c2m2_fairgrounds, c2m3_coaster, c6m3_port, c10m3_ranchhouse

These maps have a valve bug where if you touch the door, the infected can start spawning.
Yep. This is a AI-NAV-map bug.
On my server i fixed it by splitting broken waypoints near the door.
Glide Loading is offline
Chronic1
SourceMod Donor
Join Date: Jun 2011
Old 10-24-2011 , 13:21   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #174

Splitting broken waypoints? whats that? Can you show me how? Atomic's fix still isn't working 100%.
__________________
Chronic1 is offline
Glide Loading
Member
Join Date: May 2010
Old 10-24-2011 , 13:40   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #175

To edit ai navigation, you need to do next steps.
1. start the game.
2. from menu, open console and type map c2m3_coaster (or any other map that you want to fix).
3. when map loaded, type next cvars: sv_cheats 1 nav_edit 1 z_debug 1. now you can see (and edit) an AI navigation map.

How to edit navigation mesh you can read here: http://developer.valvesoftware.com/w...igation_Meshes

You will need to edit nav to have something like this: http://**************/photo/my-images...1102400001.jpg

Or. I can share my navigation fixes. But it's about 170Mb to download and Valve can break it with any map update.

P.S. I have some ideas to fix that problem with plugin, but i need time to think.

Last edited by Glide Loading; 10-24-2011 at 13:42.
Glide Loading is offline
Glide Loading
Member
Join Date: May 2010
Old 10-25-2011 , 12:40   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #176

Update. http://forums.alliedmods.net/showpos...&postcount=136

NEW: l4d2_dlock_startprevent (disabled by default). If enabled, versus round will not start until safe-room door become opened. (requested by Chronic1)
From now, this plugin required a Left4Downtown 2 extension (again).

Delete your cfg\sourcemod\l4d2_doorlock.cfg before update.

Last edited by Glide Loading; 10-25-2011 at 12:44.
Glide Loading is offline
Chronic1
SourceMod Donor
Join Date: Jun 2011
Old 10-28-2011 , 16:08   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #177

Hey Glide Loading. Atomic wrote me a custom plugin that spawns 4 bot tanks 15 seconds after the round starts and 15 seconds after they die, they spawn again. It's not playing well with your update on this plugin. It spawns the 4 tanks before the safe room door opens if a player touches the door while it is still locked. But the players on infected team don't see any count-down timer, they just end up taking control over the 4 or more bot tanks that spawned early. My server is 8vs8 TAAANNNK Mutation 19, so there are no special infected. Just tanks with 15 second spawn times. Can you take a look at the source and maybe see whats happening? This only happens on the maps I mention in post #170.
Attached Files
File Type: sp Get Plugin or Get Source (tankcountenforcer.sp - 94 views - 6.9 KB)
__________________

Last edited by Chronic1; 10-28-2011 at 16:38.
Chronic1 is offline
Glide Loading
Member
Join Date: May 2010
Old 10-29-2011 , 06:05   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #178

Problems was in that that Atomic used same L4DT2 forward, as me to stop round from early start (L4D_OnFirstSurvivorLeftSafeArea).
I attached version where L4D_OnFirstSurvivorLeftSafeArea replaced with generic player_left_start_area event. Now it should work fine.
Attached Files
File Type: sp Get Plugin or Get Source (tankcountenforcer.sp - 199 views - 7.0 KB)

Last edited by Glide Loading; 10-29-2011 at 06:05.
Glide Loading is offline
Chronic1
SourceMod Donor
Join Date: Jun 2011
Old 10-29-2011 , 14:51   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #179

Thanks a lot Glide Loading. You are awesome!
__________________
Chronic1 is offline
Danny_l4d
Senior Member
Join Date: Feb 2010
Old 12-18-2011 , 22:44   Re: [L4D] Loading Bug Removal/ Door Lock
Reply With Quote #180

Is it possible to make this plugin for l4d1? the original crashes the game very often...
still trying to look for a freeze on round start only on coop game..
anyone maybe can help?
Danny_l4d 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 09:55.


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