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.

DarkBASIC Discussion / In and Out of vehicle keys

Author
Message
vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 9th Dec 2008 12:13
Is it possible to have a key that only lets you out of a vehicle but if the vehicle is empty you can simply get into the vehicle without having a key in Dark Basic at all?
RUCCUS
21
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Dec 2008 12:47
Yeah... whats so hard about that?



Obviously thats pseudo code.

vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 9th Dec 2008 12:53 Edited at: 9th Dec 2008 13:03
Yeah just wanted to know if it could be done thats all RUCCUS and I wanted to know if I could do it without a key for entering a vehicle, just to exit it, you gave me an example out using a key to get in and out, many thanks for that but I already know how to do that , what I want to know is how you can get a player , once they are very close to a vehicle how to get into it without a key but if the player wants to get out , to use a key to get out.

I have tried this but I keep getting crashes all the time
Veron
19
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 9th Dec 2008 14:03
Just use a function to calculate the distance from the vehicle to the player, and if the player is within that distance then automatically place them inside the vehicle.

So:



There's a ton of distance functions around here.

For exiting, just use a normal keystate command.
vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 9th Dec 2008 16:27
oh OK thanks Veron
BN2 Productions
22
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 9th Dec 2008 17:24
I have also copied the object and scaled it, to use for collision detection, which is more accurate to the model, but uses more resources. since the Vehicle isn't moving, it shouldn't be too hard to do.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 10th Dec 2008 11:52
ok bn2 productions
Pillarofire
22
Years of Service
User Offline
Joined: 31st Dec 2003
Location: Good Question, <looks around.>
Posted: 11th Dec 2008 09:20
Distance is easy to calculate, use Pythagorean Theorem;

a^2 + b^2 = c^2

just in case you didn't know,

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 13th Dec 2008 15:08
What kind of vehicle do you need a key to get OUT of?!
Or do you mean a key as in the player has to press a key on the keyboard?

You'll need to have some sort of toggle switch or your character will constantly jump in and out of the vehicle. Something like this...

not very elegant and untested but hope it works.

A small program that works is better than a large one that doesn't.

DBC Challenge Rank: Rookie
vampyre
23
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 20th Dec 2008 14:47 Edited at: 20th Dec 2008 14:48
thank you Pillarofire and Obese87 yes that is exactly what I mean Obese87

Login to post a reply

Server time is: 2026-07-05 18:18:02
Your offset time is: 2026-07-05 18:18:02