Jump to content

[LE] Simple script "OnEquipped"


JohnSmith047b

Recommended Posts

Hello everyone, please help with a simple script. A script is attached to the clothes, which, when put on, checks the gender of the NPC. If the gender is male, then this object should be removed from the inventory of this NPC. I just can't get the REF of the clothes on which the script is. Enter manually cloth REFs in the script is a bad idea because there is a lot of it.

 

Scriptname AaaTestScript extends ObjectReference


event OnEquipped(Actor akActor)
    ObjectReference equipment = self
    ;Form equipment = GetBaseObject()


    if (akActor.GetActorBase().GetSex() == 0)
        akActor.RemoveItem(equipment, 1)
        Debug.MessageBox(equipment)
    endIf


endevent
Edited by JohnSmith047b
Link to comment
Share on other sites

You cannot get the "reference" to the object because it is inside an inventory and currently does not have a reference ID. See if akActor.RemoveItem(Self,1) will work instead.

Thanks for the answer. This does not work - i added item to myself and when i tried to put it on, it did not removed from the inventory (male character). The message was [AaaTestScript <Item 1 in container (00000014)>]. I expected to see REF there.

Edited by JohnSmith047b
Link to comment
Share on other sites

  • Recently Browsing   0 members

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