Jump to content

Papyrus Equip Item Script Help


IronDusk33

Recommended Posts

Two things.

 

One the script if attached to the player alias on a quest needs to extend ReferenceAlias. You may need to manually type that in.

 

Second your events and functions are all inside the comment brackets. { } remove those and the script should compile provided everything else is correct.

 

If I remove the brackets, it won't compile. It's probally because I use Notepad++, because when I build it in CK, I don't put them in. But opening them in N++, they're there. That script I posted did compile without errors.

 

And I can't get it to extend ReferenceAlias. It keeps saying it can't find that script.

Edited by dubird
Link to comment
Share on other sites

Then something is wrong with your setup. Use steam and verify both the game and the creation kit.

ReferenceAlias must be present in the pex form packed in the stock bsa as well as the psc form in the source folder.

 

The reason it compiles with the code in brackets is that you are telling the compiler that that stuff is unimportant for the game readable form (pex file).

 

P.S. Sorry for the late reply. Have not checked the Nexus in a few days.

Link to comment
Share on other sites

That's ok, I'm not on every day myself. ^_^

 

So, you're saying the brackets make it so that the game doesn't read it? Because it does put the ring in my inventory when I load my game, it just doesn't equip it.

 

And I'll verify everything this weekend, and see if that helps anyways.

Link to comment
Share on other sites

The item is added to player inventory because you assigned it to the player aliases inventory. Thus when the quest starts the item is added to the player inventory because the player alias is now active. All your script is doing is adjusting the equip status of the item.
Link to comment
Share on other sites

  • 2 weeks later...

Ok here is the working script from this mod. I have tested it ingame and it does work:

 

Scriptname IronHookEquipScript extends ObjectReference
Actor Property PlayerREF Auto
Armor Property IronHook Auto
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If akNewContainer == PlayerREF
Game.GetPlayer() .EquipItem (IronHook, true, true)
EndIf
EndEvent
Please note you need to connect the properties by right clicking on the script and selecting "Edit Properties". For the armor, you select "Pick Object" as the item you wish to equip, for the actor, you leave "Cell" as (any), and "Reference" as PlayerRef('Player')
FYI: I attached this to the item I was equipping, I don't think it matters but it works there.
And that's it! Surprisingly simple once you get it.
Edited by IronDusk33
Link to comment
Share on other sites

Ok, I do have another question involving scripting. I have noticed, if an item is equipped like above, with a script, and then the player turns into either a werewolf or a vampire lord (and another transformation similar) the item is unequipped and can be equipped and unequipped at will. I can probably spend a few hours trying to figure it out and end up posting here anyway, or I can just ask here first.

 

What I'm thinking of is something like this:

 

Actor Property PlayerRef Auto

Armor Propterty IronHook Auto

Quest Property IronHookQuest Auto

 

Event (Something here saying the hook has been unequipped)

If (Something here saying the IronHookQuest is active)

Game.GetPlayer .EquipItem (IronHook, true, true)

 

ElseIf (Do Nothing)

 

EndIf

 

EndEvent

 

 

The "IronHookQuest" is the quest which adds the Hook to the player. So when the hook is unequipped while the quest is active (which can only happen through the console, or through transformation) the Hook is automatically reequipped. You will then have the hook equipped while in werewolf/vampire form. I don't believe that actually effects anything, except the player now has the enchantments of the hook on during werewolf/vampire form. So, does anyone know which conditions/text/papyrus magic I need to put in here, or if there is a much easier way to do this?

Link to comment
Share on other sites

Ok, this is what I got so far:

 

Event OnObjectUnequipped (Form IronHook, ObjectReference akReference)
If (IronHookQuest.IsRunning())
Game.GetPlayer() .EquipItem (IronHook, true, true)
EndIf
EndEvent
However, it doesn't work, as far as I can see. Does anyone happen to know what scripting is going on during transformations, both to and from beast form?
Link to comment
Share on other sites

  • 4 months later...

Ok, this may be a little late but I found another better solution to this. I made a NakedSkin armor, with the default body and feet armor addons, but for the hands I used my hook meshes. I then used this NakedSkin armor as the player skin by editing the NPC file. This allowed my character to have it always "equipped" without scripts, quests, and it cannot be unequipped through quests or transforming. The only issue I have is that any gauntlets that cover the hand slot makes the hook disappear. I kinda fixed this by editing some of the bracers, so I can wear them while still having the hook out.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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