About: NPC Checks for more than 1 of the same item in a PCs inventory   Sponge Permalink

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

A simple way to check for Items in a "Text Appeares When" script mode is to use the GetNumItems(). This is a bit easier than going threw the Inventory and "counting" each item. This need to be in the "Text Appeares When" Script node of the Text line you want to appeare to the PC if he/she has the correct amount of said Item. Change "ITEM_TAG" to that of the Item you are looking for and set nMarkCount to the number of items you want. If you want to take the Items in the "Action Taken" node of the next Text node. We can use TakeNumItems().

AttributesValues
rdfs:label
  • NPC Checks for more than 1 of the same item in a PCs inventory
rdfs:comment
  • A simple way to check for Items in a "Text Appeares When" script mode is to use the GetNumItems(). This is a bit easier than going threw the Inventory and "counting" each item. This need to be in the "Text Appeares When" Script node of the Text line you want to appeare to the PC if he/she has the correct amount of said Item. Change "ITEM_TAG" to that of the Item you are looking for and set nMarkCount to the number of items you want. If you want to take the Items in the "Action Taken" node of the next Text node. We can use TakeNumItems().
dcterms:subject
abstract
  • A simple way to check for Items in a "Text Appeares When" script mode is to use the GetNumItems(). This is a bit easier than going threw the Inventory and "counting" each item. This need to be in the "Text Appeares When" Script node of the Text line you want to appeare to the PC if he/she has the correct amount of said Item. Change "ITEM_TAG" to that of the Item you are looking for and set nMarkCount to the number of items you want. #include "nw_i0_plot" int StartingConditional() { //check inventory of oPC for oQuestItem and get iNumItems string sMark = "ITEM_TAG"; int nMarkCount = 2; object oMark = GetObjectByTag(sMark); if(GetNumItems(GetPCSpeaker(),sMark) >= nMarkCount) return TRUE; return FALSE; } If you want to take the Items in the "Action Taken" node of the next Text node. We can use TakeNumItems(). Place this script in the "Actions Taken" of the next NPC response. Again change "ITEM_TAG" to that of the Item your looking for and set nMarkCount to the number of Items to take. #include "nw_i0_plot" void main() { string sMark = "ITEM_TAG"; // Enter tag of your Item object oMark = GetObjectByTag(sMark); int nMarkCount = 2; // Change to num Items you want if(GetNumItems(GetPCSpeaker(),sMark) >= nMarkCount) { TakeNumItems(GetPCSpeaker(),sMark,nMarkCount); // Uncomment the following line to Give the PC an Item Also // CreateItemOnObject("item_ResRef",GetPCSpeaker(),1); } }
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