Page 1 of 1

Moving targets

Posted: Fri Apr 25, 2003 1:46 am
by Hashmark13
ok ive got my hands on a .map version of a map some of you might know of.. well anyways ive added an obstacle course (its a training map) and i need to have some targets move back and forwarth... ive been examining alot of .scr files but im such a noob its all greek to me... so ummm any help?

Posted: Fri Apr 25, 2003 1:49 am
by Comptom
No clue but send my that map if you find out

script

Posted: Fri Apr 25, 2003 7:33 am
by tltrude
Well, you will need a script to do it.

1. Make your target objects and turn them into script_objects (key N).

2. Add blind walls to each side that are less than 512 units apart (adjust as needed).

3. Give each of them a targetname like target1, target2, etc...

4. Use this script:

-------------------------------------------

main:

level waittill prespawn

$target1 speed 4 //units per second
$target2 speed 8
$target3 speed 16
$target4 speed 32

thread targetmover

level waittill spawn

end

targetmover:

$target1 moveWest 512 // units
$target1 move
$target2 moveWest 512 // units
$target2 move
$target3 moveWest 512 // units
$target3 move
$target4 moveWest 512 // units
$target4 waitmove
wait 1
$target1 moveEast 512 // units
$target1 move
$target2 moveEast 512 // units
$target2 move
$target3 moveEast 512 // units
$target3 move
$target4 moveEast 512 // units
$target4 waitmove

goto targetmover

end

-------------------------------------------

5. Name the script file the same as your bsp file (mymapname.scr) and place it in the same folder as your bsp file (maps, dm, or obj).



You can make it so each target has its own thread if you like. You can change the direction they move to north/south or up/down also.

Here is a link to my tutorial map that has a shooting gallery:

http://pages.sbcglobal.net/tltrude/Temp ... ngdoor.zip

Everone is welcome to use anything they want from it.

Posted: Fri Apr 25, 2003 8:57 pm
by Hashmark13
wow thx!!! i dunno if i can get it to work yet but im going to try now :D


by the way... i have a map that says you made it in the scr file... i sat and gawked at the script for 30 minutes... there is all sorts of insane things in the map that i didnt know was possible... i compiled it and ran it and i just about freaked out!! there was a marry go round a ferris wheel and 2 elevators and a row boat and a HUMAN CANNON BALL!!!! omg i dunno how it got on my comp either!!


one more thing... i noticed you used east and west (you spelled east as eest...?) could i perhaps use angles such as 45 90 so on so on ect... because im never quite sure what direction is north in radiant... i hear it is like 45 degrees or something i dunno i think it would make more sence for north to by up on the grid (from top view)

Posted: Fri Apr 25, 2003 11:46 pm
by nuggets
north = 90; east = 0, etc...

east should be spelt east not eest, and you could also use

//use
main:
$target1 thread targetmover 512
$target2 thread targetmover 512
$target3 thread targetmover 512
$target4 thread targetmover 512
//etc...

targetmover local.movespace:
self moveWest local.movespace // don't know where 512 comes from but it'll work on the points in radiant
waittill thread done
wait 1
self moveEast 512 //again repeat the previous number
end

Posted: Sat Apr 26, 2003 12:16 am
by Hashmark13
argh im all confused... ok i know (now) that 90 is north and stuff


but ummm how in radiant would i do this??? the script is all ok now.. i just dunno what to give targetname what what??? im all confused

Posted: Sat Apr 26, 2003 12:41 am
by nuggets
/*
when writing scripts:

you can use $target1 or $bilbo_baggins or what ever as long as the
key: targetname
value: bilbo_baggins is the same

if the targetname is a person, you will need to use walkto or runto in your script

so
*/
main:
// all the usualy crap
thread runners
end

runners:
$bilbo_baggins runto $climbingframe
end

/** that'll then do for the script, but if every1's goin 2 be doing that then you can use
*/

runners:
$bilbo_baggins thread runners_to_climbingframe
$frodo_baggins thread runners_to_climbingframe
//etc...
end

//then the climbingframe thread will be
runners_to_climbingframe:
self runto $climbingframe
end

//if this has more than 1 line to do then it'll save on scripting space and
//the certain entities will all perfomrm their specific action that the 1
//thread has told them to do, so if something like...

the_new_1:
$1 thread allofit
$2 thread allofit
$3 thread allofit
end

allofit:
self hide
self notsolid
self moveUp 90
self time 3
self waitmove
self show
self solid
self moveLeft 32
self waitmove
// self etc... etc...
end
/*
it'll be easier than typing

$1 hide
$1 notsolid...etc
then
$2 hide
$2 notsolid...
and finally
$3 moveLeft 32
*/

that's all i was trying 2 convey,... easy scripting but a little more info then what starters need :P

Entity Properties

Posted: Sun Apr 27, 2003 2:32 am
by tltrude
Here is how to make your targets:

First make a brush and texture it. Now highlight it and hit key N. That brings up a window named "Entity". Find "script_object" on the list at the top and double click it. In the little window named "key:" type "targetname" and in the little window named "value:" type "target1" (without the quotes) and hit enter. Hitting N again will close the Entity window.

Your target is now a script_object entity named $target1 and it can be moved with the script. Sorry about the misspelling.

Posted: Sun Apr 27, 2003 6:52 am
by Hashmark13
i feel like a retard...

if you dont mind can you make an example map? where the targets slide left to right automatically? i feel so dumb :cry:

Posted: Sun Apr 27, 2003 11:28 am
by nuggets
do it urself, it'll make ya feel better :D
Stage1:
open the map you have

create the object you want to move then right click on the 2D view in radiant, select script->object,

press N, this will bring up the entity window, now key in
key: targetname
value: mover1

in the 2D top view, have a look to see which way your object is moving, either
^North <West VSouth or >East :D

click on grid->grid 16
now work out how many squares you want it to move,

save your map

Stage2:
now create a text document, and save it as the same as your mapname, i,e obstacle_course.map therefore obstacle_course.scr :D

now place all this script VVVVVVVVVV into that document and replace all the red parts with the direction and distance

main:
thread my_mover1
end

my_movers:
$mover1 time 5 //things after the //are just comments 5 is how many
// seconds it will take to get to it's destination, you can change it for any
// integer you like
$mover1 moveNorth 32 //change this for the direction you want and the (number of squares you counted * 16) because there were 16 squares for each 1 you counted :D
$mover1 waitmove //tells the object to move but not do anything else until
// it's finished moving
$mover1 moveSouth 32 //change this to the opposite of
// the previous direction
$mover1 waitmove //will now move back to it's original position
goto my_movers //will make it all start again
end //finishes the thread

// that's it then, if you want more than 1 object repeat all of that in stage1
// and replace mover1 with mover2,

// then in the script you will have...
main:
thread my_mover1
thread my_mover2
end

my_mover1:
$mover1 time 5
$mover1 moveNorth 32
$mover1 waitmove
$mover1 moveSouth 32
$mover1 waitmove
goto my_mover1
end

my_mover2:
$mover2 time 6
$mover2 moveWest 64
$mover2 waitmove
$mover2 moveEast 64
$mover2 waitmove
goto my_mover2
end

// etc... etc... :D

Target_Range

Posted: Mon Apr 28, 2003 12:11 am
by tltrude
Ok, here is a target range map:

http://pages.sbcglobal.net/tltrude/Temp ... _range.zip

It includes the map file, a pk3, and playerstarts for two. It will be under deathmatch.