Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / triggering event

Author
Message
r3d3y35
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Canada
Posted: 12th Dec 2007 02:09
how would i trigger an event by using x,y,z coordinates on a map, i have thought about just creating a box and checking for collision but there must be a way to do it by using a command such as

the problem with that code though is that the coordinates are too general. is there a way to do this using a function for distance or am i way off?

Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 12th Dec 2007 03:14
Quote: "the problem with that code though is that the coordinates are too general."

what do you mean too general? If you need them more specific, just use decimals. And that's the right method, and it could easily be made into a function where you give in the coordinates of the box and it checks if you're inside it.


r3d3y35
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Canada
Posted: 12th Dec 2007 03:25
well, i want it to do something when my player goes to a door way but the problem is that because the x,y,z coordinates in the game look like this (-92.0000433245436) i was thinking that there might be an easier way to specify a general area such as a range i.e 5-8,10-12 etc
but if there isnt i suppose i will just have to use decimals

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 12th Dec 2007 03:47 Edited at: 12th Dec 2007 03:50
EDIT: Sorry for the double post

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 12th Dec 2007 03:49 Edited at: 12th Dec 2007 03:50
You can try a few things:

1) find the distance between 2 coordinates in either 3D or 2D space (search 'distance between 2 points' or 'distance formula' or something of the sort on the forum)

2) Try something like this. X#, Y# and Z# are the positions of the object that needs to enter the trigger area. Say the trigger area is at coordinates 50,120,80 and you want to check and see if you enter an imaginary box around that point that's 20x20x20 (you don't actually make a box with this method...)

if X#>=50-10 and X#<=50+10 and Y#>=120-10 and Y#<=120+10 and Z#>=80-10 and Z#<=80+10
DO ACTIONS
Endif


Why + and - 10 all the time? Because 10 is 1/2 of 20.

r3d3y35
16
Years of Service
User Offline
Joined: 6th Dec 2007
Location: Canada
Posted: 12th Dec 2007 04:08
thanks a ton, that was exactly what i was looking for, it helped a lot

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 13th Dec 2007 01:12
No problem

Login to post a reply

Server time is: 2024-11-25 09:34:25
Your offset time is: 2024-11-25 09:34:25