ubsersound

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

ubsersound

Post by lizardkid »

right, i read jv's post on that, copied the thingy i need, glued a speaker to my player (SP), and gave it playsound commands using the uberalias i gave the sounds. i'm using a randomint and a..

nvm. i'll just post teh script.

Code: Select all

switch(randomint(5))
{
	case 1	:	$playerSpeeker playsound SS_death1
	     break;
	case 2	:	$playerSpeeker playsound SS_death2
	     break;
	case 3	:	$playerSpeeker playsound SS_death3
	     break;
	case 4	:	$playerSpeeker playsound SS_death4
	     break;
	case 5	:	$playerSpeeker playsound SS_death5
	     break;
}
SS_death1-5 are all defined like this...

Code: Select all

aliascache SS_death1 sound/dialogue/Generic/A/panic/dfr_panic_25j_1.wav soundparms 1.0 0.0 1.0 0.0 160 1600 local loaded maps "local"
$playerSpeeker is the glued speaker, so what's wrong?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Re: ubsersound

Post by jv_map »

lizardkid wrote:(...) so what's wrong?
That's what I was wondering too :wink:

I presume the problem is you can't hear the sounds, which is because speakers don't actually work in mohaa. Simply use an Entity instead, or a ScriptModel with model fx/dummy.tik or anything similar.

P.S. randomint 5 returns a random number in the 0-4 range, not 1-5.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Code: Select all

speakerbox:
// makes a dummy speaker for the player's voice commands.

spawn fx/dummy.tik "$targetname" "playerSpeeker"
$playerSpeeker glue $player

end
used the same codes as before, just added a plus to the randomint so it goes to 5.

but it doesn't work.

I'm using the commands, but they're no different, just some debug lines and a thread command after the switch. the commands work like they did before, the only problem is no sound. Everything else works :S
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Any errors in console? (check all the way up)

aliascache SS_death1 sound/dialogue/Generic/A/panic/dfr_panic_25j_1.wav soundparms 1.0 0.0 1.0 0.0 160 1600 local loaded maps "local"

Where did you place this line? Isn't there suppose to be a master in front? Why maps "local" instead of your map name? If this is in your script also the first 'local' should be quoted like "local".

spawn fx/dummy.tik "$targetname" "playerSpeeker"

use targetname not $targetname :wink: .. with $targetname you won't get proper targetname arrays (though that doesn't have to be a problem right now, just a good habit to possibly safe some trouble in the future).

P.S. If you do

$playerSpeeker playsound SS_death

the game will randomly choose between the aliases SS_death1-SS_death5 (so you don't need the switch) :)
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Any errors in console? (check all the way up)
nope, waded through the friendly.scr console spam and found my debug lines telling me everything was fine...

Code: Select all

Where did you place this line? Isn't there suppose to be a master in front? Why maps "local" instead of your map name? If this is in your script also the first 'local' should be quoted like "local". 
Alright this might be it, i don't have a ScriptMaster (local.ScriptMaster = ... right?) and all my aliascache's are built the same.

because it's a script thats gonig to be in who-knows-what maps. I wanted to make it as universal as possible ;)

Being my normal clever self i put it in a global script and exec'd it from there so as not to spam my real script...
use targetname not $targetname .. with $targetname you won't get proper targetname arrays (though that doesn't have to be a problem right now, just a good habit to possibly safe some trouble in the future).


alright, but what's the difference? is $targetname used for different AI or something?

UPDATE:

tried the targetname thing, didnt work. my scripts are like this now:

Code: Select all

////////////////////////*******************Preparatory*******************//////////////////////
speakerbox:
// makes a dummy speaker for the player's voice commands.

spawn fx/dummy.tik "targetname" "playerSpeeker" "origin" "$player.origin"
$playerSpeeker glue $player

end

// farther down

case "advance"		:	print "~!!!~SQUAD~!!!~		ADVANCE order detected"
					thread command_ADVANCE
					setcvar squadcommand ""
					$playerSpeeker playsound SS_advance1
and the sound cache:

Code: Select all

local.master = aliascache SS_advance1 sound/dialogue/Generic/A/directive/dfr_directive_195j_2.wav soundparms 1.0 0.0 1.0 0.0 160 1600 local loaded maps "local"
exact code that refers to it, i was hesitant to post the case because i remember what happened with AlienX, but if i'm going to get this fixed i'm gonna have to post it somewhere :)

btw this is not the death script thingy, this is set up exactly the same though.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

One can tell you did not read jv's post... It needs to be:

Code: Select all

local.master = spawn ScriptMaster
local.master aliascache SS_advance1 sound/dialogue/Generic/A/directive/dfr_directive_195j_2.wav soundparms 1.0 0.0 1.0 0.0 160 1600 local loaded maps "m dm obj" // remember - CHANGE THE MAPS!!!
And why should you create a new entity when you can make the player play a sound... :?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

actually one would not see the hidden line above that detailing the spawning of a ScriptMaster. ( ;) )

Well i always saw posts on people wanting to make things say things and they needed to spawn a fx/dummy as a fake mouthpiece for the player.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Ok, i just reread my last posts and realized it covered quite a lot of ground that i'd already done so here's some clarification:

I have the spawned ScriptMaster and all the sounds are done like this

Code: Select all

local.master = spawn ScriptMaster

local.master = aliascache SS_death1 sound/dialogue/Generic/A/panic/dfr_panic_25j_1.wav soundparms 1.0 0.0 1.0 0.0 160 1600 local loaded maps "local"
(i only spawned one ScriptMaster)

i call them from a switch/case that DOES WORK, and it fires correctly, goes over and does everything except the sound.

BUT, now i found a list of errors i hadn't though to look for, (they're usually pushed up and cleared by the friendly.scr spam so i never saw them) telling me aliascache is not a valid function :S

Code: Select all

unknown command: aliascache
local.master = aliascache SS_death1 sound/dialogue/Generic/A/panic/dfr_panic_25j_1.wav soundparms 1.0 0.0 1.0 0.0 160 1600 local loaded maps "local" (global/ss_soundcache.scr, 8)
local.master = ^
I put the exec call just above level waittill spawn like jv's post said in case anyone's wondering.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

local.master = aliascache

should have been

local.master aliascache

Like JV and Rookie One.pl {sfx} said and 1 scriptmaster is ok
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

whew, that was it. sorry for the noobishness guys, it finally works. But sometimes there's dead randoms where no sound is played, it's alright but if it can be fixed...

they're a little quiet imo, how can i pump up the volum?? (intentional accent)
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

lizardkid wrote:Well i always saw posts on people wanting to make things say things and they needed to spawn a fx/dummy as a fake mouthpiece for the player.
Look in my FFE's source and you'll see it's the players who play the "Roger, coordinates received" and stuff. In fact, you can make ANY entity play a sound.

And for God's sake, is the map called 'local'? If not, no wonder it doesn't work...
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

And for God's sake, is the map called 'local'? If not, no wonder it doesn't work...
uh, it works Rook :S

i ran in by a map called test_squad.map with that exec, it works fine :S all of them :S
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I see. That's because all sounds and animations are loaded for maps with the test_ prefix. However, keep in mind that if you change or remove this test_ from the name of your map, it won't work anymore, unless you change the alias.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

alright, i thought local meant it loads for the local map only. so how can i make these sounds work with the map they're called from?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

local.master aliascache (...) maps (getcvar mapname)
Image
Post Reply