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

Entity touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 09-15-2016 , 15:53   Entity touch
Reply With Quote #1

I have created a zone (a cube/box) on fun_allinone map all over the spawn area and fwBoxTouch function do not get triggered by any player touching it.
But as soon all of the env_beam's gets triggered/toggled on (they're inside of this cube), then fwBoxTouch is somehow working as it should.
My questions are:
Why isn't it working without the beams triggering it? And how to get it to work as it should without env_beam entitites has to trigger it to work?

PS. I have to use MOVETYPE_NONE and SOLID_TRIGGER since it's supposed to act like a trigger_multiple entity.
Since the doors are within the cube as well.
I have figured out if any other value beside of MOVETYPE_NONE, when one of the doors gets triggered, it will kill/move the box away from it's position.
I have taken a look at the env_beam's keys and keyvalues to try figuring out what's triggering it to work, my guess was pev->dmg, but set_pev(entity, pev_dmg, <any value here>) did not work. So, I'm out of ideas.

Code:
public plugin_init() register_touch("box", "player", "fwBoxTouch") public fwBoxTouch(zone, player) {     if (!pev_valid(zone))         return FMRES_IGNORED     server_print("Test")     return FMRES_IGNORED } public CreateZone(Float:position[3], Float:mins[3], Float:maxs[3]) {     new entity = create_entity("info_target")     set_pev(entity, pev_classname, "box")     DispatchSpawn(entity)     engfunc(EngFunc_SetModel, entity, "models/gib_skull.mdl")     set_pev(entity, pev_solid, SOLID_TRIGGER)     set_pev(entity, pev_movetype, MOVETYPE_NONE)     set_pev(entity, pev_effects, EF_NODRAW)     engfunc(EngFunc_SetOrigin, entity, position)     engfunc(EngFunc_SetSize, entity, mins, maxs)     return entity }

Last edited by Rirre; 09-16-2016 at 00:21.
Rirre is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-15-2016 , 18:01   Re: Entity touch
Reply With Quote #2

Replace:
PHP Code:
set_pev(entitypev_originposition
to:
PHP Code:
engfunc(EngFunc_SetOriginentityposition
This updates entity origin for the physics engine. (re-links entity)

Another way you can move:
PHP Code:
set_pev(entitypev_originposition
Before:
PHP Code:
engfunc(EngFunc_SetSizeentityminsmaxs
Because SetSize also re-links entity.
__________________

Last edited by PRoSToTeM@; 09-15-2016 at 18:15.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Rirre
Veteran Member
Join Date: Nov 2006
Old 09-16-2016 , 00:21   Re: Entity touch
Reply With Quote #3

That won't fix it. But it's replaced now.
Rirre is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 09-16-2016 , 06:33   Re: Entity touch
Reply With Quote #4

Question, what build of amx do you use ?
__________________
Depresie is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 09-16-2016 , 07:10   Re: Entity touch
Reply With Quote #5

This code works for me:
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>

public plugin_precache() precache_model("models/gib_skull.mdl");

public 
plugin_init() register_touch("box""player""fwBoxTouch"), register_clcmd("say /smth""Smth");

public 
Smth(clientEntIndex) {
    new 
Float:origin[3];
    
pev(clientEntIndexpev_originorigin);
    
CreateZone(originFloat:{-16.0, -16.0, -16.0}, Float:{16.016.016.0});
}

public 
fwBoxTouch(zoneplayer)
{
    if (!
pev_valid(zone))
        return 
FMRES_IGNORED

    server_print
("Test")

    return 
FMRES_IGNORED
}

public 
CreateZone(Float:position[3], Float:mins[3], Float:maxs[3])
{
    new 
entity create_entity("info_target")
    
set_pev(entitypev_classname"box")

    
DispatchSpawn(entity)

    
engfunc(EngFunc_SetModelentity"models/gib_skull.mdl")

    
set_pev(entitypev_solidSOLID_TRIGGER)
    
set_pev(entitypev_movetypeMOVETYPE_NONE)
    
set_pev(entitypev_effectsEF_NODRAW)

    
engfunc(EngFunc_SetOriginentityposition)
    
engfunc(EngFunc_SetSizeentityminsmaxs)

    return 
entity

__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
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 05:24.


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