moveWest/East in script
Moderator: Moderators
-
UBER_SOLDAT
- Warrant Officer
- Posts: 127
- Joined: Wed Aug 07, 2002 7:44 pm
- Location: ENGLAND
- Contact:
moveWest/East in script
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
//=======================================
//=======================================
_______________________________________________________
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
//=======================================
//=======================================
_______________________________________________________

-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
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
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
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
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 :-/
movement
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.
$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.
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
$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
-
UBER_SOLDAT
- Warrant Officer
- Posts: 127
- Joined: Wed Aug 07, 2002 7:44 pm
- Location: ENGLAND
- Contact:
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?
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?

Use a skyportal
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)
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)
-
UBER_SOLDAT
- Warrant Officer
- Posts: 127
- Joined: Wed Aug 07, 2002 7:44 pm
- Location: ENGLAND
- Contact:
-
UBER_SOLDAT
- Warrant Officer
- Posts: 127
- Joined: Wed Aug 07, 2002 7:44 pm
- Location: ENGLAND
- Contact:
-
UBER_SOLDAT
- Warrant Officer
- Posts: 127
- Joined: Wed Aug 07, 2002 7:44 pm
- Location: ENGLAND
- Contact:

