Raised This Month: $32 Target: $400
 8% 

Player doesn't touch a SOLID_TRIGGER entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 01-14-2020 , 14:56   Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #1

Hi, I have an entity (a sprite) and it is setup like this:


PHP Code:
new iEntity create_entity("func_button");
entity_set_int(iEntityEV_INT_solidSOLID_TRIGGER);
entity_set_int(iEntityEV_INT_movetypeMOVETYPE_NONE);
entity_set_model(iEntityg_szTimerSprites[iType]);
entity_set_size(iEntityFloat:{-16.0, -128.00.0}, Float:{16.0128.0128.0}); 
When I try to hook a touch, however, the player never seems to touch the entity. The code for it is:

PHP Code:
register_touch("player","*","hook_touch");
public 
hook_touch(playerentity) {
    new 
classname[32];

    
entity_get_string(entityEV_SZ_classnameclassname31);

    
console_print(player"Class name touched: %s"classname);

I never get my entity touch, even though I walk through it. If I change the EV_INT_solid to SOLID_BBOX, it works just fine.

Any ideas why this is happening?

Thank you!
__________________
We all live under the same sky but we have different horizons.

Last edited by bLacK-bLooD; 01-14-2020 at 15:46.
bLacK-bLooD is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-14-2020 , 18:46   Re: Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #2

Long shot but try spawning it(dllfunc_spawn). Just a guess but might solve your problem.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-14-2020 , 19:16   Re: Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #3

Try this:
PHP Code:
new iEntity create_entity("func_button")
    
if( !
iEntity )
    
set_fail_state"Error creating entity" );
    
entity_set_int(iEntityEV_INT_movetypeMOVETYPE_NONE);
entity_set_model(iEntityg_szTimerSprites[iType]);
entity_set_size(iEntityFloat:{-16.0, -128.00.0}, Float:{16.0128.0128.0}); 
dllfuncDLLFunc_Spawn iEntity );
entity_set_int(iEntityEV_INT_solidSOLID_TRIGGER); 
__________________
Bugsy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-14-2020 , 22:07   Re: Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #4

I had been using sprite entity with solid_trigger as you need, but with fakemetas detection for touch:
Code:
public pfn_touch( ent1, id )
{                   
          new classname[ 32 ], name[ 32 ]
          entity_get_string( ent1, EV_SZ_classname, classname, 31 )
                    
          if( equal( classname, "your_ent_classname" ) )
          {
If this matters: i put solid_trigger atribute after all others (like bugsy's example) and it didnt require dllfunc_spawn func calling
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is online now
fl0werD
Senior Member
Join Date: May 2011
Old 01-15-2020 , 11:00   Re: Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #5

Just set not MOVETYPE_NONE.
fl0werD is offline
Send a message via ICQ to fl0werD
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 01-15-2020 , 11:49   Re: Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #6

Quote:
Originally Posted by JocAnis View Post
I had been using sprite entity with solid_trigger as you need, but with fakemetas detection for touch:
Code:
public pfn_touch( ent1, id )
{                   
          new classname[ 32 ], name[ 32 ]
          entity_get_string( ent1, EV_SZ_classname, classname, 31 )
                    
          if( equal( classname, "your_ent_classname" ) )
          {
If this matters: i put solid_trigger atribute after all others (like bugsy's example) and it didnt require dllfunc_spawn func calling
This worked, thank you!
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-16-2020 , 04:17   Re: Player doesn't touch a SOLID_TRIGGER entity
Reply With Quote #7

Detecing touch is the same with both engine and fakemeta so this is not the issue. However you should use engine in order to catch only the touches you need, not all of them.
__________________

Last edited by HamletEagle; 01-16-2020 at 04:17.
HamletEagle 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:52.


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