Jump to content

Recommended Posts

Posted

If I want to play a sound when taking hide from a vanilla wolf, I just attach the script OnAdd to the item. But the sound will play whenever the item is added to the player, not just when taking it from the wolf. So I tried this:

ScriptName TakeWolfHideSound

short IsWolf
short FlagWolfOnce
short TakeOnce

Begin GameMode
	If FlagWolfOnce == 0
		If GetContainer == VanillaWolf01 || GetContainer == VanillaWolf02|| GetContainer == VanillaWolf03 && FlagWolfOnce == 0
			Set IsWolf to 1
			Set FlagWolfOnce to 1
		EndIf
	EndIf
End

Begin OnAdd Player
	If IsWolf == 1 && TakeOnce == 0
		Playsound NPCTakeWolfHideSound
		Set TakeOnce to 1
	EndIf
End

This script does not play sound. I think it's because when I take the item and OnAdd Player executes, the entire script is reset, IsWolf is 0 and TakeOnce is 0 again. Correct? So no sound played.

Remember, I only want the sound played once when taking the hide from a vanilla wolf.

So what should I do? Attach a new script to all 23 vanilla wolves that checks if they have 1 or more hides and plays a sound when the hide becomes 0 or decreases by 1? That's more conflict than 1 script on a vanilla item!

Advice?

Posted (edited)

I think I did it

ScriptName WolfTakeHideSoundItemScript

ref ThisWolf
short DeadWolfFlag
short WolfSoundOnce

Begin MenuMode 1008
	Set ThisWolf to GetContainer
	If ThisWolf.GetDead == 1 && DeadWolfFlag == 0
		Set DeadWolfFlag to 1
	ElseIf GetContainer == Player && DeadWolfFlag == 1 && WolfSoundOnce == 0
		Playsound NPCWolfTakeHideSound
		Set WolfSoundOnce to 1
	EndIf
End

Taking the item from any dead container gives the sound, but since that hide only appears on wolves it should be fine. Only plays once. I tested placing and taking it from a chest. All good. Only you can't pickpocket it off of live wolves if they have it. Just need to test barter and alchemy now.

Edited by nenina
I'm stupid
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...