OmalleyPike Posted June 26, 2016 Share Posted June 26, 2016 (edited) I'm trying to add a sound to some armor i'm making, but I kinda hit a brick wall when it comes to adding sound. All I want, is, when my character equips the item, then a sound will loop until I unequip the item The problem: I've never used papyrus before. It seems similar to LUA, a language i'm familiar with but needlessly complex. I can't work out how I address a specific sound to play. The CK forums suggest using an identifier (ex. mysound), but how do I link that to a WAV file? All I have right now is this: Scriptname Bodysoundloop extends ObjectReference Hidden int intArmorSFX = ArmorBodySFX.play(self) Sound.SetInstanceVolume(intArmorSFX, 1) Sound.StopInstance(intArmorSFX) Does ArmorBodySFX refer to the ObjectReference of a Sound Descriptor or something? I have no idea... Help please! Edited June 26, 2016 by OmalleyPike Link to comment Share on other sites More sharing options...
radiumskull Posted June 27, 2016 Share Posted June 27, 2016 I don't know anything about Papyrus (yet), but 'ArmorBodySFX' almost certainly a reference to an object inside CK. CK is all about long chains of references inside references, as you may have seen. I don't think the script would have the ability to directly reference a WAV file, so it's probably a pointer to something with an Object ID. Link to comment Share on other sites More sharing options...
OmalleyPike Posted June 27, 2016 Author Share Posted June 27, 2016 (edited) Okay so I did some more work on this today and I managed to get the script to compile and link my Sound Property to my Sound Descriptor, but unfortunately it doesn't play the sound in-game. Any ideas? Scriptname Bodysoundloop extends ObjectReference Sound Property ArmorSFX_LP auto Int Property ArmorSFX auto Int Property Armorplay auto Event OnEquipped(Actor akActor) ArmorSFX = ArmorSFX_LP.play(self) Sound.SetInstanceVolume(ArmorSFX, 1) EndEvent Event OnUnequipped(Actor akActor) Sound.StopInstance(ArmorSFX) EndEvent Again, thanks! EDIT: I managed to fix the problem: The problem was, that using ArmorSFX - ArmorSFX_LP.play(self) attempts to play the sound from the script itself (to my understanding) instead of an object in-world. So instead of using that, we add an additional ObjectReference which is linked to the PlayerRef. This then defines the source of the sound to be the player, not the script itself. The finished script looks like this: Scriptname Bodysoundloop extends ObjectReference Sound Property ArmorSFX_LP auto Int Property ArmorSFX auto Int Property Armorplay auto ObjectReference Property soundsourceplayer auto Event OnEquipped(Actor akActor) ArmorSFX = ArmorSFX_LP.play(soundsourceplayer) Sound.SetInstanceVolume(ArmorSFX, 1) EndEvent Event OnUnequipped(Actor akActor) Sound.StopInstance(ArmorSFX) EndEvent Edited June 28, 2016 by OmalleyPike Link to comment Share on other sites More sharing options...
Recommended Posts