AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Survivor Utilities (API) (v 1.5.1) [19-Mar-23] (https://forums.alliedmods.net/showthread.php?t=335683)

Earendil 12-24-2021 23:23

[L4D & L4D2] Survivor Utilities (API) (v 1.5.1) [19-Mar-23]
 
1 Attachment(s)
About:
I’m making some plugins that changes survivor speeds and adds effects (better freeze, intoxication, bleeding, ect), to prevent multiple calls and bugs between plugins making the same effect, and to prevent redundancy, I have done this plugin that acts as an API, to allow plugins to work well together.
If you want to make plugins using this, you are free to do, also you can install this plugin in your server and change global player speeds with convars (to acces to other features you need to use other plugins, that I will upload too when I complete them).

Description:

Survivor movement speed modify:
This plugin modifies survivor moving speeds, jump and fall speed don't change, so the speed effect feels more realistic.
Current speeds that can be modified by ConVar:
  • Running speed.
  • Walking speed.
  • Crouch speed.
  • Moving speed on water.
  • Limping speed (when survivor health is lower than 40 by default).
  • Critical speed (probably will have other name, but this refers to the survivor speed when he has been incapacitated once and HP falls to 1).
  • Movement speed while using an sniper scope.
  • Exhaust speed (this is an API feature that will only be activated by other plugins).

Rules of how speeds are being assigned:
  • Run, walk or crouch speeds are independent, and won't restrict the others (you can set walk speed faster than run speed if you want).
  • If the survivor is having one or more conditions that decreases the main speed, it will set the most restrictive.
  • If a restrictive speed has a higher value than the main speed, it won't be applied, restrictive speeds don't boost main speeds.
  • Adrenaline will prevent survivors to lose speed due to restrictions, just like in the original game.
Other plugins can use the Natives provided in this plugin to change specific survivor speeds, for perks, RPG, or anything you can imagine.

IMPORTANT Changes in the speed system. The plugin now has 2 systems or kernels to modify survivor speeds:
  • 1 - Legacy kernel:
    It uses Left 4 DHooks forwards to change survivor speeds. It has a much lower chance to conflict with other plugins that change player speeds, since the method used is not very often used. But in the other hand speeds are restricted between 65 and 650 units. Any speed under 65 will make survivors stop moving, and values over 650 will have no effect. Moreover, when boosted players jump they will notice an strange push in the direction of their movement.
  • 2 - New kernel:
    This one doesn't require Left 4 DHooks, if you don't have that plugin installed, only this kernel will work. It uses the "m_flLaggedMovementValue" netprop to scale survivor speeds. This kernel will conflict with other plugins that uses the same system to scale speeds, but the limitations are removed, you can set speed value with this kernel without restrictions. This kernel works getting the mechanics from here.
  • What kernel should be used?
    It depends of the situation, by default the new kernel is enabled and is the most recomended option, but in case you start experiencing incompatibilities with other plugins, you should use the legacy kernel.
Survivor conditions accesible from natives and forwards:
  • Bleeding: Survivors will lose health over time, bleeding can be stopped if the survivor uses a medkit.
  • Intoxication: Survivors will lose health over time due to an intoxication, it can be stopped if the survivor uses pain pills or adrenaline.
  • Improved freeze: Survivor is unable to move, shoot, reload or shove, also a screen effect is displayed while the survivor is frozen.
  • Exhaustion, while exhausted the survivor will lose movement speed, maxed shove penalty and increased recoil, a screen effect is displayed (thanks to Silvers for the fog_volume and postprocess code). Exhaust can be cancelled with adrenaline, also if the survivor doesn’t move will recover faster.

Health, defib and revive hooks.
  • Detoured survivor healing, reviving and defibrillating game functions.
  • Survivor revive heal or defib duration can be override with GlobalForwards.
  • Functions can also be blocked to prevent survivors to revive or perform healing.


Natives
Spoiler
GlobalForwards
You can hook, change or even block plugin natives via GlobalForwards.
Spoiler
ConVars:
Spoiler
Dependences:by Silvers.


Test Plugin:
The plugin l4d_su_testplugin.smx includes admin commands and has all GlobalForwards and Natives tested.

Extension:
Also I have included a plugin extension l4d_su_notifications.smx that will notify to the survivors when effects start/end.

Thanks:
To Silvers for the help with the postprocess controller and fog_volume solutions and helping with Natives and Forwards.
Source Code

Changelog:
Spoiler

Earendil 12-24-2021 23:23

Re: [L4D & L4D2] Surivor Utilities (API)
 
I'm making some plugins to show how to take the benefit of this utility:

Survivor Sprint, Stamina and Exhaustion
Use this one as a guide of how to manipulate player speeds. Since Natives change player absolute speed, this plugins doesn't override permanently the survivor speed of other plugins.

a2121858 12-26-2021 21:55

Re: [L4D & L4D2] Surivor Utilities (API) (v 1.0.3) [25-Dec-21]
 
Thank you for your gift.:3

thewintersoldier97 12-27-2021 05:38

Re: [L4D & L4D2] Surivor Utilities (API) (v 1.0.3) [25-Dec-21]
 
Wow, very nice plugin :D Great work Earendil!

Earendil 12-30-2021 07:48

Re: [L4D & L4D2] Survivor Utilities (API) (v 1.1) [30-Dec-21]
 
New update to 1.1

Now you can add an exhaustion amount to survivors. Any plugin compiled with an older version will still work, exhaustion can be stacked just like the other effects. Also I fixed some bugs.

Earendil 01-01-2022 20:12

Re: [L4D & L4D2] Survivor Utilities (API) (v 1.1.1) [01-Jan-21]
 
Ok I was messing everything with timers. Now they are fixed and no Handle errors related to timers should appear.

Sev 01-04-2022 05:56

Re: [L4D & L4D2] Survivor Utilities (API) (v 1.1.1) [01-Jan-21]
 
L 01/03/2022 - 17:33:34: [SM] Exception reported: SU_GetSpeed Error: Client 9 is not survivor.
L 01/03/2022 - 17:33:34: [SM] Blaming: l4d_survivor_utilities.smx
L 01/03/2022 - 17:33:34: [SM] Call stack trace:
L 01/03/2022 - 17:33:34: [SM] [0] ThrowNativeError
L 01/03/2022 - 17:33:34: [SM] [1] Line 1160, l4d_survivor_utilities.sp::Native_GetFreeze
L 01/03/2022 - 17:33:34: [SM] [3] SU_IsFrozen
L 01/03/2022 - 17:33:34: [SM] [4] Line 361, l4d_survivor_utilities.sp::Event_Player_Repla ced

Earendil 01-06-2022 18:24

Re: [L4D & L4D2] Survivor Utilities (API) (v 1.1.1) [01-Jan-21]
 
Quote:

Originally Posted by Sev (Post 2767603)
L 01/03/2022 - 17:33:34: [SM] Exception reported: SU_GetSpeed Error: Client 9 is not survivor.
L 01/03/2022 - 17:33:34: [SM] Blaming: l4d_survivor_utilities.smx
L 01/03/2022 - 17:33:34: [SM] Call stack trace:
L 01/03/2022 - 17:33:34: [SM] [0] ThrowNativeError
L 01/03/2022 - 17:33:34: [SM] [1] Line 1160, l4d_survivor_utilities.sp::Native_GetFreeze
L 01/03/2022 - 17:33:34: [SM] [3] SU_IsFrozen
L 01/03/2022 - 17:33:34: [SM] [4] Line 361, l4d_survivor_utilities.sp::Event_Player_Repla ced

Did it happen in VS mode? I think it happened due to team change, I will take a look.

Sev 01-07-2022 05:03

Re: [L4D & L4D2] Survivor Utilities (API) (v 1.1.1) [01-Jan-21]
 
Quote:

Originally Posted by Earendil (Post 2767819)
Did it happen in VS mode? I think it happened due to team change, I will take a look.

Probably. I admittedly only retrieved the error from my logs but I have noticed some VS games lately on my server, so it was probably in that mode.

Earendil 01-09-2022 18:09

Re: [L4D & L4D2] Survivor Utilities (API) (v 1.1.1) [01-Jan-21]
 
Quote:

Originally Posted by Sev (Post 2767853)
Probably. I admittedly only retrieved the error from my logs but I have noticed some VS games lately on my server, so it was probably in that mode.

I added a check when a player is replaced by a bot when survivors change teams. This error message was harmless, like some of them, but they are there to point when a plugin is trying to get incorrect data from players, like it happened with that message error.

EDIT: I'm adding a bigger update that will allow plugins to modify revive/heal/defib duration per player and also scale healing animations (the animation part is almost done).


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

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