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

Checking entities


Post New Thread Reply   
 
Thread Tools Display Modes
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 02-24-2015 , 23:07   Re: Checking entities
Reply With Quote #11

A stab in the dark, try set its owner in Ham_Touch pre.
__________________
Currently offline for study.
RateX is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 02-26-2015 , 07:54   Re: Checking entities
Reply With Quote #12

Quote:
Originally Posted by RateX View Post
A stab in the dark, try set its owner in Ham_Touch pre.
Not quite sure what you mean. Hamlet explained that there can only be 1 owner, and that's the player himself.

The entity is a SOLID_BBOX, how do i prevent it from blocking a door(to let it pass through, like semiclip), and other entities by their classname?
safetymoose is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-26-2015 , 09:38   Re: Checking entities
Reply With Quote #13

It can have only one owner at a time, this doesn't mean that you can't change it. I said that AFAIK it can't have two owners at the same moment.

Now, register touch for your ent, check if toucher is from the few ents you want to allow and use set_pev(touched, pev_owner, toucher)

Try something like that.
__________________
HamletEagle is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 02-26-2015 , 16:10   Re: Checking entities
Reply With Quote #14

Well the problem is that there are a few entities on the maps, not just one. I dont think i can get all of the IDs(door #1, door #2, door #3 etc...). That's why i asked if i can do it by classname, if the entity touches a door(any door), it should let the door open and close as normal. It shouldnt block the door.

but, as you said, the owner is assigned by the ID.

for example, the entity is spawned next to a rotating door. Someone tries to open the door, and the door is stuck. Here's another example, the entity is spawned in the path of a func_train, and it's blocking it.

How can i catch in general what entities are going to touch it, and if it's one of the entities it's not supposed to block, make that entity it's owner, so it can pass through?(I can perform that last check by it's classname).

How should i say it? I want my entity immune to func_doors and func_trains

Last edited by safetymoose; 02-26-2015 at 16:11.
safetymoose is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-27-2015 , 10:35   Re: Checking entities
Reply With Quote #15

PHP Code:
register_touch("your_ent""func_door""CBaseEntity_Touch")
register_touch("your_ent""func_trains""CBaseEntity_Touch"
In this hook set the owner. You can get all func_doors id's from the map, but is useless when you can do it as above.
__________________

Last edited by HamletEagle; 02-27-2015 at 10:35.
HamletEagle is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 03-07-2015 , 07:06   Re: Checking entities
Reply With Quote #16

yeah, but setting the owner requires an ID, and i dont know how to get the ID of the touched entity from the map...
safetymoose is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-07-2015 , 08:31   Re: Checking entities
Reply With Quote #17

You have it in the function header, lol.
PHP Code:
public touch(touchedtoucher
toucher -> this is an index
touched -> this is an index
__________________
HamletEagle is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 03-07-2015 , 10:00   Re: Checking entities
Reply With Quote #18

The plugin i'm working on is the ZP Extra Sandbags by LARP - https://forums.alliedmods.net/showthread.php?t=79578

I cant seem to get the touch right, what am i doing wrong?
PHP Code:
register_touch("func_wall""func_door""CBaseEntity_Touch")
register_touch("func_wall""func_door_rotating""CBaseEntity_Touch")
register_touch("func_wall""func_train""CBaseEntity_Touch")

public 
CBaseEntity_Touch(touchedtoucher)
{
    
//Check if it's the right entity
    
new classname[32]
    
entity_get_stringtouched EV_SZ_classname classname31 )
    if( !
equali(classname,"amxx_pallets") )
        return 
HAM_IGNORED;
    
    
set_pev(touchedpev_ownertoucher)
    
    return 
PLUGIN_CONTINUE;


Last edited by safetymoose; 03-07-2015 at 10:28.
safetymoose is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 03-07-2015 , 11:02   Re: Checking entities
Reply With Quote #19

Hmm..
PHP Code:
register_touch("func_wall""func_door""CBaseEntity_Touch")
register_touch("func_wall""func_door_rotating""CBaseEntity_Touch")
register_touch("func_wall""func_train""CBaseEntity_Touch"
FYI, you are registering touch between the entities that have classname declared in the above code, so:
PHP Code:
 //Check if it's the right entity
    
new classname[32]
    
entity_get_stringtouched EV_SZ_classname classname31 )
    if( !
equali(classname,"amxx_pallets") )
        return 
HAM_IGNORED
will always return HAM_IGNORED
__________________
Currently offline for study.
RateX is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-07-2015 , 11:35   Re: Checking entities
Reply With Quote #20

This "right entity" classname must be registered in register_touch function. Your if statement will be always false. Instead of func_wall use amxx_pallets in register_touch. I think you want to check if it touch any of the entities above(door and so on).
__________________
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 19:05.


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