Jump to content

[Skyrim] Add an Item at Game Load


Kendo 2
 Share

Recommended Posts

Here's the script.  As written, this script will add one Iron Cuirass as soon as the game loads.

K2_Add an Item at Game Load Script.txt

To use this:

Create a new quest and in the Quest Data tab check the boxes for Start Game Enable and Run Once.  Click OK and then open the quest again.

Go to the Quest Aliases Tab and right click for 'New Reference Alias'.  Name it Player and at 'Unique Actor' select Player.  Check the box for 'Reserves Reference' and then hit the Enter key on your keyboard.  That will close the tab.  Open the tab again.

In the field for 'Papyrus Scripts' click the 'Add' button and wait for everything to load.  This might take as long as a minute to finish.  Ignore the errors that will pop up, because they will.

Once everything loads you will see a dialogue window.  The first one will be (New Script).  Double click it.  Give it a name you can easily recognize and leave 'ReferenceAlias' alone.  You need that.  Click OK.

Now you should have the empty script listed.  Right click it and 'Open in Exterior Editor'.  Copy and paste the script I included into it and Save and Exit.

Right click the script again but this time go to 'Edit Source'.  Your script should be there.  Click File and Save and let it compile.  You should get no errors and see 'Compilation Completed'.

Click on the script to high-light it and click the 'Properties' button.  Both fields should be filled and the script should look like a blue cross with a yellow pencil next to it.  Remove the check mark next to 'Reserves Reference' you added earlier.  Hit Enter on your key board.  Click OK on the quest to close it.  Save the esp.

IF everything went as planned the vanilla game iron armor should be added to character at game load.  Best of luck to you, since this is modding Skyrim. :S

* replace everything I have in yellow with your own stuff.

____________________________________________________________________________________

;add/equip the player with the item when the mod is loaded.

Armor Property ArmorIronCuirass Auto
Quest Property GiveIronArmorQuest auto

Function TraceMe(string msg)
    Debug.Trace("GiveIronArmorQuest"+ msg)
EndFunction

Function GiveIronArmor()
    TraceMe("GiveIronArmor")
    ObjectReference selfref = self.GetReference()
    if selfref != None
    selfref.AddItem(ArmorIronCuirass, 1, false)
    Game.GetPlayer().EquipItem(ArmorIronCuirass, abSilent = true)
    endIf
EndFunction

Event OnInit()
    RegisterForSingleUpdate(1)    
EndEvent

Event OnUpdate()
    GotoState("Busy")
    GiveIronArmor()
    GotoState("")
EndEvent

State Busy
    Event OnInit()
    EndEvent

    Event OnReset()
    EndEvent

    Event OnPlayerLoadGame()
    EndEvent

    Event OnUpdate()
    EndEvent
EndState

____________________________________________________________________________________

  • Like 4
Link to comment
Share on other sites

NOTE:  If you don't want the item automatically equipped on the player then place a semicolon in front of the line:

Game.GetPlayer().EquipItem(ArmorIronCuirass, abSilent = true)

Make it look like this:

;Game.GetPlayer().EquipItem(ArmorIronCuirass, abSilent = true)

^_^

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

'


×
×
  • Create New...