Chaos0815 Posted July 3, 2007 Share Posted July 3, 2007 Hi, I am trying to delete a series of objects from the player inventory. DestroyObject(GetItemPossessedBy(OBJECT_SELF, "danceroutfit")); Inventory_Item = GetNextItemInInventory(); if (GetBaseItemType(Inventory_Item) == BASE_ITEM_DATA_PAD){ DestroyObject(Inventory_Item); } It doesn't work so far and would appreciate any help Thx in advance, Chaos0815 Link to comment Share on other sites More sharing options...
Master Zionosis Posted July 3, 2007 Share Posted July 3, 2007 You can use this script to take an item from your inventory. void main() { ActionTakeItem(GetObjectByTag("[color=red]OBJECT_TAG[/color]", 0), GetFirstPC()); } Replace "OBJECT_TAG" with the tag of the object you want to take from your inventory. Hope this helps Link to comment Share on other sites More sharing options...
Chaos0815 Posted July 3, 2007 Author Share Posted July 3, 2007 Thx for the suggestion but it doesnt work. Maybe it helps when i say that this is pure script which is not attached to an dialogue. Link to comment Share on other sites More sharing options...
Master Zionosis Posted July 3, 2007 Share Posted July 3, 2007 Ahh then it won't work, it needs to be fired, and a dialog is the best solution, there are otehr ways, but attaching it to a dialog is by far the easiest way to do it. Link to comment Share on other sites More sharing options...
stoffe Posted July 3, 2007 Share Posted July 3, 2007 I am trying to delete a series of objects from the player inventory. DestroyObject(GetItemPossessedBy(OBJECT_SELF, "danceroutfit")); This would require the player character object to run the script for it to work, and it would not remove the dancer's outfit if it was worn by another party member. Also you've got a typo in the tag, it should be DancersOutfit (missing S in dancerS). To use the same method to get rid of it from all party members, you could do: void main() { DestroyObject(GetItemPossessedBy( GetPartyMemberByIndex(0), "DancersOutfit")); DestroyObject(GetItemPossessedBy( GetPartyMemberByIndex(1), "DancersOutfit")); DestroyObject(GetItemPossessedBy( GetPartyMemberByIndex(2), "DancersOutfit")); } Inventory_Item = GetNextItemInInventory(); if (GetBaseItemType(Inventory_Item) == BASE_ITEM_DATA_PAD){ DestroyObject(Inventory_Item); } The GetNextItemInInventory() function is used for advancing the inventory iterator pointer for an object and needs to be used in conjunction with GetFirstItemInInventory(), usually in a loop. Like: void main() { object oPC = GetFirstPC(); object oItem = GetFirstItemInInventory( oPC ); while (GetIsObjectValid(oItem)) { if (GetBaseItemType(oItem) == BASE_ITEM_DATA_PAD){ DestroyObject(oItem, 0.1); } oItem = GetNextItemInInventory( oPC ); } } ActionTakeItem(GetObjectByTag("OBJECT_TAG", 0), GetFirstPC()); This makes the object running the script (or the one the action is assigned to) take the item from the inventory of the main character and add it to their own inventory, provided that the object has an inventory, which is not the same as destroying it, since the object still exists in the game and could be looted back from the inventory of the object. Since it's an action it also requires the running object to be of a type that has an action queue. Link to comment Share on other sites More sharing options...
Chaos0815 Posted July 3, 2007 Author Share Posted July 3, 2007 Thx for the help. The method with destroyobject worked but it only did so after i detached the script from the rest of the code that was running. Well thx again. As soon as i am finished i gonna post it. Chaos0815 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.