Raised This Month: $276 Target: $400
 69% 

[L4D & L4D2] Left 4 DHooks Direct (1.23) [27-Sep-2020]


Post New Thread Reply   
 
Thread Tools Display Modes
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 02-27-2020 , 00:47   Re: [L4D & L4D2] Left 4 DHooks Direct (1.1) [27-Feb-2020]
Reply With Quote #21

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.
__________________

Last edited by Silvers; 02-27-2020 at 02:08.
Silvers is offline
Ja-Forces
Senior Member
Join Date: Jul 2009
Location: Leningrad
Old 02-27-2020 , 00:48   Re: [L4D & L4D2] Left 4 DHooks Direct (1.1) [27-Feb-2020]
Reply With Quote #22

Great job! Useful Stuff
__________________
Ja-Forces is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 02-27-2020 , 05:33   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #23

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.
__________________
Silvers is offline
Kai0205
Junior Member
Join Date: Sep 2017
Old 02-27-2020 , 06:07   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #24

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" ?
Kai0205 is offline
hoanganh81097
Senior Member
Join Date: Apr 2016
Old 02-27-2020 , 06:51   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #25

native L4D_OnGetScriptValueInt still wont work. Plugin cant spawn more "MaxSpecials"
hoanganh81097 is offline
TiTz
Member
Join Date: Jan 2020
Old 02-27-2020 , 08:52   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #26

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

Regards

TiTz
TiTz is offline
Sev
Veteran Member
Join Date: May 2010
Old 02-27-2020 , 09:23   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #27

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
Sev is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine
Old 02-27-2020 , 13:45   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #28

offtopic.

Quote:
Originally Posted by Sev View Post
1. Randomized witch behavior...standing or sitting at random...
this is already done: Drunked witch.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch)
[My plugins] [My tools] [GitHub] [Articles]
Dragokas is offline
xZk
Senior Member
Join Date: Nov 2017
Location: cl
Old 02-27-2020 , 14:30   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #29

Quote:
Originally Posted by hoanganh81097 View Post
native L4D_OnGetScriptValueInt still wont work. Plugin cant spawn more "MaxSpecials"
try this: https://forums.alliedmods.net/showthread.php?p=2535972
xZk is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 02-27-2020 , 16:15   Re: [L4D & L4D2] Left 4 DHooks Direct (1.3) [27-Feb-2020]
Reply With Quote #30

Quote:
Originally Posted by Kai0205 View Post
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 View Post
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 View Post
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.
__________________

Last edited by Silvers; 02-27-2020 at 21:04.
Silvers is offline
Reply


Thread Tools
Display Modes

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 06:59.


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