Moving a boat

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Waylander76
Sergeant Major
Posts: 122
Joined: Wed Jun 01, 2005 10:03 am

Moving a boat

Post by Waylander76 »

Hi all

Basically I've made a model of a boat with brushes in radiant and want
a player to be able to get in it and use a trigger to make the boat
move from point A to point B on the map.

I've given the boat a trigger_use and then used waypoints
for the boats course.

Called the thread in the script and use the moveto command to get the
boat to follow the waypoints.

This is where my problem lies...the boat doesn't move.

So could someone please tell me how to do it or if it's been done before
and where I can find the information I need?

This is for a multiplayer map.

Thanks in advance.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

move

Post by tltrude »

It will need a second line below the moveto line.

ex:

$boat moveto $boat_way1
$boat waitmove
$boat moveto $boat_way2
$boat waitmove

"Waitmove" makes the script wait untill the boat gets to the waypoint before going to the next line, but you can just use the command "move". You also need to set the time it takes the boat to move between waypoints.

$boat time 150 //seconds
or
$boat speed 150 //grid units per second

Hope that helps!
Tom Trude,

Image
Waylander76
Sergeant Major
Posts: 122
Joined: Wed Jun 01, 2005 10:03 am

Post by Waylander76 »

Thanks for that...much appreciated!

Should the boat be a script object? I'm not to sure on that point!

Will try when i get home and let you know the results!

Thanks again!
User avatar
At0miC
General
Posts: 1164
Joined: Fri Feb 27, 2004 11:29 pm
Location: The Netherlands

Post by At0miC »

Waylander76 wrote:Should the boat be a script object?
Yes, and a targetname: boat
Waylander76
Sergeant Major
Posts: 122
Joined: Wed Jun 01, 2005 10:03 am

Post by Waylander76 »

Thanks for that Atomic.

Just have to wait to get home from work so I can test it all now!! :D
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

boat

Post by tltrude »

There other things you can do to it, after you get it moving, like adding engine sounds.

$boat loopsound jeep_snd_idle // would require a sound workaround.
and
$boat stoploopsound

////sound workaround////
These two lines would go just above "level waittill prespawn".

local.master = spawn ScriptMaster
local.master aliascache jeep_snd_idle sound/vehicle/veh_jeep_idle.wav soundparms 0.5 0.0 1.0 0.0 800 4000 auto loaded maps "obj dm"

A workaround is needed because the sound normally only works in singleplayer.
Tom Trude,

Image
Waylander76
Sergeant Major
Posts: 122
Joined: Wed Jun 01, 2005 10:03 am

Post by Waylander76 »

no sounds required...it's a little wooden row boat! :)
However the little blighter just won't move!!!

The boat is a script object with the following key : value

targetname : boat

the trigger is a trigger_use
key: setthread
value: boatmove

There are 3 waypoints

targetname : wap
target : wap1

targetname : wap1
target : wap2

targetname : wap2 (this is where the boat stops)

in my script (it's ab OBJ map) I have this after
// level waittill roundstart //

thread boatmove

boatmove:
$boat time 150 //seconds
$boat moveto $wap
$boat waitmove
$boat moveto $wap1
$boat waitmove
$boat moveto $wap2
$boat waitmove

end


Now I have a feeling I'm missing something really simple or basic...any
help appreciated!!

Tltrude: Thanks so much with the help provided so far, it's very much appreciated!
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post by tltrude »

Double check your targetnames and make sure "setthread" is spelled right.

I will assume you have your script working for other things. The thread shoud be below the end line of the "main" thread, or at the bottom of the page below another thread's end line. BTW, if you comment out the roundstart line you can test your objectives alone.

//level waittill roundstart


You can try this way also.

boatmove:

$boat speed 128 // this is grid units per second, adjust as needed
$boat followpath $wap
$boat move

end



Using the other way the waypoints do not have to target each other. Also, to see if a thread is working, you can add debug lines to the thread like this.

println "The the first waypoint has been reached!"

A message can also be added to the trigger itself.

Key: message
Value: The boat trigger has been used! (don't use quotes)

Once you get it working those lines can be removed.

Ps: I have a rowboat in my "explodingdoor" tutorial map (click on my signature logo). It has ores that rotate as it moves. The zip file contains the .map file, a playable pk3, and a text version of the script.
Tom Trude,

Image
Waylander76
Sergeant Major
Posts: 122
Joined: Wed Jun 01, 2005 10:03 am

Post by Waylander76 »

Tom...got it!!

I'd actually forgot the 'waittil trigger' in the script! Doh!!!! :oops: :oops:

now there are three little boats happily traversing my map! :D

BTW...loved your exploding door map..lots of ggod stuff on there!

thanks again for the help much appreciated.
Post Reply