Page 1 of 2
ScriptMaster 2x...?
Posted: Fri Mar 05, 2004 4:42 pm
by Krane
Er...Suppose you have a map, with custom sounds and jv's ubersound workaround:
local.master = spawn ScriptMaster
local.master aliascache my_sound sound/wherever.mp3 soundparms 1.0 0.0 1.0 0.0 600 2000 auto loaded maps "dm obj"
Cool! Now, BELOW this, you have:
exec global/my_custom_script.scr
And, in my custom script, I have AGAIN (but a different sound):
local.master = spawn ScriptMaster
local.master aliascache different_sound sound/otherlocation.mp3 soundparms 1.0 0.0 1.0 0.0 500 2000 auto loaded maps "dm obj"
So you end w/ 2 "local.master = spawn ScriptMaster" lines...
Is this ok?

Posted: Fri Mar 05, 2004 6:01 pm
by jv_map
It is no problem, though you could also do it this way:
level.master = spawn ScriptMaster
//...
and then at any time you can simply type
level.master aliascache // stuff here

Posted: Fri Mar 05, 2004 10:04 pm
by Krane

Good!
I need to include de level.master = spawn ScriptMaster line coz I don't know if ppl have or not this line in their map script

.
Thanks

!
Posted: Tue Mar 09, 2004 5:29 am
by small_sumo
jv_map wrote:It is no problem, though you could also do it this way:
level.master = spawn ScriptMaster
//...
and then at any time you can simply type
level.master aliascache // stuff here

So in my global ....workaround.scr would I type
level.master aliascache
local.master aliascache dfr_attack_02a_2121 sound/dialogue/Generic/A/attack/dfr_attack_09o_2.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "
local.master aliascache dfr_attack_02a_2122 sound/dialogue/Generic/A/attack/dfr_attack_09o_3.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "
Posted: Tue Mar 09, 2004 1:57 pm
by Krane
You need, at least, 1 "level.master = spawn ScriptMaster" line in your workaround. In my case, I'm considering that the map already have this line, so I just need the:
local.master aliascache dfr_attack_02a_2121 sound/dialogue/Generic/A/attack/dfr_attack_09o_2.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "
w/o the level.master line...
What jv told is there's no problem using the level.master line again

! So, in your workaround, use:
Code: Select all
level.master = spawn ScriptMaster
local.master aliascache dfr_attack_02a_2121 sound/dialogue/Generic/A/attack/dfr_attack_09o_2.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "
local.master aliascache dfr_attack_02a_2122 sound/dialogue/Generic/A/attack/dfr_attack_09o_3.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "
btw, nice site you have (and very nice maps

!)
Posted: Tue Mar 09, 2004 5:29 pm
by jv_map
In that case
level.master = spawn ScriptMaster
local.master aliascache dfr_attack_02a_2121 sound/dialogue/Generic/A/attack/dfr_attack_09o_2.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "
should be
level.master = spawn ScriptMaster
level.master aliascache dfr_attack_02a_2121 sound/dialogue/Generic/A/attack/dfr_attack_09o_2.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "'
Since there no longer is a local.master listener... you could also do:
level.master = spawn ScriptMaster
local.master =
level.master
local.master aliascache dfr_attack_02a_2121 sound/dialogue/Generic/A/attack/dfr_attack_09o_2.wav soundparms 1.0 0.0 1.0 0.0 160 1200 dialog streamed maps "m1l1 m4l0 m5l1a m5l1b m5l3 m6l3a "'
But what's the point hehe

