Page 1 of 1

Two .scr

Posted: Mon Apr 19, 2004 11:57 pm
by GrimReaper
alrighty, I am no good at scripting. I tried looking for this one but no luck. But can you have 2 different .scr files. Like I have a plane in my map and I was woundering if you could have a plane .scr and my regular map .scr. and if they had pretty much the same info like

Code: Select all

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

level.script = maps/dm/plane.scr
exec global/ambient.scr plane

//$world farplane 5000
//$world farplane_color (.333 .333 .329)

level waittill spawn

that would it interfere with each other?

Posted: Tue Apr 20, 2004 12:48 am
by bdbodger
Sure you can the game uses the global scripts in the global directory among others all the time . Just put exec directory/script.scr in the level script change directory and script.scr to the directory and script name you will be useing . also you can use a thread in another scr file from your level script too . like this thread directory/script.scr::threadname parameters

Posted: Tue Apr 20, 2004 12:59 am
by GrimReaper
Honestly, that makes no sense to me. I realise that you are saying that I CAN use more than one script. from what it looks like one goes into my script folder ( most likely the plane one) and one goes in with maps folder(with bsp and min and stuff) ? dont know if im right though:P

Posted: Tue Apr 20, 2004 1:24 am
by bdbodger
Ok then this is what I mean for your level script use

main:

exec <directory>/plane.scr

end

to run just a thread in the plane.scr or to run both the plane script and then a thread in the plane script use something like this in your level script

main:

exec <directory>/plane.scr

thread <directory>/plane.scr::shootthread parm1 parm2

end

Posted: Tue Apr 20, 2004 1:47 am
by GrimReaper
Alrighty, now that I have two scr's I have one for my plane and one for the whole map I could put them together but rather wouldnt. Anyways where should I put them in which folders?...both in scripts, both in maps>obj?..or one in each

map script

Posted: Tue Apr 20, 2004 8:16 am
by tltrude
Only the script that has your map's name (and is in the same folder as your .bsp file) will load when you start a game. That main script can load other scripts. But, these other scripts don't need to repeat lines which were already executed by the main script.

So, your "my_plane.scr" script can just begin with a thread name.

Example of a global/my_plane.scr.
===============================

first_plane:

$plane1 flypath $path_1

end

second_plane:

$plane2 flypath $path_2

end
===============================

So, you place this little script (named my_plane.scr) in main/global, and in your map's main script (the one with your map's name) use lines like these to call the threads when ever you like.

exec global/my_plane.scr::first_plane
exec global/my_plane.scr::second_plane

Hope that helps!