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

FM_Touch help me?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
felipemilralze
Senior Member
Join Date: Jul 2011
Location: Brazil
Old 05-13-2014 , 23:51   FM_Touch help me?
Reply With Quote #1

can someone explain me but suffers FM Touch?
felipemilralze is offline
Send a message via MSN to felipemilralze Send a message via Skype™ to felipemilralze
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-14-2014 , 00:05   Re: FM_Touch help me?
Reply With Quote #2

"Touch" is called whenever an entities touchs another entity (or world itself).

It has 2 arguments:

1) "pentTouched" which is the touched entity
2) "pentOther" which is the toucher, this one can be the world

Whenever "touch" is called, you must guess that 2 touch forwards will be called. The second callback will have the args flipped.

If ent1 touches ent2 and ent2 is not world:

Touch(ent1, ent2)
Touch(ent2, ent1)

Use register_touch instead of using Fakemeta's FM_Touch because you'll hook many touch callback, when you'll just check for an specific entity touch. (if it's the case)
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-14-2014 , 00:48   Re: FM_Touch help me?
Reply With Quote #3

can u post a list with entities and also an example ?
swapped is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-14-2014 , 04:59   Re: FM_Touch help me?
Reply With Quote #4

Quote:
Originally Posted by swapped View Post
can u post a list with entities and also an example ?
You could try searching . . . stop being lazy.
__________________
fysiks is offline
felipemilralze
Senior Member
Join Date: Jul 2011
Location: Brazil
Old 05-14-2014 , 15:52   Re: FM_Touch help me?
Reply With Quote #5

Quote:
Originally Posted by meTaLiCroSS View Post
"Touch" is called whenever an entities touchs another entity (or world itself).

It has 2 arguments:

1) "pentTouched" which is the touched entity
2) "pentOther" which is the toucher, this one can be the world

Whenever "touch" is called, you must guess that 2 touch forwards will be called. The second callback will have the args flipped.

If ent1 touches ent2 and ent2 is not world:

Touch(ent1, ent2)
Touch(ent2, ent1)

Use register_touch instead of using Fakemeta's FM_Touch because you'll hook many touch callback, when you'll just check for an specific entity touch. (if it's the case)

PHP Code:
public fw_touch(enttouched)
{
    if (!
pev_valid(ent)) 
        return 
FMRES_IGNORED
    
    
static entclass[32], entclass2[32]
    
pev(entpev_classnameentclasscharsmax(entclass))
    
pev(touchedpev_classnameentclass2charsmax(entclass2))

    if(
equali(entclass"amxx_pallets") && equali(entclass2"player") && is_user_alive(touched))
    {
                
set_pev(ent ,pev_solidSOLID_NOT)
    }
    return 
FMRES_IGNORED

I'm having trouble.

"ent" is doing fusion with the "touched"
felipemilralze is offline
Send a message via MSN to felipemilralze Send a message via Skype™ to felipemilralze
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-14-2014 , 21:00   Re: FM_Touch help me?
Reply With Quote #6

What fusion? What do you want to do? Also as it's been said use register_touch instead, as you can directly pass the classnames in the parameters.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
felipemilralze
Senior Member
Join Date: Jul 2011
Location: Brazil
Old 05-14-2014 , 23:49   Re: FM_Touch help me?
Reply With Quote #7

Quote:
Originally Posted by Backstabnoob View Post
What fusion? What do you want to do? Also as it's been said use register_touch instead, as you can directly pass the classnames in the parameters.
I registered but I just want to know the scope of the function, because this "touched" colliding with the "ent"
felipemilralze is offline
Send a message via MSN to felipemilralze Send a message via Skype™ to felipemilralze
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 05-15-2014 , 10:29   Re: FM_Touch help me?
Reply With Quote #8

About touch i have some question about it.
i have 8 custom and different entities that can touch and i need to hook their touch.
Most of them are destroyed on touch.

what is the best ?
8 register_touch or hooking FM_Touch ?

Last edited by Fr33m@n; 05-15-2014 at 10:30.
Fr33m@n is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-15-2014 , 13:38   Re: FM_Touch help me?
Reply With Quote #9

Just hook register_touch 8 times, you will still save many calls because FM_Touch is called for ANY interaction between ANY two entities in the world.

Another option is to hook Ham_Touch with the toucher classname.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 05-15-2014 at 13:39.
Backstabnoob is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 05-15-2014 , 21:32   Re: FM_Touch help me?
Reply With Quote #10

register_touch > Ham_Touch > FM_Touch

Keep in mind the usage of register_touch beside the others.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS 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 15:32.


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