Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetEntityExists not work for Player
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#1
GetEntityExists not work for Player

Is their any way to get it to recogonize a player?

Quote: if (GetEntitiesCollide("Player", "DeepWaterAbove") == true)
{
DrownCounterNumber = 0;
}
else
{
DrownCounterNumber++;
}
I have a timer setting off every 0.25 seconds. But it always returns as false. But if I change Player to a armchair entity name (that I placed down) the function will be true and set the number back to 0. Why does it not work/support for Player?
08-16-2011, 04:27 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: GetEntityExists not work for Player

I've tried it before but it didn't work for me. You could do this however:

void OnStart() { AddEntityCollideCallback("Player", "DeepWaterAbove", "StateFunction", false, 0); }

bool bInArea = false;

void StateFunction(string &in parent, string &in child, int state)
{
    bInArea = state == 1 ? true : false;
}

Now you have a global boolean variable which you can call anywhere else in your script Smile

EDIT: To clarify above, the variable is global in the sense that you can use it in other functions within the same hps file. You can't use it in a different map though. In that sense it is still local Smile

(This post was last modified: 08-16-2011, 05:02 AM by palistov.)
08-16-2011, 04:59 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#3
RE: GetEntityExists not work for Player

Hmm, it looks like you're having problems with detecting if the player is underwater on not. ^^

How about having 2 areas where the first one is a large area over and under the water, and then have another area that is even larger that must overlap and be bigger than the first area, but cannot be under the water. Then you'll have to check that the player is in the first area, but not in the second area. Once the variables return negative or positive results, have them check in 0.1 seconds by adding another AddEntityCollideCallback command function. Smile

08-16-2011, 01:23 PM
Find




Users browsing this thread: 1 Guest(s)