Raised This Month: $51 Target: $400
 12% 

Create custom entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 03-10-2014 , 12:45   Create custom entity
Reply With Quote #1

I want to create a customized simplest entity. First I just want to make an inherited from prop_dynamic entity, and make it to spawn on the map with type prop_dynamic2. But I do not quite understand how can I do it.
Do I have to hook all the methods and fields of CDynamicProp, CBaseEntity and create clones of these classes with redirections for all the functions?

And will it work? :
PHP Code:
LINK_ENTITY_TO_CLASSprop_dynamic2CDynamicProp2 ); 
I do not understand this function and I can't hook the original one from server.dll
But I see a lot of
Quote:
CEntityFactory<CDynamicProp>::Create(char const*)
in server.dll (for each type of entity), it looks like they are created with LINK_ENTITY_TO_CLASS


I use instruction:
https://developer.valvesoftware.com/wiki/Npc_New.cpp (hl2sdk-2013\game\server\hl2\monster_dummy.cpp)
https://developer.valvesoftware.com/...fining_the_NPC

Last edited by kadet.89; 03-10-2014 at 13:07.
kadet.89 is offline
Send a message via Skype™ to kadet.89
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 03-11-2014 , 02:36   Re: Create custom entity
Reply With Quote #3

two questions:
1) Is it still up to date?
2) Is there any easier way?
kadet.89 is offline
Send a message via Skype™ to kadet.89
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 03-11-2014 , 08:38   Re: Create custom entity
Reply With Quote #4

Maybe checkout this extension
https://forums.alliedmods.net/showthread.php?t=161331
__________________
...
Oshizu is offline
donrevan
AlliedModders Donor
Join Date: Jul 2010
Old 03-11-2014 , 11:41   Re: Create custom entity
Reply With Quote #5

Quote:
Originally Posted by kadet.89 View Post
two questions:
1) Is it still up to date?
2) Is there any easier way?
It highly depends on the game you're developing for but you mostly have to update GameData only.
You should stick with CEntity because its developed for thoose things.
donrevan is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-11-2014 , 11:45   Re: Create custom entity
Reply With Quote #6

Quote:
Originally Posted by kadet.89 View Post
two questions:
1) Is it still up to date?
2) Is there any easier way?
1) It'll need a gamedata update - the centity.games.txt shipped with TFDodgeball is closer, but is still old. As the thread says, the classes are based around TF2, if you're working with another game you'll need to make some minor changes (mostly just removing stuff from CPlayer).

2) No, there isn't. CEntity basically handles what you correctly identified needs to be done - it hooks base class functions allowing them to be overridden, and it hooks into the internal implementation that LINK_ENTITY_TO_CLASS uses to add your custom entity to the factory list. It just wraps all this in a nice interface.

Quote:
Originally Posted by Oshizu View Post
That extension is using a heavily modified copy of CEntity.
__________________
asherkin 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 13:04.


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