Jump to content

Mystery Box Style Shop


ajhakra

Recommended Posts

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 by LoneRaptor
Link to comment
Share on other sites

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:Events

You 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

 

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

 

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

  • Recently Browsing   0 members

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