Jump to content

Perk scripting - adding an item to an npc


Crosstieger

Recommended Posts

I successfully created a perk that lets you press the R-Key on you companion.

 

http://tm-kirsche.square7.ch/fallout.png

 

When you press the R-Key, the game should equip an item, in this case a "Doctors Bag", to the npc. I achieved the option to press the R-Key by adding a "Entry Point" to my perk with the following values:

 

Please ignore the "Papyrus Fragment" for now.

 

http://tm-kirsche.square7.ch/entrypoint.JPG

 

Now, to be able to equip the item I created a Papyrus fragment script.

 

 

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
Scriptname Fragments:Perks:PRKF_DocBagCompanionHeal_0100266B Extends Perk Hidden Const

;BEGIN FRAGMENT Fragment_Entry_00
Function Fragment_Entry_00(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
;Debug.Notification(GetTargetActor)
Game.GetPlayer().EquipItem(DoctorsBag)
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

MagicEffect Property DocBag_MagicEffect Auto Const
{Provides the script with the DocBag's magic effect}

Potion Property DoctorsBag Auto Const
{The DoctorsBag item}

Keyword Property DocBag_Keyword Auto Const
{Provides the keyword "PlayerCanStimpak"}

 

 

 

The important part is between the tag ;BEGIN CODE and ;END CODE. The rest was created automatically by the ck. My problem is: I don't quite know how to add the item to the targeted npc. Right now, the item will be equipped on the player - which works very well. As far as I understand the ck wiki, "ObjectReference akTargetRef" refers to the npc, but I don't understand how I should use this information...

 

http://www.creationkit.com/fallout4/index.php?title=Perk_Fragments

 

Thanks in advanced.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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