I'm trying to check existing properties on an item through a standard item property loop...
What I want to do is check the item property of that the target item against the bonus spell slot by a particular level.
This is something I wanted to setup in the already released Enchanting Gem System, but I"m having problems checking the level of the spell of the bonus spell slot on the item...
Does anyone have something that they can share that can return the bonus spell level of the item property on the targeted item for comparison, while not ignoring the class of the bonus spell slot either?
This is what I have tried (One example)
//Define Prototype
int GetItemHasSimilarBonusSpellSlot(object oTarget, object oItem)
{
int nHas = FALSE;
string sResRef = GetResRef(oItem);
int nAttribute, nConstant, nSub, nType, nAdj;
itemproperty iGP, iProp;
if(sResRef == "gen_gem_50") { nAttribute = 0; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_51") { nAttribute = 1; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_52") { nAttribute = 2; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_53") { nAttribute = 3; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_54") { nAttribute = 4; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_55") { nAttribute = 5; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_56") { nAttribute = 6; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_57") { nAttribute = 7; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_58") { nAttribute = 8; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_59") { nAttribute = 9; nConstant = IP_CONST_class_CLERIC;}
else if(sResRef == "gen_gem_60") { nAttribute = 0; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_61") { nAttribute = 1; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_62") { nAttribute = 2; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_63") { nAttribute = 3; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_64") { nAttribute = 4; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_65") { nAttribute = 5; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_66") { nAttribute = 6; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_67") { nAttribute = 7; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_68") { nAttribute = 8; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_79") { nAttribute = 9; nConstant = IP_CONST_class_DRUID;}
else if(sResRef == "gen_gem_70") { nAttribute = 0; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_71") { nAttribute = 1; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_72") { nAttribute = 2; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_73") { nAttribute = 3; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_74") { nAttribute = 4; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_75") { nAttribute = 5; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_76") { nAttribute = 6; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_77") { nAttribute = 7; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_78") { nAttribute = 8; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_79") { nAttribute = 9; nConstant = IP_CONST_class_SORCERER;}
else if(sResRef == "gen_gem_80") { nAttribute = 0; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_81") { nAttribute = 1; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_82") { nAttribute = 2; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_83") { nAttribute = 3; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_84") { nAttribute = 4; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_85") { nAttribute = 5; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_86") { nAttribute = 6; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_87") { nAttribute = 7; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_88") { nAttribute = 8; nConstant = IP_CONST_class_WIZARD;}
else if(sResRef == "gen_gem_89") { nAttribute = 9; nConstant = IP_CONST_class_WIZARD;}
//The Property to be applied by Gem!
iGP = ItemPropertyBonusLevelSpell(nConstant, nAttribute);
//Loop through all the properties on the targeted item..
iProp = GetFirstItemProperty(oItem);
while(GetIsItemPropertyValid(iProp))
{
if(iProp==iGP)
{
nHas = TRUE; //It's a complete match!
}
iProp = GetNextItemProperty(oItem);
}
//Tell the main script if the gem being used is existing on the targeted
//item already...
return nHas;
}
I know I'm doing something wrong, I just can't figure it out, or if it can be checked at all, because nHas is always returning FALSE.
Modifié par _Guile, 10 avril 2011 - 05:50 .