zunath wrote...
I've checked on NWNX... nothing that gives you the ability to define new ItemProperty constructors.
But since you asked:
My combat system uses a lot of custom item properties for the firearms. Such as: Firepower, Magazine Size, Range, etc. These are all custom ones - not based off of any existing item properties.
I think the only solution is to put items with these new item property types in a secure location and reference them from script. IPWildShapeCopyItemProperties seems to be able to do this.
Pain in the ass but I've found no other way.
Like so, using nwnx_structs.
From itempropdef.2da, a snippet:
221 16842236 X_Damage_Immunity IPRP_DAMAGETYPE 2.3 5 **** 5488 1093
222 16842237 X_On_Hit IPRP_ONHIT **** 24 **** 5512 1450
223 16842238 X_Save_Penalty IPRP_SAVEELEMENT 0 21 **** 5513 1461
224 16842239 X_Save_Penalty_Specific IPRP_SAVINGTHROW 0 21 **** 5513 1462
225 16842240 X_Skill_Bonus SKILLS 0.12 25 **** 5516 ****
from our include, nwnx_exalt:
const int ITEM_PROPERTY_INVIS_DAMAGE_IMMUNITY = 221;
const int ITEM_PROPERTY_INVIS_ON_HIT = 222;
const int ITEM_PROPERTY_INVIS_SAVE_PENALTY = 223;
const int ITEM_PROPERTY_INVIS_SAVE_PENALTY_SPECIFIC = 224;
const int ITEM_PROPERTY_INVIS_SKILL_BONUS = 225;
*snip*
itemproperty ItemPropertyInvisValueDecrease (int nAdjustment) {
itemproperty ip = ItemPropertyTurnResistance(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_VALUE_DECREASE);
SetItemPropertyInteger(ip, 2, 21); /* value adjustment cost table */
SetItemPropertyInteger(ip, 3, nAdjustment);
return ip;
}
itemproperty ItemPropertyInvisValueIncrease (int nAdjustment) {
itemproperty ip = ItemPropertyTurnResistance(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_VALUE_INCREASE);
SetItemPropertyInteger(ip, 2, 25); /* value adjustment cost table */
SetItemPropertyInteger(ip, 3, nAdjustment);
return ip;
}
itemproperty ItemPropertyInvisBonusFeat (int nFeat) {
itemproperty ip = ItemPropertyBonusFeat(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_BONUS_FEAT);
SetItemPropertyInteger(ip, 1, nFeat);
return ip;
}
itemproperty ItemPropertyInvisDamageBonus (int nDamageType, int nDamage) {
itemproperty ip = ItemPropertyDamageBonus(nDamageType, 1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_DAMAGE_BONUS);
SetItemPropertyInteger(ip, 2, 4); /* damage bonus cost table */
SetItemPropertyInteger(ip, 3, nDamage);
return ip;
}
itemproperty ItemPropertyInvisImmunityMisc (int nImm) {
itemproperty ip = ItemPropertyImmunityMisc(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_IMMUNITY_MISC);
SetItemPropertyInteger(ip, 1, nImm);
return ip;
}
itemproperty ItemPropertyInvisMaterial (int nMaterial) {
itemproperty ip = ItemPropertyTurnResistance(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_MATERIAL);
SetItemPropertyInteger(ip, 2, 28); /* material cost table */
SetItemPropertyInteger(ip, 3, nMaterial);
return ip;
}
itemproperty ItemPropertyInvisQuality (int nQuality) {
itemproperty ip = ItemPropertyTurnResistance(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_QUALITY);
SetItemPropertyInteger(ip, 2, 29); /* quality cost table */
SetItemPropertyInteger(ip, 3, nQuality);
return ip;
}
itemproperty ItemPropertyInvisAdditional (int nAdditional) {
itemproperty ip = ItemPropertyTurnResistance(1);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_ADDITIONAL);
SetItemPropertyInteger(ip, 2, 30); /* additional property cost table */
SetItemPropertyInteger(ip, 3, nAdditional);
return ip;
}
itemproperty ItemPropertyInvisTrap (int nTrapLevel, int nTrapType) {
itemproperty ip = ItemPropertyTrap(0, 0);
SetItemPropertyInteger(ip, 0, ITEM_PROPERTY_INVIS_TRAP);
SetItemPropertyInteger(ip, 1, nTrapLevel);
SetItemPropertyInteger(ip, 2, 17); /* trap cost table */
SetItemPropertyInteger(ip, 3, nTrapType);
return ip;
}
You can alter and apply item props with structs much more easily than normal, using a function like this:
itemproperty ItemPropertyDirect (int nType, int nSubType, int nCostTable, int nCostValue, int nParamTable, int nParamValue) {
itemproperty ip = ItemPropertyAdditional(0);
SetItemPropertyInteger(ip, 0, nType);
SetItemPropertyInteger(ip, 1, nSubType);
SetItemPropertyInteger(ip, 2, nCostTable);
SetItemPropertyInteger(ip, 3, nCostValue);
SetItemPropertyInteger(ip, 4, nParamTable);
SetItemPropertyInteger(ip, 5, nParamValue);
return ip;
}
At that point, you can apply it like a normal item property. For custom item properties, they are likely to require additional engine hacks to do what you want, unless you can code what you want in nwscript.
LMK if you have any questions.
Funky