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

Creating New Entity Type


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
batterytime
Junior Member
Join Date: Jul 2009
Old 07-30-2009 , 14:04   Creating New Entity Type
Reply With Quote #1

How would I go about coding a new entity type? I'm pretty experienced on how to use the Source SDK, and would like to create a new entity type. I can do this easily in the SDK, but how would I get it into an extension/MetaMod plugin? Like, if I had a new class I made with the two files CMyCustomObject.h and CMyCustomObject.cpp, how could I get it to work with a mod?

Also, once it was put into the game, how would I spawn one of that item into the world?

Thanks,
Batterytime
batterytime is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-31-2009 , 06:34   Re: Creating New Entity Type
Reply With Quote #2

That would be exactly the same as how you'd do it in the SDK. MM:S simply adds some useful stuff, like SourceHook.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
BAILOPAN
Join Date: Jan 2004
Old 07-31-2009 , 14:28   Re: Creating New Entity Type
Reply With Quote #3

Quote:
Originally Posted by DJ Tsunami View Post
That would be exactly the same as how you'd do it in the SDK. MM:S simply adds some useful stuff, like SourceHook.
?

It's very difficult to do this. Since MM:S is server-side you can't introduce new code on the client and you can't modify the property networking tables. And since most games are closed-source and binary incompatible with SDK internals, you can't trivially derive from CBaseEntity anyway.

The best you can do is introduce tons of hooks on an existing CBaseEntity derivation, piggy-backing off another entity to introduce new server-side logic.

pRED could give you more examples.
__________________
egg
BAILOPAN is offline
batterytime
Junior Member
Join Date: Jul 2009
Old 07-31-2009 , 16:04   Re: Creating New Entity Type
Reply With Quote #4

Well, I don't believe it has to be as complicated as that, since the "entity" I want to make only has to sit on the server side. It's not even supposed to be visible to other players. Would this be possible?
batterytime is offline
pRED*
Join Date: Dec 2006
Old 07-31-2009 , 16:35   Re: Creating New Entity Type
Reply With Quote #5

Have a look at my CEntity framework (It requires SourceMod )

It's just an abstraction of BAILOPAN's suggestion designed to look as close to normal SDK coding as possible (still a work in progress - use at your own risk).
I've got an updated (read: unstable and fundamentally broken) version sitting half completed locally that contains more code to allow creating new entity names. Let me know if you want to try that.
pRED* is offline
batterytime
Junior Member
Join Date: Jul 2009
Old 07-31-2009 , 16:39   Re: Creating New Entity Type
Reply With Quote #6

Hehehe, pRED, I've actually looked at your framework. However, I'm really new to this, so I'm pretty confused by how this entire SourceMod/MetaMod system works. All I want is to be able to define my own entity with a Think function, and some local variables stored in it. Can your new CEntity framework work?
batterytime 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 12:57.


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