Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,209 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
detect where player is #239524
12/05/08 05:17
12/05/08 05:17
Joined: Sep 2005
Posts: 75
CA, Orange County
Gerrit Offline OP
Junior Member
Gerrit  Offline OP
Junior Member

Joined: Sep 2005
Posts: 75
CA, Orange County
Hi,
What would be the best method to know where the player is? For example I would like to create a fucntion (called by the player's action) that does one thing when the player is in room 1, but does something else when he is in room 2. There is no door between the rooms so the player can freely walk from one room to the other.

Thanks for helping
Gerrit

Re: detect where player is [Re: Gerrit] #239525
12/05/08 05:58
12/05/08 05:58
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
use c_trace.

Re: detect where player is [Re: Gerrit] #239618
12/05/08 21:54
12/05/08 21:54
Joined: Sep 2005
Posts: 75
CA, Orange County
Gerrit Offline OP
Junior Member
Gerrit  Offline OP
Junior Member

Joined: Sep 2005
Posts: 75
CA, Orange County
Okay but then I need to run c-trace periodically and have something else (entity or map entity) to respond and I thought that c-trace should be used sparingly since it is slow and takes a lot of processor time...
What do you think?
Gerrit

Re: detect where player is [Re: Gerrit] #239667
12/06/08 11:41
12/06/08 11:41
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
You can work with:
if (vec_dist(player.x,vector(x,y,z)) < dist)

Re: detect where player is [Re: Widi] #239744
12/06/08 23:10
12/06/08 23:10
Joined: Sep 2005
Posts: 75
CA, Orange County
Gerrit Offline OP
Junior Member
Gerrit  Offline OP
Junior Member

Joined: Sep 2005
Posts: 75
CA, Orange County
Indeed I can use that also
Thanks both of you (Cowabanga and Widi) for the tips

Gerrit

Re: detect where player is [Re: Gerrit] #239746
12/06/08 23:30
12/06/08 23:30
Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...
Andreas C Offline
Senior Member
Andreas C  Offline
Senior Member

Joined: Sep 2001
Posts: 375
Hamburg, Germany / Springfield...

Alternatively you could use "zones" ... by this I mean that you have invisible, passable blocks. When the player collides with one of them (i.e. steps into / onto them) you set a global "zone variable" to indicate which "zone" (or room) he is in.

Then your action only needs to check the "zone variable" to determine the whereabouts of the player.

This, of course, does not pinpoint the exact location of the player. It only tells you in which zone he is ... but maybe that's good enough for what you want to do ?

Cheers,
Andreas

(I used something similar with A5 to determine which torches in a dungeon needed to be "lit" when the player was near ... just so as to limit the number of active particle emitters etc.)


____________________________________________________
GameCore / Unity / UDK
Lightwave 9.6 / Blender / Fragmotion / ZBrush 3.5
TextureMaker / PSP-X
Re: detect where player is [Re: Andreas C] #240471
12/11/08 05:05
12/11/08 05:05
Joined: Sep 2005
Posts: 75
CA, Orange County
Gerrit Offline OP
Junior Member
Gerrit  Offline OP
Junior Member

Joined: Sep 2005
Posts: 75
CA, Orange County
Andreas,
That is indeed an even better solution.
Thanks for the tip
Best regards
Gerrit


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1