ID:151098
 


er....its old. im haveing alot of trougle getting it working(let alone putting it in my game..) ok im done bitching for now.
On 4/26/01 2:35 pm jobe wrote:
er....its old. im haveing alot of trougle getting it working(let alone putting it in my game..) ok im done bitching for now.

Guy has code for this somewhere? Where?
On 4/26/01 2:35 pm jobe wrote:
er....its old. im haveing alot of trougle getting it working(let alone putting it in my game..) ok im done bitching for now.

ok the point of the bitching was to get guy to reply with why it wont work
In response to jobe
ok the point of the bitching was to get guy to reply with why it wont work

Vehicle code? Where?


There's a pretty in-depth discussion of horseback riding here if it'll help any:

http://www.byond.com/forum/ forum.cgi?action=message_read&forum=newbie&message=1413&view =0
In response to Gughunter
Ohh yeah that. I thoght you were talking about an actual working demo. I tried this but still had problems.=0
In response to Gughunter
On 4/26/01 3:54 pm Gughunter wrote:
ok the point of the bitching was to get guy to reply with why it wont work

Vehicle code? Where?


There's a pretty in-depth discussion of horseback riding here if it'll help any:

http://www.byond.com/forum/ forum.cgi?action=message_read&forum=newbie&message=1413&view =0

i dont want horses i want tanks and stuff... so i grabed the IBK test lab code... but it wont work... i worked on it for 1/2 hour and dark hass been codeing for about 2. i was just hopeing you knew what was wrong with it
In response to jobe
On 4/26/01 4:59 pm jobe wrote:
On 4/26/01 3:54 pm Gughunter wrote:
ok the point of the bitching was to get guy to reply with why it wont work

Vehicle code? Where?


There's a pretty in-depth discussion of horseback riding here if it'll help any:

http://www.byond.com/forum/ forum.cgi?action=message_read&forum=newbie&message=1413&view =0

i dont want horses i want tanks and stuff... so i grabed the IBK test lab code... but it wont work... i worked on it for 1/2 hour and dark hass been codeing for about 2. i was just hopeing you knew what was wrong with it

Actually, that code is sadly outdated, but I kept it updated on my end!

It works like a charm, too... but I have no idea what exclusively I changed, so just go to the reply part, copy and paste it over your old one, and manually delete the "> " part in front of every line.

That way, it'll preserve the tabs.

mob
player
var/mob/vehicle/currentVehicle

vehicle
var/list/passengers[0]
var
speed = 0
maxSpeed = 30
minSpeed = -20
accelRate = 5
dir = EAST
density = 1


proc
Housekeeping()
var/speed
speed = src.speed
if(speed)
if(speed > 0)
step(src, src.dir)
else
step(src, turn(src.dir, 180))
//note: if a tile is 6 feet, 40 mph is fastest anything can move in DM
//without skipping spaces (assuming 10 ticks/second).
spawn(40/abs(speed)) Housekeeping()
else
//initial acceleration of a stopped car could take up to 1.1 seconds
spawn(11) Housekeeping()


UsrInVehicle()
return passengers.Find(usr)

Move()
. = ..()
var/mob/M
for(M in src.passengers)
M.loc = src.loc


New()
Housekeeping()


verb
enter()
set src = oview(1)
//enter only through side doors
if(usr.loc == get_step(src, turn(dir, 90)) || usr.loc == get_step(src, turn(dir, -90)))
usr:currentVehicle = src
usr:loc = src.loc
usr.icon = null
src.passengers += usr
usr << "Use keypad 8, 5, 4, 6 for acceleration and turning."


exit()
set src = view(0)
if(UsrInVehicle())
if(usr.Move(get_step(src, turn(src.dir, 90))))
usr:currentVehicle = null
src.passengers -= usr
usr.icon = 'player.dmi'
else
usr << "Your exit is blocked."


accel()
set src = oview(0)
if(UsrInVehicle())
src.speed += src.accelRate
if(src.speed > src.maxSpeed)
src.speed = src.maxSpeed
else
if(src.speed > 0 && src.speed < src.accelRate)
src.speed = 0
usr << "Speed: [src.speed] MPH"


brake()
set src = oview(0)
if(UsrInVehicle())
src.speed -= src.accelRate
if(src.speed < src.minSpeed)
src.speed = src.minSpeed
else
if(src.speed < 0 && src.speed > -src.accelRate)
src.speed = 0
usr << "Speed: [src.speed] MPH"


leftTurn()
set src = oview(0)
if(UsrInVehicle())
src.dir = turn(src.dir, 45)
usr << "Heading: [src.dir]"


rightTurn()
set src = oview(0)
if(UsrInVehicle())
src.dir = turn(src.dir, -45)
usr << "Heading: [src.dir]"


automobile
icon = 'basicAuto.dmi'

client
North()
if(usr:currentVehicle)
usr:currentVehicle:accel()
else
..()

Center()
if(usr:currentVehicle)
usr:currentVehicle:brake()
else
..()

East()
if(usr:currentVehicle)
usr:currentVehicle:rightTurn()
else
..()

West()
if(usr:currentVehicle)
usr:currentVehicle:leftTurn()
else
..()

South()
if(!usr:currentVehicle)
..()

Northeast()
if(!usr:currentVehicle)
..()

Northwest()
if(!usr:currentVehicle)
..()

Southeast()
if(!usr:currentVehicle)
..()

Southwest()
if(!usr:currentVehicle)
..()