Script Trouble...

Post » Tue May 17, 2011 1:58 pm

I've been trying to get a sound to play as the player enters VATS however, you don't hear the sound until after the player has exited VATS. And as far as I can tell there isn't anything wrong with the script, so I'm looking for ideas as to whats causing the sounds to delay playing until VATS is off.

Here's the script, the part with VATS is at the end.

scn aa3EFdrgsscript1float timer;short refresh;Short StartUpSoundShort StealthSoundStartShort NeedsMedXShort VHurtShort VRadFloat Timer2Float Timer3Short VVatsShort VCombatBegin OnEquip Player	Set StartUpSound to 1	Set StealthSoundStart to 1EndBegin OnUnequip	Set StartUpSound to 0	Set StealthSoundStart to 0EndBegin GameMode	if refresh == 0		if timer < .5			set timer to timer + GetSecondsPassed;		else			set timer to 0;			set refresh to 1;		endif	else		if IsKeyPressed 46			if aadrgplatesf1 == 0				set aadrgplatesf1 to 1;				PlaySound NPCMedicArmorStealth				set refresh to 0;			else				set aadrgplatesf1  to 0;				set refresh to 0;			endif		endif	endifEndBegin GameMode	If Player.GetEquipped 3EFdrg011 == 1		If StartUpSound == 1			PlaySound NPCMedicArmorStart			Set StartUpSound to 0		EndIf	ElseIf Player.GetEquipped 3EFdrg021 == 1		If StartUpSound == 1			PlaySound NPCMedicArmorStart			Set StartUpSound to 0		EndIf	ElseIf Player.GetEquipped 3EFdrg031 == 1		If StartUpSound == 1			PlaySound NPCMedicArmorStart			Set StartUpSound to 0		EndIf	ElseIf Player.GetEquipped 3EFdrg041 == 1		If StartUpSound == 1			PlaySound NPCMedicArmorStart			Set StartUpSound to 0		EndIf	ElseIf Player.GetEquipped 3EFdrg051 == 1		If StartUpSound == 1			PlaySound NPCMedicArmorStart			Set StartUpSound to 0		EndIf	EndIf		;StimpakIf Player.HasMagicEffect RestoreHealthStimpak == 0	If Player.GetHealthPercentage <= 0.25		;We have different sounds if this is our last Stimpak		If Player.GetItemCount Stimpak == 1			PlaySound NPCMedicArmorStimpakEmpty			Player.CastImmediateOnSelf MedicStimpak			Player.RemoveItem Stimpak 1			ElseIf Player.GetItemCount Stimpak > 0			PlaySound NPCMedicArmorStimpak			Player.CastImmediateOnSelf MedicStimpak			Player.RemoveItem Stimpak 1			EndIf	EndIfEndIf;Check for combat for Med-X, and Stim-paks;if Player.IsInCombat == 1Set NeedsMedX to 0If Player.HasMagicEffect MorphineEffect == 0	;I do this one like this to avoid a HUGE list	If Player.GetAv EnduranceCondition <= 25		Set NeedsMedX to 1	ElseIf Player.GetAv PerceptionCondition <= 25		Set NeedsMedX to 1	ElseIf Player.GetAv LeftMobilityCondition <= 25		Set NeedsMedX to 1	ElseIf Player.GetAv RightMobilityCondition <= 25		Set NeedsMedX to 1	ElseIf Player.GetAv LeftAttackCondition <= 25		Set NeedsMedX to 1	ElseIf Player.GetAv RightAttackCondition <= 25		Set NeedsMedX to 1	ElseIf Player.GetHealthPercentage <= 0.33		Set NeedsMedX to 1	EndIfEndIf				If NeedsMedX == 1	;We have different sounds if this is the last MedX	If Player.GetItemCount Morphine == 1		PlaySound NPCMedicArmorMedXEmpty		Player.CastImmediateOnSelf MedicMorphine		Player.RemoveItem Morphine 1		ElseIf Player.GetItemCount Morphine > 0		PlaySound NPCMedicArmorMedX		Player.CastImmediateOnSelf MedicMorphine		Player.RemoveItem Morphine 1		EndIfEndIf;Rad-X (or as the voice calls it Radiation-X)If Player.HasMagicEffect RadXEffect == 0	If Player.GetRadiationLevel >= 1		;We also have a different sound for each of these		If Player.GetItemCount RadX == 1			PlaySound NPCMedicArmorRadXEmpty			Player.CastImmediateOnSelf MedicRadX			Player.RemoveItem RadX 1			ElseIf Player.GetItemCount RadX > 0			PlaySound NPCMedicArmorRadX			Player.CastImmediateOnSelf MedicRadX			Player.RemoveItem RadX 1			EndIf	EndIfEndIf;Rad-AwayIf Player.HasMagicEffect RestoreRadiationLevel == 0													If Player.GetActorValue radiationrads > 190		;We have different sounds if this is our last RadAway		If Player.GetItemCount RadAway == 1			PlaySound NPCMedicArmorRadAwayEmpty			Player.CastImmediateOnSelf MedicRadAway			Player.RemoveItem Radaway 1		ElseIf Player.GetItemCount RadAway > 0			PlaySound NPCMedicArmorRadAway			Player.CastImmediateOnSelf MedicRadAway			Player.RemoveItem Radaway 1		EndIf	EndIfEndIfIf VHurt == 0	If Player.GetHealthPercentage <= 0.20		PlaySound NPCMedicArmorHurt		Set VHurt to 1	EndifEndifIf VHurt == 1	set Timer2 to Timer2 + GetSecondsPassed;	If Timer2 >= 5		If Player.GetHealthPercentage <= 0.20			PlaySound NPCMedicArmorHurt			Set Timer2 to 0		Else			Set VHurt to 0			set Timer2 to 0;		Endif	EndifEndifIf VRad == 0	If Player.GetRadiationLevel >= 1		PlaySound NPCMedicArmorRad		Set VRad to 1	EndifEndifIf VRad == 1	set Timer3 to Timer3 + GetSecondsPassed;	If Timer3 >= 5		If Player.GetRadiationLevel >= 1			PlaySound NPCMedicArmorRad			Set Timer3 to 0 		Else			Set VRad to 0			set Timer3 to 0;		Endif	EndifEndifIf VCombat == 0	If Player.IsInCombat == 1		PlaySound NPCMedicArmorThreat		Set VCombat to 1	EndifEndifIf VCombat == 1	If Player.IsInCombat == 0		PlaySound NPCMedicArmorNoThreat		Set VCombat to 0	EndifEndifEndBegin MenuMode 1056If VVats == 0	Set VVats to 1EndIfEndBegin GameModeIf VVats == 1	PlaySound NPCMedicArmorVATSEnter	Set VVats to 2EndIfIf VVats == 2	If GetVATSMode == 0		PlaySound NPCMedicArmorVATsixit		Set VVats to 0	EndIfEndIfEnd

