Jump to content

Skyrim Special Edition Simple Papyrus Script Help


Recommended Posts

I am writing a simple Papyrus Script that adds a weapon and armor to the game after pressing a button (Like a button in Cheatroom). The script runs because it brings up the debug message however, the gear I try to add never gives it to the player. Is there something I'm missing?

- Skyrim Special Edition, Latest Version with all DLC, PC

        Function AllStartGear()
	Player.AddItem(Lockpick, 20, true)
	Player.AddItem(HealthPotion, 5, true)
	Game.GetPlayer().AddItem(Lockpick, 12)
	Game.GetPlayer().AddItem(Longbow, 1)
	Game.GetPlayer().AddItem(IronArrow, 12)
	debug.MessageBox("All Starting Gear Added")
        
 ;END FRAGMENT CODE - Do not edit anything between this and the begin comment
        Actor Property Player  Auto
        Potion Property HealthPotion Auto
        MiscObject Property Lockpick  Auto 
        Weapon Property Longbow  Auto 
        Ammo Property IronArrow  Auto
        EndFunction 
Edited by winteriphone
Link to comment
Share on other sites

You have to tell the button what those properties mean by attaching each property to a specific thing in the game. Edit the button, select the script where you see it in the Papyrus Scripts panel and click on [ Properties ]. This will bring up a form where your five properties are listed. Click on each one in turn and select its value from the pull-down. You can try clicking on [ Auto Fill All ] first; if the name of a property is the same as the name of the object it will fill it in for you. For example IronArrow will get filled in with the 0001397D Iron Arrow form, which is probably what you want.

Link to comment
Share on other sites

You've written your properties inside the function. They cannot go there. Properties can only go within the empty state. They cannot be inside functions or events.

 

My other thought:

You can put this script on your pre-placed instance of the button activator. Not the base object mind you but the instance placed in the render window.

 

 

Scriptname MyButtonScript Extends ObjectReference

Actor Property PlayerRef  Auto  ;PlayerRef will allow the CK to autofill the property
Potion Property HealthPotion Auto
MiscObject Property Lockpick  Auto 
Weapon Property Longbow  Auto 
Ammo Property IronArrow  Auto
Bool doOnce = false

Event OnActivate(ObjectReference akActivator)
  If akActivator == PlayerRef
    If doOnce == false
      doOnce = true
      akActivator.AddItem(Lockpick, 20, true)
      akActivator.AddItem(HealthPotion, 5, true)
      akActivator.AddItem(Lockpick, 12)
      akActivator.AddItem(Longbow, 1)
      akActivator.AddItem(IronArrow, 12)
      debug.MessageBox("All Starting Gear Added")
    Else
      debug.MessageBox("Can only receive starting gear once")
    EndIf
  EndIf
EndEvent      

 

 

If it is part of a quest, that same script can go on an alias which points to the button activator.

 

Now, since what you posted is not a full script... Let us leave room for misunderstanding in what you are wanting to accomplish.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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