Jump to content

Papyrus Help


Recommended Posts

Greetings all :happy:

 

I am trying to get a terminal entry to remove an item from inventory, then add a perk, but I can't get off the ground...

this is what I found and not sure what is wrong, so a little help would be appreciated :laugh:

 

 

Scriptname testscript
Event OnActivate
Game.GetPlayer().AddPerk(perkname)
Game.GetPlayer().RemoveItem(itemname, 1)
endEvent
thank you all :cool:

 

Link to comment
Share on other sites

I don't know how the FO4 system works exactly (never played it). But for papyrus, your script is missing property entries. Properties are required to allow papyrus to know what objects it is supposed to be dealing with. Your script also needs to extend an existing script so that it knows what functions and events it can inherit. For most pre-placed objects that would be the ObjectReference script.

 

Try:

Scriptname TestScript Extends ObjectReference

Perk Property PerkName Auto
MiscObject Property ItemName Auto
;change the object type depending upon the type of object
;Weapon for weapon, Armor for armor, etc...

Event OnActivate(ObjectReference akActivator)
  Actor PlayerRef = Game.GetPlayer()
  PlayerRef.AddPerk(PerkName)
  PlayerRef.RemoveItem(ItemName,1)
EndEvent
Link to comment
Share on other sites

You don't need to listen for events when using fragments. They have their own events already defined. You just make entry then under script fragment make two properties for perkname and itemname and then inside fragment write:

Game.GetPlayer().AddPerk(perkname)

Game.GetPlayer().RemoveItem(itemname, 1)

Link to comment
Share on other sites

Terminal is an actual object with fragments? And here I had thought that terminal was just a term for an activator that looked like a computer. :P

But like I said, never played the game...

 

Don't follow my advice then, but do keep it in mind for when you write full scripts.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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