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

Checking entities


Post New Thread Reply   
 
Thread Tools Display Modes
safetymoose
Senior Member
Join Date: Feb 2015
Old 03-07-2015 , 17:45   Re: Checking entities
Reply With Quote #21

Quote:
Originally Posted by HamletEagle View Post
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).
Exactly, but i cant seem to catch that touch.

PHP Code:
register_touch("amxx_pallets""func_door""CBaseEntity_Touch")
register_touch("amxx_pallets""func_door_rotating""CBaseEntity_Touch")
register_touch("amxx_pallets""func_train""CBaseEntity_Touch")

public 
CBaseEntity_Touch(touchedtoucher)
{    
    
set_pev(touchedpev_ownertoucher)

I even tried sending a message in chat when they touch, but nothing shows up, which means i havent done the touch right. I've tried this combination before, but still failed to accomplish it.
safetymoose is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 03-10-2015 , 00:47   Re: Checking entities
Reply With Quote #22

you can learn more about touch here https://forums.alliedmods.net/showthread.php?t=52679
wicho is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-10-2015 , 12:39   Re: Checking entities
Reply With Quote #23

Are this palets solid entities ?
PHP Code:
stock boolIsAimingAtEnt(id, const EntClassName[])
{
    if(
EntClassName[0] == EOS || !is_user_alive(id))
    {
        return 
false
    
}
    
    new 
TargetBodyClassName[20]
    
get_user_aiming(idTargetBody)
    
pev(Targetpev_classnameClassNamecharsmax(ClassName))
    if(
equal(ClassNameEntClassName))
    {
        return 
true
    
}  
    return 
false

This stock had a mistake, fixed(thanks to claudiuhks for seeing it).
__________________
HamletEagle is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 03-10-2015 , 12:46   Re: Checking entities
Reply With Quote #24

yes are solid, set_pev(ent,pev_solid,SOLID_BBOX)
wicho is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-10-2015 , 12:55   Re: Checking entities
Reply With Quote #25

@wicho, from that tutorial no one is able to understand anything, is too general.

@safetymoose, Your problem is because you don't know function syntax.

PHP Code:
register_touch("amxx_pallets""func_door""CBaseEntity_Touch")
register_touch("amxx_pallets""func_door_rotating""CBaseEntity_Touch")
register_touch("amxx_pallets""func_train""CBaseEntity_Touch"
Your code will only execute when a func_* entity will touch and amxx_pallets, but this will never happen. amxx_pallets are supposed to touch func_* ents, so reverse this two in register_touch

Func: register_touch(touched, toucher, function)
First is touched, second is toucher.
__________________

Last edited by HamletEagle; 03-10-2015 at 12:56.
HamletEagle is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 03-10-2015 , 17:29   Re: Checking entities
Reply With Quote #26

Quote:
Originally Posted by HamletEagle View Post
Your code will only execute when a func_* entity will touch and amxx_pallets, but this will never happen. amxx_pallets are supposed to touch func_* ents, so reverse this two in register_touch

Func: register_touch(touched, toucher, function)
First is touched, second is toucher.
Believe me, i tried it both ways, swapped them around. I even tried to send a message when they touched to confirm it. Still nothing.

this is the current attempt
PHP Code:
register_touch("func_door""amxx_pallets""CBaseEntity_Touch")
register_touch("func_door_rotating""amxx_pallets""CBaseEntity_Touch")
register_touch("func_train""amxx_pallets""CBaseEntity_Touch")

public 
CBaseEntity_Touch(touchedtoucher)
{    
    
set_pev(toucherpev_ownertouched)

Doesnt work, i dont know if the touch is being registered...

Last edited by safetymoose; 03-10-2015 at 17:29.
safetymoose is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 03-10-2015 , 20:28   Re: Checking entities
Reply With Quote #27

Quote:
Originally Posted by HamletEagle View Post
@wicho, from that tutorial no one is able to understand anything, is too general.

@safetymoose, Your problem is because you don't know function syntax.

PHP Code:
register_touch("amxx_pallets""func_door""CBaseEntity_Touch")
register_touch("amxx_pallets""func_door_rotating""CBaseEntity_Touch")
register_touch("amxx_pallets""func_train""CBaseEntity_Touch"
Your code will only execute when a func_* entity will touch and amxx_pallets, but this will never happen. amxx_pallets are supposed to touch func_* ents, so reverse this two in register_touch

Func: register_touch(touched, toucher, function)
First is touched, second is toucher.
¿What?

PHP Code:
   if(e1->v.solid != SOLID_NOT) {

      
SV_SetGlobalTrace(tr);
      
gEntityInterface.pfnTouch(e1e2);
   }
   if(
e2->v.solid != SOLID_NOT) {

      
SV_SetGlobalTrace(tr);
      
gEntityInterface.pfnTouch(e2e1);
   } 
For some nice reason, you use to talk about engine without knowing. Search for OSHLDS, OpenHLDS, or any other reference, before talking
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 03-13-2015 , 20:53   Re: Checking entities
Reply With Quote #28

Quote:
Originally Posted by Metalicross
PHP Code:
if(e1->v.solid != SOLID_NOT) { 
 
      
SV_SetGlobalTrace(tr); 
      
gEntityInterface.pfnTouch(e1e2); 
   } 
   if(
e2->v.solid != SOLID_NOT) { 

      
SV_SetGlobalTrace(tr); 
      
gEntityInterface.pfnTouch(e2e1); 
   } 
For some nice reason, you use to talk about engine without knowing. Search for OSHLDS, OpenHLDS, or any other reference, before talking
Will this catch the touch between the 2 entities? And if so, do i have to set this in a task to check every 0.1 seconds?
safetymoose 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 11:44.


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