Jump to content

How to unequip an item/Correct way to use "self"


zogthemighty

Recommended Posts

Scriptname ZogUnequipTest extends ObjectReference

import Actor

Event OnActivate(ObjectReference akActionRef)
Debug.Notification("You've picked me up")
EndEvent

Event OnEquipped(Actor akActor)
Debug.Notification("You've equipped me and I'm going to unequip myself!")
akActor.UnequipItem(Self, false, false)
Debug.Notification("I should be unequipped now")
EndEvent
The messages are shown, but item doesn't get unequipped. I think "self" is not referring to the weapon to which I've attached the script - what's the correct way to do this?
Link to comment
Share on other sites

Native Calls e.g. using self are normally not possible for inventory items only persistent items remain accessible in inventory.

The easiest way to workaround this is to add a Const Property linking to the BaseItem and running unequip on this Property.

Yeah, we (I'm actually Mazz0 typing this on Zog's account) tried setting up a property, but got lots of errors, probably because we weren't using the correct Type and Value. Do you know what we should use for that? I tried Form with the weapon's FormID as the value, and ObjectReference, got errors like "Unknown user flag".

 

Thanks for your help with this by the way (and with our other question) :smile:

Link to comment
Share on other sites

this works a bit different: Papyrus doesn't know anything about the handled objects, so it work like this: you tell Pap there is an object A of this type eg. weapon than in your esp you attach the script to an object B and tell the object B which object A is.

the code looks like this if you are using a weapon.

Weapon Property PropertyName_UseTheWeaponsEditorIdAsNameToEnableAutoFill Auto Const

Than you attach the script and select the matching object in CK

Edited by ubuntufreakdragon
Link to comment
Share on other sites

this works a bit different: Papyrus doesn't know anything about the handled objects, so it work like this: you tell Pap there is an object A of this type eg. weapon than in your esp you attach the script to an object B and tell the object B which object A is.

the code looks like this if you are using a weapon.

Weapon Property PropertyName_UseTheWeaponsEditorIdAsNameToEnableAutoFill Auto Const

Than you attach the script and select the matching object in CK

Thanks, we'll try that!

 

Does this mean you have to have one script per weapon, since the EditorID is hard coded into the script? So you couldn't write a script to apply a certain trait and use it for multiple weapons?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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