About: Destroy item with highest value   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

This destroy item with highest value script destroys the most valuable item in a player character's inventory. It can be adapted to look through other inventories as well (creature, placeable, or item). This script is suitable for use in a conversation. /* ************************************************************************** * Destroys the most valuable item in a PC's inventory. * For use in a conversation script. * ************************************************************************** */ void main() {} } } }

AttributesValues
rdfs:label
  • Destroy item with highest value
rdfs:comment
  • This destroy item with highest value script destroys the most valuable item in a player character's inventory. It can be adapted to look through other inventories as well (creature, placeable, or item). This script is suitable for use in a conversation. /* ************************************************************************** * Destroys the most valuable item in a PC's inventory. * For use in a conversation script. * ************************************************************************** */ void main() {} } } }
dcterms:subject
abstract
  • This destroy item with highest value script destroys the most valuable item in a player character's inventory. It can be adapted to look through other inventories as well (creature, placeable, or item). This script is suitable for use in a conversation. /* ************************************************************************** * Destroys the most valuable item in a PC's inventory. * For use in a conversation script. * ************************************************************************** */ // Returns the most valuable item in an creature's inventory (including slots). // For stacked items, this considers only one item in the stack. object GetMostValuable(object oTarget); // Get the gold piece value of a single item, even if stacked. int GetGoldPieceValueSingle(object oItem); // Destroys an item. Only one item, even if it is stacked. void DestroyItem(object oItem); void main() {object oPC = GetPCSpeaker(); // This is the line to change to use this in other events. DestroyItem(GetMostValuable(oPC)); } // Returns the most valuable item in an creature's inventory (including slots). // For stacked items, this considers only one item in the stack. object GetMostValuable(object oTarget) {object oHighestValue = OBJECT_INVALID; int nHighestValue = -1; // So we can find items whose value is zero. int nSlot; // Loop through main inventory. object oItem = GetFirstItemInInventory(oTarget); while ( oItem != OBJECT_INVALID ) { int nValue = GetGoldPieceValueSingle(oItem); // Is this item the most valuable seen so far? if ( nValue > nHighestValue ) { oHighestValue = oItem; nHighestValue = nValue; } // Update the loop. oItem = GetNextItemInInventory(oTarget); } // Check inventory slots. for ( nSlot = 0; nSlot < NUM_INVENTORY_SLOTS; ++nSlot ) { oItem = GetItemInSlot(nSlot, oTarget); int nValue = GetGoldPieceValueSingle(oItem); // Is this item the most valuable seen so far? if ( nValue > nHighestValue ) { oHighestValue = oItem; nHighestValue = nValue; } } return oHighestValue; } // Get the gold piece value of a single item, even if stacked. int GetGoldPieceValueSingle(object oItem) {int nStack = GetItemStackSize(oItem); // Avoid division by zero. return (nStack == 0) ? GetGoldPieceValue(oItem) : GetGoldPieceValue(oItem) / nStack; } // Destroys an item. Only one item, even if it is stacked. void DestroyItem(object oItem) {int nStack = GetItemStackSize(oItem); if ( nStack > 1 ) SetItemStackSize(oItem, nStack - 1); else DestroyObject(oItem); }
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software