Raised This Month: $ Target: $400
 0% 

RegisterHam on several entity classes?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nero-sama
Junior Member
Join Date: Mar 2009
Old 05-27-2016 , 10:43   RegisterHam on several entity classes?
Reply With Quote #1

I'm making a plugin for Sven Co-op that increases damage done to monsters.
RegisterHam( Ham_TakeDamage, "*", "hook_TakeDamage" );

Doesn't work.
Looping it through all monster classes would work, but surely there is a better way of doing it? :S

Nero-sama is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-27-2016 , 11:30   Re: RegisterHam on several entity classes?
Reply With Quote #2

Nope.
__________________
Arkshine is offline
Nero-sama
Junior Member
Join Date: Mar 2009
Old 05-27-2016 , 11:34   Re: RegisterHam on several entity classes?
Reply With Quote #3

Aight, thanks
Nero-sama is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 05-27-2016 , 12:03   Re: RegisterHam on several entity classes?
Reply With Quote #4

If I recall correctly if you register it on monster_headcrab, it will register on every entity derived from CBaseMonster.

See https://forums.alliedmods.net/showthread.php?t=281594 for a similar issue.
__________________
gabuch2 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-27-2016 , 12:16   Re: RegisterHam on several entity classes?
Reply With Quote #5

Quote:
Originally Posted by Shattered Heart Lynx View Post
If I recall correctly if you register it on monster_headcrab, it will register on every entity derived from CBaseMonster.
I believe you want "linked to" here, not "derived from" as it can be misleading. By saying "derived from CBaseMonster" one could think that every class that derives from CBaseMonster will have its virtual functions hooked too, which is not the case.
For instance, CSquadMonster and CCycler have their own virtual tables even though they derive from CBaseMonster.

Just to make things clear.
klippy is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 05-27-2016 , 12:23   Re: RegisterHam on several entity classes?
Reply With Quote #6

I didn't recall correctly
__________________
gabuch2 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 18:42.


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