Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

[K1]Scripting help - inventory

Page: 1 of 1
 jimbo32
02-05-2007, 2:24 PM
#1
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.
 stoffe
02-05-2007, 3:06 PM
#2
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).
 jimbo32
02-05-2007, 3:22 PM
#3
Thanks a million stoffe. That's just what I need.

Just for future reference, how does the script differ if you actually want to move the item?
 stoffe
02-05-2007, 3:37 PM
#4
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.
Page: 1 of 1