AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get water entity index where player is swimming. (https://forums.alliedmods.net/showthread.php?t=214054)

.Dare Devil. 04-22-2013 10:59

get water entity index where player is swimming.
 
Hello,

If i register touch and player touch water nothing happen, there is no way what i know to get water id where player/entity is in it.
How can i do it?
Thanks!

didoWEE 04-22-2013 11:56

Re: get water entity index where player is swimming.
 
In PreThink check pev(index, pev_waterlevel).
Or you can check the entities near you with find_ent_in_sphere (searching for "func_water")

.Dare Devil. 04-22-2013 12:05

Re: get water entity index where player is swimming.
 
Quote:

Originally Posted by didoWEE (Post 1937704)
In PreThink check pev(index, pev_waterlevel).
Or you can check the entities near you with find_ent_in_sphere (searching for "func_water")

please no find_ent_in_sphere or other find_ent_
they check all entities and check radius/origin all in same time.
when i use this in prethink it will be very horrible.
There must be an ohter way

didoWEE 04-22-2013 12:10

Re: get water entity index where player is swimming.
 
What about
Quote:

Originally Posted by didoWEE (Post 1937704)
pev(index, pev_waterlevel)


.Dare Devil. 04-22-2013 12:12

Re: get water entity index where player is swimming.
 
Quote:

Originally Posted by didoWEE (Post 1937715)
What about

you cant get water entity index with that as long as i know.

didoWEE 04-22-2013 12:17

Re: get water entity index where player is swimming.
 
Try with
pev(index, pev_flags) & FL_INWATER

.Dare Devil. 04-22-2013 12:21

Re: get water entity index where player is swimming.
 
Quote:

Originally Posted by didoWEE (Post 1937719)
Try with
pev(index, pev_flags) & FL_INWATER

No, do you even know what i mean by water entity index? :)
Not water level, not " is player or entity in water" but water entity id
so i can get for example water pev( ent, pev_mins, mins ) or maxs or what ever...

Backstabnoob 04-22-2013 12:39

Re: get water entity index where player is swimming.
 
search for the nearest water entity using find_ent_in_sphere?

.Dare Devil. 04-22-2013 14:14

Re: get water entity index where player is swimming.
 
is there any ohter way to do this?

teh ORiON 04-22-2013 15:11

Re: get water entity index where player is swimming.
 
So the problem is that when a player interacts with func_water it is a bit more complex than just your generic entity ::touch.

The engine calls the PM function PM_CheckWater to check whether or not the player is interacting with water and the depth he is at (and what type of water it is). The func_water entity index is never passed in any way when the player is "touching" the water. It is only concerned about waterlevel and watertype.

Spoiler


All times are GMT -4. The time now is 10:57.

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