AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Left 4 DHooks Direct (1.150) [06-May-2024] (https://forums.alliedmods.net/showthread.php?t=321696)

Silvers 02-27-2020 00:47

Re: [L4D & L4D2] Left 4 DHooks Direct (1.1) [27-Feb-2020]
 
PHP Code:

sequence g_iQueuedThrow[client] + 760

Code:

#define L4D2_ACT_HULK_THROW                        761
#define L4D2_ACT_TANK_OVERHEAD_THROW                762
#define L4D2_ACT_HULK_ATTACK_LOW                763
#define L4D2_ACT_TERROR_ATTACK_MOVING                790

#define L4D1_ACT_HULK_THROW                        1254
#define L4D1_ACT_TANK_OVERHEAD_THROW                1255
#define L4D1_ACT_HULK_ATTACK_LOW                1256
#define L4D1_ACT_TERROR_ATTACK_MOVING                1282

The demo plugin has an example that modifies tank throw to always use the under arm throw anim.

Remember these are not models "m_nSequence" but the "ACT_*" sequence numbers.



EDIT: Thanks to Accelerator74 for pointing out the extension used a posthook instead which corresponds to the actual models "m_nSequence" number while the prehook handles the "ACT_*" values. So I'll be adding changing the current animation hooks to append "Pre" to their forward names, and adding the post hooks to use the current forward names, this will maintain expected behaviour like the extension without plugins needing to modify anything.



This whole project has taken over 3 weeks, over 200 hours. I rushed through without looking closely at everything and wondered why the animation was using "ACT_*" instead of "m_nSequence", should have looked again more closely.

Ja-Forces 02-27-2020 00:48

Re: [L4D & L4D2] Left 4 DHooks Direct (1.1) [27-Feb-2020]
 
Great job! Useful Stuff :)

Silvers 02-27-2020 05:33

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
Another major change:

Code:

1.3 (27-Feb-2020)
    - Added forward "L4D_OnGetRandomPZSpawnPosition" to display when the game selects a position.
    - Added native "L4D_GetRandomPZSpawnPosition" to select a random position.
    - Thanks to "Accelerator74" for requesting.

    - Added "L4D2_OnSelectTankAttackPre" forward to handle "ACT_*" activity numbers.
    - Changed "L4D2_OnSelectTankAttack" to use "m_nSequence" numbers instead, just like the extension did.
    - Changed the "AnimHook" functions to use "ACT_*" activity numbers (pre-hook) and "m_nSequence" animation number (post-hook).
    - Existing plugins using "L4D2_OnSelectTankAttack" no longer need to change anything.
    - Existing plugins with the new "AnimHook" hook can now use normal model "m_nSequence" sequence numbers in the post hook.
    - Thanks to "Accelerator74" for reporting the fix.

    - Updated: Test plugin to demonstrate each change.
    - Updated: Plugin, Include and GameData files.


Kai0205 02-27-2020 06:07

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
I'm so sorry that I don't understand English, I want to ask something briefly.
This plugin will replace "[L4D2] Left 4 Downtown 2" ?

hoanganh81097 02-27-2020 06:51

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
native L4D_OnGetScriptValueInt still wont work. Plugin cant spawn more "MaxSpecials" :(

TiTz 02-27-2020 08:52

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
Hi Silvers,

Just installed this on my L4D1 server - sourcemod 1.10 and installed DHooks (Dynamic Hooks - Dev Preview) as instructed.

But on booting the server I got this error:

L 02/27/2020 - 13:37:16: [SM] Exception reported: Invalid Handle 0 (error 4)
L 02/27/2020 - 13:37:16: [SM] Blaming: left4dhooks.smx
L 02/27/2020 - 13:37:16: [SM] Call stack trace:
L 02/27/2020 - 13:37:16: [SM] [0] SDKCall
L 02/27/2020 - 13:37:16: [SM] [1] Line 1370, C:\Servers\L4D2\left4dead2\addons\sourcemod\s cripting\left4dhooks.sp::OnMapStart

Regards

TiTz

Sev 02-27-2020 09:23

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
Very innovative stuff here.

Like the AI for plugins really.

Now all we need is...

1. Randomized witch behavior...standing or sitting at random...aggro to silent and vice versa
2. Create a survivor
3. Driveable Jimmy Gibbs car and other vehicles like the helicopter
4. Survivors can lock doors/SI can open doors without needing to bust them down
5. Playable common infected

Dragokas 02-27-2020 13:45

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
offtopic.

Quote:

Originally Posted by Sev (Post 2685191)
1. Randomized witch behavior...standing or sitting at random...

this is already done: Drunked witch.

xZk 02-27-2020 14:30

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
Quote:

Originally Posted by hoanganh81097 (Post 2685182)
native L4D_OnGetScriptValueInt still wont work. Plugin cant spawn more "MaxSpecials" :(

try this: https://forums.alliedmods.net/showthread.php?p=2535972

Silvers 02-27-2020 16:15

Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
 
Quote:

Originally Posted by Kai0205 (Post 2685181)
I'm so sorry that I don't understand English, I want to ask something briefly.
This plugin will replace "[L4D2] Left 4 Downtown 2" ?

Yes.


Quote:

Originally Posted by TiTz (Post 2685189)
But on booting the server I got this error

Thanks, fixed. Forgot to add a check to exclude L4D1 from Director Variables fix.


Quote:

Originally Posted by hoanganh81097 (Post 2685182)
native L4D_OnGetScriptValueInt still wont work. Plugin cant spawn more "MaxSpecials" :(

Well it's definitely being read again. Maybe the director already has the value and won't change when reading a new one, but that doesn't seem right since on some maps the var is triggered many times during gameplay and dynamically changed.

Edit: so I added this to test, used z_spawn hunter, and it was limiting the number of special infected allowed to spawn. Each time I used z_spawn it would trigger "MaxSpecials" below. See the results:
PHP Code:

public Action L4D_OnGetScriptValueInt(const char[] keyint &retVal)
{
    if (
StrEqual(key"MaxSpecials") )
    {
        
PrintToServer("TEST_FWD ############## %s %d"keyretVal);
        
retVal = -1// No specials can spawn.
        
retVal 0// 1 special can spawn.
        
retVal 1// 2 specials can spawn.
        
return Plugin_Handled;
    }
    return 
Plugin_Continue;


It's strange setting the value to 1 less than the amount you want to spawn, but that's just how it seems to work. That's the games odd behaviour, left4dhooks isn't randomly setting -1 on the variable you change.

When left4dhooks starts, it calls the variable "MaxSpecials" which triggers the "L4D_OnGetScriptValueInt" forward with "MaxSpecials" variable.

If there are any other director variables not being set because they're triggered too early let me know and I'll add them to also trigger forwards when the plugin starts.




Updated:
Code:

1.4 (28-Feb-2020)
    - AnimHooks no longer affect the same client index if the previous user disconnected and someone else connected.
    - Clarified AnimHooks details in the include file. All AnimHooks are removed on map change.
    - Fixed L4D1: "Invalid Handle" errors caused by Director Variables fix. Thanks to "TiTz" for reporting.



All times are GMT -4. The time now is 17:05.

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