I am trying to check what material an object is made of, but can't get the code to work.
The code below is
supposed to check if the player has an iron bar, and that it either has the "iron" material type, or no material type. But when I compile, I get an "ERROR: DECLARATION DOES NOT MATCH PARAMETERS" for the GetItemHasItemProperty line.
What am I doing wrong?
int StartingConditional()
{
object oPC = GetPCSpeaker(); // The PC
string sItem ="x2_it_cmat_iron"; // required item token string
itemproperty ipReqMat = ItemPropertyMaterial(9); // required item material
object oItem = GetItemPossessedBy(oPC, sItem); // The base material object, assuming it exists (returns OBJECT_INVALID if it doesn't)
// PC doesn't have the object at all, return false
//if (oItem == OBJECT_INVALID)
// return FALSE;
if(!HasItem(GetPCSpeaker(), sItem))
return FALSE;
// if the PC has the object, and the material is correct, return true
else if ( GetItemHasItemProperty(oItem, ipReqMat) )
return TRUE;
// or the PC has the object, and the material is undefined, return true
else if (GetItemHasItemProperty(oItem, ItemPropertyMaterial(0)))
return TRUE;
// otherwise, the item has the wrong material type, so return false
else
return FALSE;
}
Modifié par Iapetus303, 17 février 2014 - 09:07 .