User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm

Post » Tue May 17, 2011 3:09 pm

1) Please remove all the seperate 'GameMode' blocks and put them into one GameMode block. It gains you nothing by splitting them up like that.

2) GameMode blocks 'do not' run when you are in a menu, which I would guess Vats is a sort of menu. If not, then ignore this observation. All your playsound commands are in a GameMode block which will run when out of menu mode.
User avatar
sarah
 
Posts: 3430
Joined: Wed Jul 05, 2006 1:53 pm

Post » Tue May 17, 2011 3:01 pm

Thanks for the reply, I'll put all the gamemodes into 1 block then but that doesn't solve the problem, cause I've also tried this and it doesn't work either.

Begin MenuMode 1056; 1056 is the Vats menuIf VVats == 0	If GetVATSMode > 0		PlaySound NPCMedicArmorVATSEnter		Set VVats to 1	EndIfEndIfIf VVats == 1	If GetVATSMode == 0		PlaySound NPCMedicArmorVATsixit		Set VVats to 0	EndIfEndIfEnd


I've also tried using just "Begin MenuMode" but still you don't hear the sounds until you exit VATS
User avatar
Yvonne
 
Posts: 3577
Joined: Sat Sep 23, 2006 3:05 am

Post » Tue May 17, 2011 12:30 am

I think for the first GetVATSMode you want == 2 not 1, since 2 is the menu portion of it? And put the second block (If VVats == 1) in the gamemode block since again if vats mode == none, or your not in vats, your in the game, so menumode code stops running. Then maybe it will work.
User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm

Post » Tue May 17, 2011 12:17 am

Wait I made a typo, I meant > not ==

Begin MenuMode 1056; 1056 is the Vats menuIf VVats == 0	If GetVATSMode > 0		PlaySound NPCMedicArmorVATSEnter		Set VVats to 1	EndIfEndIfIf VVats == 1	If GetVATSMode == 0		PlaySound NPCMedicArmorVATsixit		Set VVats to 0	EndIfEndIfEnd

User avatar
StunnaLiike FiiFii
 
Posts: 3373
Joined: Tue Oct 31, 2006 2:30 am

Post » Tue May 17, 2011 1:21 am

Reguardless, place this portion in a GameMode block or it wont run.

If VVats == 1	If GetVATSMode == 0		PlaySound NPCMedicArmorVATsixit		Set VVats to 0	EndIfEndIf


Since that runs once you exit vats, which is no longer menumode, but gamemode.
User avatar
Felix Walde
 
Posts: 3333
Joined: Sat Jun 02, 2007 4:50 pm


Return to Fallout 3