AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Versus Water Brake (https://forums.alliedmods.net/showthread.php?t=114641)

AtomicStryker 01-06-2010 12:54

[L4D2] Versus Water Brake
 
11 Attachment(s)
For some reason Valve decided to all but remove the slowdown of Water on Survivors, in Versus Modes. Hard Rain Maps 3 and 4 are pretty much jokes because of this.

Also adds depth to Swamp Fever. :D

This Plugin gives you the power to bring back the slowdown.

Active in configurable gamemodes



CVARS:

l4d2_vswaterbrake_enabled (default 1) - 0 disabled it

l4d2_vswaterbrake_slow (default 0.7) - How much slower will a Survivor be in water - 0.75 equals 75% speed

l4d2_vswaterbrake_jockeyslow (default 0) - Will a Jockeyed Survivor be slowed down still?

l4d2_vswaterbrake_at_low_health (default 0) - Will a limping Survivor be slowed down?

l4d2_vswaterbrake_gamemodeactive (default "versus,teamversus,scavenge,teamscavenge,muta tion12,mutation13") - which gamemodes will the water brake work in




Changelog:

1.0.0 - Release
1.0.1 - Moar Performance
1.0.2 - Bunny Hopping Fix
1.0.3 - fix for Mapchange errorlogs
1.0.4 - introduced Jockey Slow cvar
1.0.5 - fixes for localhosts or 0 Survivor case
1.0.6 - IsValidEntity check against errorlogs added.
1.1.0 - updated to have the same functionality the srsmod submodule has
1.1.1 - added active gamemode convar

Newf 01-06-2010 13:11

Re: [L4D2] Versus Water Break
 
awesome stuff. those maps are definitely jokes now. i'll be putting this in right away.

Necrothug 01-06-2010 13:14

Re: [L4D2] Versus Water Break
 
Awesome! Does anyone know how much the water slows you down in CoOp?

Downtown1 01-06-2010 14:35

Re: [L4D2] Versus Water Break
 
OnGameFrame? :nono:

dacomb 01-06-2010 16:51

Re: [L4D2] Versus Water Break
 
Atomic you rock man.
I know the pubs are going to rage so much when I start using this tonight!! xD
It would be so cruel to set 100% slow down... so they just get stuck :P

AtomicStryker 01-06-2010 18:21

Re: [L4D2] Versus Water Break
 
Quote:

Originally Posted by Downtown1 (Post 1045322)
OnGameFrame? :nono:

I included Frameskips and made it as easy to run as possible. Im quite certain you could run 100 instances of the plugin without slowing a server down :grrr:

SkaP 01-06-2010 19:18

Re: [L4D2] Versus Water Break
 
Been waiting for this one. Thanks, makes Hard Rain well hard again.

Edit: Tested the plugin at 50% it felt just like co-op but it would be nice to have the exact number co-op is at.

Edit2: Ok bit of a problem with bunny-hopping, don't know if it can be fixed. In co-op you bunny-hop in the water it still feels slow, but using this plugin it feels like you accelerate though the air. You can just bunny-hop and avoid the slow down effect all together. Now I doubt most people will pick this up but me and my friends played defrag on quake3 forever and the minute they jump(and feel that acceleration like I did) they'll bunny-hop the whole thing.

Downtown1 01-06-2010 22:40

Re: [L4D2] Versus Water Break
 
Quote:

Originally Posted by AtomicStryker (Post 1045610)
I included Frameskips and made it as easy to run as possible. Im quite certain you could run 100 instances of the plugin without slowing a server down :grrr:

Well I am going to assume it's just not possible to do this without OnGameFrame. That being said your OnGameFrame has a lot of redundant checks.

PHP Code:

            if (!IsClientInGame(target)) continue;
            if (
GetClientTeam(target) != 2) continue;
            if (!
IsPlayerAlive(target)) continue; 

It loops from 1,MaxClients every time and skips all the "invalid" clients. However if we consider the typical situation of 4 alive survivors, 18 maxclients, that means you're skipping 66.66% of the time. Plus calling extra natives which is relatively expensive.

By doing something like this you can reclaim a 66% speedup.

PHP Code:

#define MAX_SUPPORTED_CLIENTS 32
new survivor_clients[MAX_SUPPORTED_CLIENTS];
new 
survivor_count 0;

FindSurvivorIdx(client)

  for(new 
0survivor_count; ++i
    if(
survivor_clients[i] == client) return i;
  return 
0;
}

SwapArrayElements(array[], ab)
{
  if(
== b) return;
  new 
tmp = array[a];
  array[
a] = array[b];
  array[
b] = tmp;
}

//call this when player connects AND hes a survivor AND hes alive
OnPlayerJoinSurvivors(client)
{
  if(!
FindSurvivorIdx(client))
    
survivor_clients[survivor_count++] = client;
}

//call this when a player disconnects OR hes not a survivor OR hes not alive
OnPlayerLeaveSurvivors(client)
{
  new 
idx FindSurvivorIdx(client);
  
//keep the array contiguous
  
if(idx
  {
    
SwapArrayElements(survivor_clientsidxsurvivor_count-1);
    
survivor_count--;
  }
}

////////////

public OnGameFrame()
{
  
//early out checks as before
  
for(new idx 0idx survivor_counti++)
  {
    new 
target survivor_clients[idx];
    
    new 
level GetEntData(targetWaterOffset1);
    
// etc rest of this is the same as before
  
}



dacomb 01-07-2010 01:54

Re: [L4D2] Versus Water Break
 
I used it in Hard Rain tonight. It worked like a charm.

SkaP 01-07-2010 01:58

Re: [L4D2] Versus Water Break
 
Quote:

Originally Posted by dacomb (Post 1046029)
I used it in Hard Rain tonight. It worked like a charm.

What did you have it set too?


All times are GMT -4. The time now is 12:06.

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