LoneRaptor Posted September 3, 2016 Share Posted September 3, 2016 (edited) Try this: You need to add the script to the button or the chest. And make sure all the properties have been filled in. Create a fromlist in the CK which you fill with the guns you wan't to be able to add. ScriptName MysteryboxScript Extends Objectreference MiscObject Property Caps001 Auto ;Auto fill this in the CK FormList Property Guns Auto ;A formlist of all the guns you want to add a random one to the container Actor Property PlayerREF Auto ; auto fill this in the CK ObjectReference Property Chest Auto ;Fill this Property with your chest Message Property NotEnoughCapsMessage Auto ;Create a messagebox in the CK to show if the player doesnt have enough caps. Int AmountOfCapsToTake = 100 ;Here you decide how many caps to take from the player Event OnActivate(ObjectReference akActionRef) If(PlayerREF.GetItemCount(Caps001) >= AmountOfCapsToTake) ;Checks if the player has enough caps to give. PlayerREF.RemoveItem(Caps001, AmountOfCapsToTake) Int RandomValue = Utility.RandomInt(0, (Guns.GetSize() - 1)) ;This pics a random gun from the list Chest.AddItem(Guns.GetAt(RandomValue), 1) ;Adds 1 gun from the list at random to he chest ElseIF(PlayerREF.GetItemCount(Caps001) < AmountOfCapsToTake) NotEnoughCapsMessage.Show() EndIf EndEvent Edited September 3, 2016 by LoneRaptor Link to comment Share on other sites More sharing options...
ajhakra Posted September 3, 2016 Author Share Posted September 3, 2016 I just wrote that script for something to go off of,no idea if it works,im also a noob myself :tongue: it also doesn't include and dialog boxes or anything its just simply click box if player has caps roll dice give random item, you probably would want to use http://www.creationkit.com/fallout4/index.php?title=Message_Script to add some message boxes, the first tutorial of the video below goes into messages if you don't know how. Heres some videos and information I used to learn what I know This guy has great videos, watch all of them, I was recommended these myself Heres some sources for events and functions. Functions : http://www.creationkit.com/fallout4/index.php?title=Category:Papyrus Events : http://www.creationkit.com/fallout4/index.php?title=Category:EventsYou may be a noob but you are still much better than me at this stuff! This is more of an idea for a mod I am thinking of making so as for extra details such as messages and stuff they can come in the future! Link to comment Share on other sites More sharing options...
ajhakra Posted September 3, 2016 Author Share Posted September 3, 2016 Try this: You need to add the script to the button or the chest. And make sure all the properties have been filled in. Create a fromlist in the CK which you fill with the guns you wan't to be able to add. ScriptName MysteryboxScript Extends Objectreference MiscObject Property Caps001 Auto ;Auto fill this in the CK FormList Property Guns Auto ;A formlist of all the guns you want to add a random one to the container Actor Property PlayerREF Auto ; auto fill this in the CK ObjectReference Property Chest Auto ;Fill this Property with your chest Message Property NotEnoughCapsMessage Auto ;Create a messagebox in the CK to show if the player doesnt have enough caps. Int AmountOfCapsToTake = 100 ;Here you decide how many caps to take from the player Event OnActivate(ObjectReference akActionRef) If(PlayerREF.GetItemCount(Caps001) >= AmountOfCapsToTake) ;Checks if the player has enough caps to give. PlayerREF.RemoveItem(Caps001, AmountOfCapsToTake) Int RandomValue = Utility.RandomInt(0, (Guns.GetSize() - 1)) ;This pics a random gun from the list Chest.AddItem(Guns.GetAt(RandomValue), 1) ;Adds 1 gun from the list at random to he chest ElseIF(PlayerREF.GetItemCount(Caps001) < AmountOfCapsToTake) NotEnoughCapsMessage.Show() EndIf EndEvent Thanks man! I'll give that a try aswell! Link to comment Share on other sites More sharing options...
ajhakra Posted September 3, 2016 Author Share Posted September 3, 2016 Try this: You need to add the script to the button or the chest. And make sure all the properties have been filled in. Create a fromlist in the CK which you fill with the guns you wan't to be able to add. ScriptName MysteryboxScript Extends Objectreference MiscObject Property Caps001 Auto ;Auto fill this in the CK FormList Property Guns Auto ;A formlist of all the guns you want to add a random one to the container Actor Property PlayerREF Auto ; auto fill this in the CK ObjectReference Property Chest Auto ;Fill this Property with your chest Message Property NotEnoughCapsMessage Auto ;Create a messagebox in the CK to show if the player doesnt have enough caps. Int AmountOfCapsToTake = 100 ;Here you decide how many caps to take from the player Event OnActivate(ObjectReference akActionRef) If(PlayerREF.GetItemCount(Caps001) >= AmountOfCapsToTake) ;Checks if the player has enough caps to give. PlayerREF.RemoveItem(Caps001, AmountOfCapsToTake) Int RandomValue = Utility.RandomInt(0, (Guns.GetSize() - 1)) ;This pics a random gun from the list Chest.AddItem(Guns.GetAt(RandomValue), 1) ;Adds 1 gun from the list at random to he chest ElseIF(PlayerREF.GetItemCount(Caps001) < AmountOfCapsToTake) NotEnoughCapsMessage.Show() EndIf EndEvent Yea that works perfectly! Thanks a lot!! Now it's time to make a model and possibly an animation for it!! Link to comment Share on other sites More sharing options...
ajs52698 Posted September 3, 2016 Share Posted September 3, 2016 (edited) Ah thats a better script! Edited September 3, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
Recommended Posts