Page 1 of 1
Sound speaker or script_model?
Posted: Thu Feb 03, 2005 6:11 am
by Cpt_Pennybags
I am adding sounds into a map and debating if I should either use:
-a sound speaker, this will allow me to add all the info to the scr
-or use a script_model : I would then have to create a tik file for it
The sounds would be music from a radio, static radio etc
So which would be recommended? Which is less cpu intense?
Also, how would I make the sound stop and start randomly?
Posted: Thu Feb 03, 2005 8:57 am
by wacko
dont know about which is more cpu intense. I'd say they are the same.
I personally would use speakers because I prefer editing the scr because there I can more easily adjust things like playing sounds randomly. But I dont know much about tik files, so maybe it's the same there
Start/stop sounds randomly. I did it once in 'decalattack' for barking dogs
Code: Select all
main:
local.master=spawn ScriptMaster
local.master aliascache b_1 sound/characters/dog_bark_1.wav soundparms 0.5 0.0 0.8 0.4 3000 6000 "local" loaded maps "dm "
local.master aliascache b_2 sound/characters/dog_bark_2.wav soundparms 0.5 0.0 0.8 0.4 3000 6000 "local" loaded maps "dm "
local.master aliascache b_3 sound/characters/dog_bark_3.wav soundparms 0.5 0.0 0.8 0.4 3000 6000 "local" loaded maps "dm "
local.master aliascache b_4 sound/characters/dog_bark_4.wav soundparms 0.5 0.0 0.8 0.4 3000 6000 "local" loaded maps "dm "
local.master aliascache b_5 sound/characters/dog_bark_5.wav soundparms 0.5 0.0 0.8 0.4 3000 6000 "local" loaded maps "dm "
level waittill spawn
thread dog_bark
end
...
dog_bark:
while(1)
{
level.bark_times=(randomint(11)+1)
wait (randomint(20) + 20)
for (level.times_barked=1;level.times_barked<=level.bark_times;level.times_barked++)
{
$bark_o_mat loopsound b_
level.bark_wait=(randomfloat(.3)+.3)
wait level.bark_wait
$bark_o_mat stoploopsound
}
}
end
In the map, there's a script_model with
targetname/bark_o_mat
model/fx/dummy.tik
always_draw checked
just where the dog shall bark.
This bark-o-mat can
bark in 5 randomized ways //it uses one of the sounds starting with b_ randomly
with a randomized waittime between the single barks //level.bark_wait
for a randomized number of times, //level.bark.times
then wait a randomized time until it starts again //wait (randomint(20) + 20)
Posted: Sat Feb 05, 2005 5:10 am
by Cpt_Pennybags
Thanks for the info wacko, I will look into that.