So ... I'm in deep trouble ... can't figure out how to check if a creature has item on it .. for example a blaster pistol .. and if has .. return TRUE. It's for TSL by the way .... :(
If you're looking to determine whether the creature has an item equipped, you can you use the GetItemInSlot function. If you just want to check if the creature has an item in its inventory you can use the GetItemPossessedBy or GetItemPossessor functions.
Example:
// a dialog conditional script to determine
// if player has an item equipped as their
// right or left handed weapon
// where the Tag of the item is a string parameter
int StartingConditional() {
string sItem=GetScriptStringParameter();
object oPC=GetFirstPC();
object oRight = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON, oPC);
if (GetIsObjectValid(oRight)) {
if (GetTag(oRight)==sItem) {
return TRUE;
}
}
object oLeft = GetItemInSlot(INVENTORY_SLOT_LEFTWEAPON, oPC);
if (GetIsObjectValid(oLeft)) {
if (GetTag(oLeft)==sItem) {
return TRUE;
}
}
return FALSE;
}
// a dialog conditional script to determine
// if the player has a particular item in their inventory
// where the Tag of the item is a string parameter
int StartingConditional() {
string sItem=GetScriptStringParameter();
object oPC=GetFirstPC();
object oItemPossessed = GetItemPossessedBy(oPC,sItem);
return GetIsObjectValid(oItemPossessed);
}
yes ... i saw this in many original scripts .. but i kinda cannot figure out the "GetScriptStringParameter();" thingy ... how does the script know which item i want if i don't even write its tag anywhere in the script ?
yes ... i saw this in many original scripts .. but i kinda cannot figure out the "GetScriptStringParameter();" thingy ... how does the script know which item i want if i don't even write its tag anywhere in the script ?
That function is used in action/conditional scripts fired from nodes in a DLG (conversation) file. There are a series of fields on each dialog node where you can set values the scripts can check for. The String Param field (in tk102's DLG editor) can be set to a value that GetScriptStringParameter() will be able to fetch into the script.
If your scripts are not for use in a DLG file it would be easier to help if you described how/where they would be used.
That is exactly what i needed .. thank you :)