moveWest/East in script

Post your scripting questions / solutions here

Moderator: Moderators

UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

moveWest/East in script

Post by UBER_SOLDAT »

i started a new map i thought of a few weeks ago today. its set on a train speedign thru the countryside, like that SP SoF-I level. the train is gonna all be plain brushes, the floor and tree brushes etc are all script_objects, and i wanted them to move past the train.
the targetnames are:

tree brushes/train track floor etc: $outside
script_origin to spawn things at: $outside_spawner
trees: $tree1 thru to $tree4
bushes: $bush1 and $bush2

thats all the stuff ive got that needs to move. and this is my script, but ingame it wont load

______________________________________________________
main:

level waittill prespawn

exec global/ambient.scr m4l1

level waittill prespawn


thread spawners
thread scenery

end


spawners:


local.spawner = $outside_spawner
local.world = $outside

while(1)

{
wait 0.2
spawn local.world
local.world.origin = local.spawner.origin
local.world.time = 10
local.world moveWest 10000
break
wait 10
local.world remove
}
end


//=======================================
//=======================================

scenery:
thread tree1
thread tree2
thread tree3
thread tree4
thread bush1
thread bush2
end

tree1:

$tree1 moveWest 10000
$tree1 time 10
waittill movedone
$tree1 hide
$tree1 moveEast 10000
$tree1 time 0.1

goto tree1

tree2:

$tree2 moveWest 10000
$tree2 time 10
waittill movedone
$tree2 hide
$tree2 moveEast 10000
$tree2 time 0.1

goto tree2

tree3:

$tree3 moveWest 10000
$tree3 time 10
waittill movedone
$tree3 hide
$tree3 moveEast 10000
$tree3 time 0.1

goto tree3

tree4:

$tree4 moveWest 10000
$tree4 time 10
waittill movedone
$tree4 hide
$tree4 moveEast 10000
$tree4 time 0.1

goto tree4

bush1:

$bush1 moveWest 10000
$bush1 time 10
waittill movedone
$bush1 hide
$bush1 moveEast 10000
$bush1 time 0.1

goto bush1

bush2:

$bush2 moveWest 10000
$bush2 time 10
waittill movedone
$bush2 hide
$bush2 moveEast 10000
$bush2 time 0.1

goto bush2

//=======================================
//=======================================


_______________________________________________________
Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

when using wail till move done, the correct scripting is waitmove, but u'll also need to add the entity that's being moved
as all the entities are performing the same thing i've got them all to read the same script

not too sure about the spawners though i'm only glancing at ur script

your script editied :D

main:
level waittill prespawn
exec global/ambient.scr m4l1
level waittill prespawn
//thread spawners
thread scenery
end

//=======================================
//=======================================

scenery:
$tree1 thread move_me
//wait 3
$tree2 thread move_me
//wait 3
$tree3 thread move_me
//wait 3
$tree4 thread move_me
//wait 3
$bush1 thread move_me
//wait 3
$bush2 thread move_me
end

//i've put in these waits as everything will all go at the same time if u've set them up to spawn at the same location
// this way, they'll have a break before it performs it's next "spawn tree" function

move_me:
self moveWest 10000
self time 10
self waitmove
self hide
self moveEast 10000
self time 0.1
self waitmove
self show
self thread tree1
end
hope this helps, prob not cos it's all foreign 2 me :-/
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

spawn local.world

uhm, you can't spawn an '$outside', that's not a classname :? :?
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

movement

Post by tltrude »

As nuggets said, move commands are always two liners.


$bush2 moveWest 10000
$bush2 move //or waitmove

"move" starts it moving and the script continues to the next line while it moves.
"waitmove" sotps the script until it has completed the move.

You can also add more than one direction command:

$bush2 moveWest 10000
$bush2 moveNorth 10000
$bush2 move //or waitmove

that sends it northwest (45 degrees).

Have you considered using a large rotating cylinder?--lol. Also using the earthquake script will add to the realism. The far away trees should move slower then the close-up trees. You can use "speed" instead of "time". Speed is in quake units per second.

You could also have a tunnel pass over the train, while the trees reset. Or, have the trees travel underground going back.
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

What about makeing all the trees and bushes script models and then createing an info_splinepath . You could even bind two or three trees to one tree so that when you move that tree all the trees that are bound together(don't need to be touching ) move , then you could do

$tree2 bind $tree1
$tree3 bind $tree1

$tree1 thread tree_move

tree_move:
self flypath $tree_path1
self speed ? // how fast to move
self waittmove
goto tree_move
end

If you make the path in a circle around a brush with a sky texture you won't see them on the return trip to the start point or do one tree at a time .

$tree1 thread tree_move

tree_move:
self flypath $tree_path1
self speed ? // how fast to move
self waittmove
self.origin=$tree_path.origin
goto tree_move
end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

an even better idea find the blowing leaves shader and change it to use one of the tree line .tga's . Make one fast one and one slow one for the near and far tree's you may even be able to combine that with the above idea so you can have the occational real tree pass by the windows .
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

but remember to make ur train a script object or it will not work. (i assume you know this :P)
Live to map, not map to live.
-mohaa_rox, .map
moderator
UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

Post by UBER_SOLDAT »

most of the fighting will happen outside the train. its a cargo train with coal cars, crates, etc, so people will be outside most of the time
the train is supposed to stay still in the map, and ive got a piece of the scenery as 1 script object called $outside. its just a 512 long piece with the traintrack, the hills on each side and then the tree texture brush on each side. i wanted to create one of those every 0.5 seconds, and have it move along to the other end of the map into the farplane and then get destroyed, and also have the trees doing the same thing

can someone tell me an easy way to do this? i was thinking of making a circle track, with the train as a script object, then making the train drive around using waypoints, but then the whole train would have to be a script_object and fps would go down

i also thought of having flat brushes on all the sides, and making a shader to scroll a texture along them. but i wouldnt know which way it would scroll, or how fast to make it look realistic


ill try that thing with binding the trees for now tho. can someone think of any easy way to get this idea to work?
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Use a skyportal :idea:

Just make a separate area anywhere in your map (completely sealed off from the train) with all the scenery. Put a script_skyorigin somewhere inside the scenery and give it a targetname (for instance 'skyorigin').

Your train should be in another completely sealed off area. Use the the common/skyportal texture for all outside areas.

Now you can adapt the scenery from the script, just send any moveto commands to the $skyorigin entity 8)
Image
UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

Post by UBER_SOLDAT »

so i make 2 big rooms from the skyportal texture, 1 with the train inside, 1 with the scenery, and a skyorigin in the scenery one.
then what do i need to do in the scr? do i spawn the $skyorigin at a script_origin in the train 'room', then make it move?
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The script_skyorigin should be in the scenery room.
Image
UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

Post by UBER_SOLDAT »

but how do i get it to show up in the train room? does it automatically come up in the other room? i dont even know what sky portals do, so i have no idea what im supposed to be doing
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The skyorigin is kind of a camera for all players, which projects its view upon any skyportal surface.
Image
UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

Post by UBER_SOLDAT »

so then id just move the sky portal thru the scenery room, and what it sees when its moving past the trees and stuff gets drawn on the walls in the other room?

also, where do i put the skybox? im using caulksky so everything fades off into the fog. do i put the sky inside the scenery room?
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yes, the sky should be in the scenery room. The other room should have nothing but the train and a skybox with the skyportal texture.
Image
Post Reply