Jump to content

How to get an NPC to give an item to the player?


Recommended Posts

I'm working on a follower mod, and one conversation involves said follower giving an item to the player. Thing is, this seemingly very simple thing is apparently much more complicated than I'd thought.

 

I've done a little bit of research online and from what I can gather you're supposed to turn the item in question into a quest alias, then reference that quest alias in the script for giving the item, but so far this hasn't worked for me, so if anyone would be willing to provide a step-by-step guide to this for stupid dummies like me I'd appreciate it.

Link to comment
Share on other sites

On your fragment add:

MiscObject Property MyMisc Auto


Game.GetPlayer().AddItem(MyMisc, 1)


The item's property that will be given should be adjusted if it's something else instead of a "Misc Object".

If it's armor then > Armor Property MyArmor Auto

Etc...

Link to comment
Share on other sites

  • 3 months later...

Here you go - this script gives a feather to player:

 

The fragment part that you want to paste first in end fragment is: Game.GetPlayer().AddItem(FeatherFalcon,1, False)

then let CK assign a name to your script. I have not had any luck with changing script names in dialogue so suggest you just leave as is after you are done and compile succeeded you will want to set the property to whatever your item is by clicking on properties if you do this right a little pencil should show up next to your script icon.

 

I set conditions in the dialogue to check for existing inventory before giving the feather.

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 1
Scriptname TIF__050ACB06 Extends TopicInfo Hidden
MiscObject Property FeatherFalcon Auto
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
Game.GetPlayer().AddItem(FeatherFalcon,1, False)
Debug.MessageBox("Bird easily escapes leaving only a bird feather.")
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
Good Luck!
Update: I just learned this ... if you convert your file to an ESL CK will update the CK assigned dialogue name/numbers so you have to redo your scripts...so umm...that's fun right? :smile:
Edited by Adventurer1111
Link to comment
Share on other sites

  • Recently Browsing   0 members

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