Re: ScriptMaster 2x...?
Posted: Tue Mar 09, 2004 11:16 pm
by dcoshea
How about (my changes in bold):
Krane wrote:Er...Suppose you have a map, with custom sounds and jv's ubersound workaround:
level.master = spawn ScriptMaster
local.master aliascache my_sound sound/wherever.mp3 soundparms 1.0 0.0 1.0 0.0 600 2000 auto loaded maps "dm obj"
Cool! Now, BELOW this, you have:
exec global/my_custom_script.scr
And, in my custom script, I have AGAIN (but a different sound):
// set up ScriptMaster if we don't already have one
if (!level.master) {
level.master = spawn ScriptMaster
}
level.master aliascache different_sound sound/otherlocation.mp3 soundparms 1.0 0.0 1.0 0.0 500 2000 auto loaded maps "dm obj"
Perhaps it would save a little memory if you only create one ScriptMaster, or maybe the engine pre-allocates memory for entities and it won't make a difference
Regards,
David
Posted: Wed Mar 10, 2004 3:06 am
by small_sumo
Hmmmmmmm

Posted: Wed Mar 10, 2004 8:37 am
by jv_map
Yes you can do that too

though you may have to take the ! outside the parens... not sure...
It don't think it will saves seas of mem but it is a pretty neat way

Posted: Wed Mar 10, 2004 9:31 am
by small_sumo
So in conclusion ............
Posted: Wed Mar 10, 2004 6:53 pm
by Krane
...and the conclusion is that we can easyly add/cache custom sounds in our mods

!
To use my russian bots skin pack. for ex., you need to add "exec global/russian_bots.scr" to your map script. Suppose they use a sound which is not cached in the ubersound as "dm", this sound will not play! You need to cache it! How? in the russian_bots.scr you add:
Code: Select all
local.master = Script master
local.master aliascache my_sound sound/mechanics/blabla 1.0 0.0 1.0 0.0 auto loaded maps "dm"
If the map don't have custom sounds, it don't have the "local.master = Script master" line

! So jv said there's no problem setting the local.master again!
btw, is "local" or "level"

?
Posted: Wed Mar 10, 2004 8:10 pm
by jv_map
Krane wrote:btw, is "local" or "level"

?
Hehe well it doesn't matter really
The purpose of the local.master = spawn ScriptMaster line is, as you might have guessed, to spawn a ScriptMaster object
So basically that's all what is important to make it work... the local.master part is just added so you can later do the aliascache commands.
I myself think the local.master way is easiest, but it's really arbitrary... if you like to do it in an other way then go for it
Suggestions:
spawn ScriptMaster targetname "myscriptmaster"
Then use
$myscriptmaster aliascache blablablabla
__________________________________
group.fancythingie = spawn ScriptMaster
group.fancythingie aliascache blablabla
__________________________________
Even this might work:
spawn ScriptMaster aliascache blablabla
__________________________________
Well anyway I hope the point is clear

Posted: Wed Mar 10, 2004 8:13 pm
by jv_map
I gotta add however that dcoshea's idea might be a good suggestion for a convention... by setting level.master to be the ScriptMaster other scripts can simply use this ScriptMaster without the need to spawn any additional ScriptMasters... so this is probably the best way to go

Posted: Wed Mar 10, 2004 9:00 pm
by small_sumo
Clear as mud.
So can you tell me this, in my map level.scr I have as per the tutorial .....
// jv's new sound workaround ..... here goes.
local.master = spawn ScriptMaster
local.master aliascache blah blah
then I have a global scr file with many many
local.master aliascache blah blah in it do these need to be preceeded by ......
local.master = spawn ScriptMaster ?????
or some other line or no line at all?
Second question, to call my global script do I go like .....
thread global/blahblah.scr
or
exec global/blahblah.scr
Thanks.
btw I just rewrote the entire uberdialogue.scr to work with your sound workaround, I aliased obj dm train, it was very difficult.
Posted: Thu Mar 11, 2004 12:14 am
by Krane
1) If you already have the local.master line in your map scr, u don't need it again. But, if you put it, there's no problem. If your global/blabla.scr is part of a mod and somebody else will use in their map, it's better use the local.master again...
2) you call the scr as
exec global/blabla.scr
If you want to call just a thread, use:
exec global/blabla.scr::my_thread
or thread global/blabla.scr::my_thread