Raised This Month: $ Target: $400
 0% 

Custom entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 04-23-2011 , 09:55   Custom entities
Reply With Quote #1

I have in a map a trigger entity called "info_open". So I wanted to hook the touch like this:

PHP Code:
register_touch("info_open""player""Forward_InfoTouch"
PHP Code:
public Forward_InfoTouch(iEntityid)
{
    if(
IsUserAlive(id))
    {
        
#if defined DEBUG
        
client_print(idprint_chat"%s Debug: Info entity touch."PLUGIN)
        
#endif
    
}

And yes, I am alive and the size of the entity is enough big.
bibu is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-23-2011 , 10:45   Re: Custom entities
Reply With Quote #2

Quote:
I have in a map a trigger entity called "info_open". So I wanted to hook the touch like this:
Did you spawn it manually via AMXX or did you place it on a map in hammer editor?
__________________

SonicSonedit is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-23-2011 , 10:47   Re: Custom entities
Reply With Quote #3

Quote:
Originally Posted by SonicSonedit View Post
did you place it on a map in hammer editor?
Exactly. When I open it with BSP Viewer, the entitiy is successfully spawned.
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2011 , 10:50   Re: Custom entities
Reply With Quote #4

register_touch should work. So, I can guess only either IsUserAlive is wrong, or you don't touch your entity (meaning, touch not detected or size problem)
__________________
Arkshine is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 04-23-2011 , 11:05   Re: Custom entities
Reply With Quote #5

Arkshine is right.
Anyway, try this
PHP Code:
 public Forward_InfoTouch(iEntityid)
        
client_print(0print_chat"%s Debug: Info entity touch - Entity: %d, id: %d "PLUGINiEntityid
and see what happens.
__________________

SonicSonedit is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 04-23-2011 , 15:30   Re: Custom entities
Reply With Quote #6

i tried sometime with trigger entities, but seems engine won't detect trigger entities on toucn for example

PHP Code:
register_touch"trigger_hurt""player""dsadas" 
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-23-2011 , 16:19   Re: Custom entities
Reply With Quote #7

Quote:
Originally Posted by tuty View Post
i tried sometime with trigger entities, but seems engine won't detect trigger entities on toucn for example

PHP Code:
register_touch"trigger_hurt""player""dsadas" 
Touching triggers work fine.
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-23-2011 , 16:19   Re: Custom entities
Reply With Quote #8

How can the engine create a "info_open" entity ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-23-2011 , 16:22   Re: Custom entities
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
How can the engine create a "info_open" entity ?
They can exist on map, but engine deletes them upon loading because they are not valid. You have to hook it in pfn_keyvalue, and check "classname", and then create new entity with something like info_target, and then setting pev_classname.
__________________
xPaw is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-23-2011 , 16:33   Re: Custom entities
Reply With Quote #10

Quote:
Originally Posted by xPaw View Post
They can exist on map, but engine deletes them upon loading because they are not valid. You have to hook it in pfn_keyvalue, and check "classname", and then create new entity with something like info_target, and then setting pev_classname.
Exactly, that's why it doesn't work then. Could you help me more with that?
bibu 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 19:45.


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