AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] entity front (https://forums.alliedmods.net/showthread.php?t=154290)

katna 04-05-2011 14:25

[help] entity front
 
i have 2 entities and i need to detect a third entity touch, from forward only if the third entity touch from background just put a invisible wall to block only the third entity:
view pic.
if E3 touch E1/E2 from back = Block
if E3 touch E1/E2 from front = Print chat message

my question is how can i detect from where did he touch E1/E2. from front or back
http://i53.tinypic.com/33n9k3r.png

Exolent[jNr] 04-05-2011 17:15

Re: [help] entity front
 
Are E1/E2 players?

katna 04-06-2011 00:45

Re: [help] entity front
 
none of them are players
Edit: S1 / S2 are SOLID_TRIGGER. detect touch isn't a problem, the point is how can i detect from where did E3 touch E1 or E2

Exolent[jNr] 04-06-2011 01:03

Re: [help] entity front
 
Just do an origin check.
It will require some testing unless you know the directions of the entities.

katna 04-06-2011 01:13

Re: [help] entity front
 
the directions isn't always the same. I tried several times , but i guess another try wont hurt

Exolent[jNr] 04-06-2011 01:23

Re: [help] entity front
 
If the entities can move, you can check their angles to see if it is the front/back.
Otherwise, they would be in the same position/direction all the time so you would just need to check origins.

katna 04-06-2011 01:41

Re: [help] entity front
 
Quote:

Originally Posted by Exolent[jNr] (Post 1445087)
If the entities can move, you can check their angles to see if it is the front/back.
Otherwise, they would be in the same position/direction all the time so you would just need to check origins.

No, they can't move. i mean the direction is different for every map. Every map has his own origins.

Exolent[jNr] 04-06-2011 03:01

Re: [help] entity front
 
What type of entities are you trying to detect?

katna 04-06-2011 10:53

Re: [help] entity front
 
e1 and e2 are nets.
Code:

ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
       
        if (ent) {
                engfunc(EngFunc_SetOrigin, ent, fCenter)
               
                set_pev(ent, pev_classname, "JailNet")
       
                dllfunc(DLLFunc_Spawn, ent)
       
                set_pev(ent, pev_movetype, MOVETYPE_FLY)
                set_pev(ent, pev_solid, SOLID_TRIGGER)
       
                engfunc(EngFunc_SetSize, ent, fMins, fMaxs)
        }

s3 is the ball SOLID_BBOX and movetype MOVETYPE_BOUNCE

Exolent[jNr] 04-06-2011 14:53

Re: [help] entity front
 
If the map does not already have solid goals (walls/nets around a box to make a soccer (or futbol) goal), then you could create solid entities around the SOLID_TRIGGER entities such that the ball can only touch from one side.


All times are GMT -4. The time now is 20:07.

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