Jump to content

Home

[K1]Scripting help - inventory


jimbo32

Recommended Posts

Hey everybody,

 

I'm in the process of creating a recruitment mod, and need some advice.

 

What I'd like to do is remove an item from the party's inventory using a script attached to dialogue (if that's possible).

 

This is to simulate "giving" the item to the new recruit, who will be equipped with it when joining.

 

Any assistance would be appreciated.

Link to comment
Share on other sites

I'm in the process of creating a recruitment mod, and need some advice.

 

What I'd like to do is remove an item from the party's inventory using a script attached to dialogue (if that's possible).

 

This is to simulate "giving" the item to the new recruit, who will be equipped with it when joining.

 

Do you want to move the item from the party inventory to the new recruit, or do you just want to delete the item from the party inventory? Both are possible to do. If you just want to delete it, you can use a script like this, set as action script on your dialog node:

 

void main() {
   object oItem = GetItemPossessedBy(GetFirstPC(), "TagOfItem");
   if (GetIsObjectValid(oItem))
       DestroyObject(oItem);
}

 

Where you change TagOfItem to the Tag of the item you want to remove (this is set in the UTI template).

Link to comment
Share on other sites

Just for future reference, how does the script differ if you actually want to move the item?

 

You'd replace the DestroyObject() line with...

 

ActionTakeItem(oItem, GetFirstPC());

 

...provided that the conversation owner is the NPC who should receive the item.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...