How do I make a sound play once in a script for opening a do

Post » Wed May 02, 2012 8:59 pm

I have a skill check setup for shooting out a door lock and I can't figure out how to make a gunshot play just the one time, is it possible or am I SOL? :confused:

Thanks guys


Scn NVIntKatzBathDoorScript		int bfixed     ;1=player has shot the door mechanism 		int bshowmessage		int ibuttonBegin Onactivate		if bfixed			Activate		else			showmessage NVIntKatzBathDoorMessage01		set bshowmessage to 1	endifEndBegin GameMode		set iButton to GetButtonPressed		if ibutton == 0			return		elseif (ibutton == 1)			set bfixed to 1			showmessage NVIntKatzBathDoorShotOutRewardXP 35 Activate			endif		endif	endifEnd


wolf
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Wed May 02, 2012 7:06 pm

I have a skill check setup for shooting out a door lock and I can't figure out how to make a gunshot play just the one time, is it possible or am I SOL? :confused:

Thanks guys


Scn NVIntKatzBathDoorScript		int bfixed     ;1=player has repaired the door		int bshowmessage		int ibuttonBegin Onactivate		if bfixed			Activate		else			showmessage NVIntKatzBathDoorMessage01		set bshowmessage to 1	endifEndBegin GameMode		set iButton to GetButtonPressed		if ibutton == 0			return		elseif (ibutton == 1)			set bfixed to 1			showmessage NVIntKatzBathDoorShotOutRewardXP 35 Activate			endif		endif	endifEnd


wolf


i dont quite understand what your trying to do =S, my scripting skill isnt that good but is it just one part of the script you dont want to repeat or the entire script? would ya mind annotating the script just so i can understand it better?

if not my only suggestion is put a Doonce variable in with another if statement
User avatar
Daniel Lozano
 
Posts: 3452
Joined: Fri Aug 24, 2007 7:42 am

Post » Thu May 03, 2012 1:33 am

i dont quite understand what your trying to do =S, my scripting skill isnt that good but is it just one part of the script you dont want to repeat or the entire script? would ya mind annotating the script just so i can understand it better?

if not my only suggestion is put a Doonce variable in with another if statement

I have the script on a door that does a skill check on the players gun skill level, if the skill is great enough you can shoot out the lock mechanism to activate the door. Right now the sound is just a door opening but I want to playback a gun shot just the first time the door is activated........I hope that helps....Thank you


wolf
User avatar
DarkGypsy
 
Posts: 3309
Joined: Tue Jan 23, 2007 11:32 am

Post » Wed May 02, 2012 9:29 pm

try something like what i have here in bold


Scn NVIntKatzBathDoorScript                [b]short Doonce[/b]		int bfixed     ;1=player has shot the door mechanism 		int bshowmessage		int ibuttonBegin Onactivate		if bfixed			Activate		else			showmessage NVIntKatzBathDoorMessage01		set bshowmessage to 1	endifEndBegin GameMode                [b]set Doonce to 0[/b]		set iButton to GetButtonPressed 		if ibutton == 0			return		elseif (ibutton == 1)			set bfixed to 1			showmessage NVIntKatzBathDoorShotOut              [b]          if Doonce == 0                            Playsound [Soundname]                        set Doonce to 1                        endif [/b]RewardXP 35 Activate			endif		endif	endifEnd



That will only play a gun shot sound once you have to choose the sound, so it might not sound like the weapon your holding, i hope this helps i still dont understand this script as im new to scripting as well !!!

good luck!
User avatar
Trista Jim
 
Posts: 3308
Joined: Sat Aug 25, 2007 10:39 pm

Post » Thu May 03, 2012 1:24 am

kanoba thanks alot :icecream: I will give it a try after dinner and let you know how it goes.


wolf
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Wed May 02, 2012 11:39 pm

OK I get and error for line 2 (GECKPU) have a look http://i588.photobucket.com/albums/ss326/bigcrazewolf/Scripterrorpic.jpg...something about script command b not found :shrug:


wolf
User avatar
Claire
 
Posts: 3329
Joined: Tue Oct 24, 2006 4:01 pm

Post » Wed May 02, 2012 12:35 pm

OK I get and error for line 2 (GECKPU) have a look http://i588.photobucket.com/albums/ss326/bigcrazewolf/Scripterrorpic.jpg...something about script command b not found :shrug:


wolf
Sorrry! i ment to bold the text i changed so just take out the "[ b ]" and "[ /b ]"
User avatar
Roanne Bardsley
 
Posts: 3414
Joined: Wed Nov 08, 2006 9:57 am

Post » Thu May 03, 2012 2:44 am

Sorrry! i ment to bold the text i changed so just take out the "[ b ]" and "[ /b ]"


Ah ok no problem :icecream: lemme give it another shot, thanks again.

wolf
User avatar
Hot
 
Posts: 3433
Joined: Sat Dec 01, 2007 6:22 pm

Post » Wed May 02, 2012 5:53 pm

Ah another day another new issue :facepalm:

I found the sound I wanted to use in the GECK and here is the script line

Playsound (WPNLeverActShotgunFire2D) 

I get the error :

Missing parameter sound.
Compiled script not saved!


:huh:
User avatar
Jeff Tingler
 
Posts: 3609
Joined: Sat Oct 13, 2007 7:55 pm

Post » Wed May 02, 2012 11:45 am

1. You do not put parethesis around the sound name.
2. The way your button retrieval is setup WILL mess up your game. You need to only check it when you menu is 'active'.
3. You donot need to use the doOnce, you can use your existing variable named 'bshowmessage'.

Scn NVIntKatzBathDoorScriptint bfixed		;1=player has shot the door mechanismint bshowmessageint ibuttonBegin Onactivate	if bfixed		Activate	else		if bshowmessage == 0			showmessage NVIntKatzBathDoorMessage01			set bshowmessage to 1		endif	endifEndBegin GameMode	if bshowmessage == 1		set iButton to GetButtonPressed		if ibutton == 0			set bshowmessage to 0			return		elseif ibutton == 1			set bfixed to 1			set bshowmessage to 2			showmessage NVIntKatzBathDoorShotOut			Playsound WPNLeverActShotgunFire2D			RewardXP 35			Activate		endif	endifEnd
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Wed May 02, 2012 1:39 pm

Thanks WillieSea :icecream: I'm gonna put that in now and fire it up.


wolf
User avatar
Farrah Barry
 
Posts: 3523
Joined: Mon Dec 04, 2006 4:00 pm

Post » Thu May 03, 2012 3:11 am

Works wonderfully WillieSea :celebration:

Thanks again for your help.

wolf
User avatar
Rob
 
Posts: 3448
Joined: Fri Jul 13, 2007 12:26 am

Post » Wed May 02, 2012 6:08 pm

Glad to hear its working, I was just coding on the fly. lol
User avatar
Lilit Ager
 
Posts: 3444
Joined: Thu Nov 23, 2006 9:06 pm


Return to Fallout: New Vegas