Jump to content

[LE] How to add items into player inventory?


Holzey

Recommended Posts

What I usually do is make a new quest that's start game enabled. Then you can put a script on the quest that adds items when the mod is installed:

 

Scriptname TM_QuestScript extends Quest 

Book Property SpellBookA Auto 
Book Property SpellBookB Auto 
Actor Property PlayerRef Auto 

Event OnInit() 
    Utility.Wait(1)
    PlayerRef.AddItem(SpellBookA, 1)
    PlayerRef.AddItem(SpellBookB, 1)
    Self.Stop() ;Stop this quest.
EndEvent

If you have a lot of books or items to add, you can use a formlist instead. Make a new one in the creation kit under miscellaneous / formlists, then drag and drop the items you want to add into the list. The script would look like this:

Scriptname TM_QuestScript extends Quest 

Formlist Property InstallItems Auto
Actor Property PlayerRef Auto 

Event OnInit() 
    Utility.Wait(1)
    PlayerRef.AddItem(InstallItems, 1) ;add 1 of each item in the InstallItems formlist to the player
    Self.Stop() ;Stop this quest.
EndEvent

Name the script something more unique. After compiling and attaching the script to your quest, make sure you fill your properties. If you're a beginner in scripting this is a good tutorial: http://www.cipscis.com/skyrim/tutorials/beginners.aspx

 

Also to find more about script properties you can go here:

http://tesalliance.org/forums/index.php?/topic/5039-class-2-properties/

Link to comment
Share on other sites

There is a script free way of adding items to the player inventory. Create a quest. Add an alias pointing to the player. Add the items to the inventory section of the alias. When the quest is started the items will be added to the player's inventory.

 

Sometimes it is not feasible to do it this way, but it is still a good idea to know that it is possible and how to do it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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