ScriptMaster 2x...?

Post your scripting questions / solutions here

Moderator: Moderators

Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

ScriptMaster 2x...?

Post 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? :?
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 :)

:)
Image
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

:D 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 8-) .

Thanks :wink: !
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post 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 "
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post 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 :wink: ! 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 :D !)
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 :)
Image
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Re: ScriptMaster 2x...?

Post 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
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Hmmmmmmm

:roll:
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 8-)
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

So in conclusion ............
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

...and the conclusion is that we can easyly add/cache custom sounds in our mods :wink: !

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 :shock: ! So jv said there's no problem setting the local.master again!

btw, is "local" or "level" :? ?
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 :)
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 8-)
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post 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.
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post 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
Image
Post Reply