WestTek Posted August 25, 2016 Share Posted August 25, 2016 Greetings fellow modders. I've been looking around the scripting section of the wiki looking for clues on how I can create a script that plays a custom sound when Power Armor Battery levels reach 25 or below and plays each time it is at this level when the player gets into the Power Armor suit. Here's my dilemma:- My A.C.S. sound mod replaces UI_PowerArmorBattery_CapacityLow.wav with a custom sound. (this sound is triggered when the fusion core ammo is at 25 or below)- Unfortunately the game is hard coded to trigger this sound when the player exits the Power Armor (according to one Bethesda dev from the CK forums)- A possible alternative solution? To script a play event when the script detects AmmoFusionCore is 25 or less. I am new to scripting but have been reading on papyrus primer on the wiki. Any help in this matter would be greatly appreciated! P.S. Here is where I left off in my research. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 25, 2016 Share Posted August 25, 2016 Since you sent me a private message about this, posting here in case others with more knowledge specific to FO4 can improve upon this. I'm clueless on Fallout 4. But this is how I'd do it in Skyrim and I've checked that each function/event is present on the Fallout 4 side of the CK wiki. This assumes you know how to properly set up the use of Play in a script. This would go on a player alias script. Ammo Property MyAmmo Auto Actor Property PlayerRef Auto Bool TF_PlaySound = false Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If akBaseItem as Ammo && akBaseItem == MyAmmo If PlayerRef.GetItemCount(MyAmmo) <= 25 If TF_PlaySound == false TF_PlaySound = true ;play sound here EndIf EndIf EndIf EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If akBaseItem as Ammo && akBaseItem == MyAmmo If PlayerRef.GetItemCount(MyAmmo) > 25 If TF_PlaySound == true TF_PlaySound = false ;reset bool so that sound can play next time at or below 25 EndIf EndIf EndIf EndEvent You'd still need to do something about the default sound that plays at the same point. I suppose you could replace it with a silent sound file, but then there would be no sound at the other point where it is hardcoded to play. For Skyrim I'd also include a GetEquippedItemType check and make sure that a bow or crossbow was equipped as well. After all, you probably don't want the sound to go off every time the user decides to store their ammo in a container somewhere. FO4 has that event but I'm unsure of what values to use for your particular scenario, thus I left it out. If you can figure out how to use it, it can be added on to the first If statement. Link to comment Share on other sites More sharing options...
WestTek Posted August 26, 2016 Author Share Posted August 26, 2016 (edited) Thanks. There is also this entry that I have to put in there before the others, it asks if the player is in power armor. Otherwise the sound will play when he's out of the armor. bool Function IsInPowerArmor() Thank you, I'm gonna go back to the lessons to understand the scripting further and will come back to look at this reply. Edited August 26, 2016 by WestTek Link to comment Share on other sites More sharing options...
TummaSuklaa Posted August 26, 2016 Share Posted August 26, 2016 (edited) OnItemAdded/Remove now requires that you use AddInventoryEventFilters, or the Events wont run at all. A departure from how they work in Skyrim. Edited August 26, 2016 by TummaSuklaa Link to comment Share on other sites More sharing options...
Recommended Posts