I've been looking for a command that gets the Y position of the pawn/player, but I couldn't find such. I have a harbor level and I want when the player falls of the harbour, the screen to turn black before the player has reached the water and just play a Spash sound or something, but how can I make a script that will detect the Y position of the player? Everything else's clear to me, but dunno which command to use for that, I can attatch the pawn to the player and check the pawn's Y position, no problem also. Invisible trigger model doesn't work for me here
Btw I saw a command called WhereIsPlayer or something like that, but dunno if it could do the Job
Get the Y Position
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Get the Y Position
self.player_X
self.player_Y
self.player_Z
These three pawn variables return the X, Y or Z coordinate of the player.
float GetEntityX(string EntityName);
float GetEntityY(string EntityName);
float GetEntityZ(string EntityName);
The above three commands return the X, Y or Z coordinates of the specified entity.
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Get the Y Position
O____O WTF, I was searching like 15 minutes for this in the low level section (feeling stuuuupid).
OK thanks, I'll ask for help if I need something to know, but I don't think I'll have to
OK thanks, I'll ask for help if I need something to know, but I don't think I'll have to
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Get the Y Position
Amm, I DO got one question...
Is this correct, because when I fall from the bridge, the trigger doesn't get triggered... that is correct, right? It's rally just a simple if statement...
{
Spawn[ ()
{
Console(true);
LowLevel("CheckIt");
} ]
Checkit[ ()
{
if (self.player_Y <= -584)
{
HighLevel("DoIt");
}
} ]
DoIt[ ()
{
SetEventState("temporary", true);
} ]
}
Is this correct, because when I fall from the bridge, the trigger doesn't get triggered... that is correct, right? It's rally just a simple if statement...
{
Spawn[ ()
{
Console(true);
LowLevel("CheckIt");
} ]
Checkit[ ()
{
if (self.player_Y <= -584)
{
HighLevel("DoIt");
}
} ]
DoIt[ ()
{
SetEventState("temporary", true);
} ]
}
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Get the Y Position
Just some remarks about what might cause troubles here, as the manual is not too clear about it:
SetEventState does not refer to a trigger entity but is rather an event-flag that can be used by other entities as a trigger. To actually activate a trigger entity via a script you need to use the low level script method ActivateTrigger. (Btw. SetEventState is also available as low level method, so there's no need to switch between low and high level in your example). If you have a trigger entity in your level called "temporary" and use SetEventState with the same name, you will always get the state of the trigger entity and never the state of the event-flag (not with the GetEventState script method either).
SetEventState does not refer to a trigger entity but is rather an event-flag that can be used by other entities as a trigger. To actually activate a trigger entity via a script you need to use the low level script method ActivateTrigger. (Btw. SetEventState is also available as low level method, so there's no need to switch between low and high level in your example). If you have a trigger entity in your level called "temporary" and use SetEventState with the same name, you will always get the state of the trigger entity and never the state of the event-flag (not with the GetEventState script method either).
Re: Get the Y Position
Additionally, if that's actual code you've got a little error in there. If not, just ignore this post.
LowLevel("CheckIt");
...
Checkit[ ()
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Get the Y Position
Oh thanks, I've missed that, now it's working!