Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GetEntityExists not work for Player
Author Message
Rapture Online
Senior Member

Posts: 719
Joined: May 2011
Reputation: 18
Post: #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 all posts by this user Quote this message in a reply
palistov Online
Posting Freak

Posts: 1,174
Joined: Mar 2011
Reputation: 56
Post: #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 all posts by this user Quote this message in a reply
Kyle Offline
Posting Freak

Posts: 910
Joined: Sep 2010
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)