Author Topic: Custom Item Properties  (Read 795 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Custom Item Properties
« on: February 17, 2011, 03:22:22 am »


                I am working on adding damage resistance to particular physical damage types (piercing, bludgeoning, slashing) to all player wearable armor. I am doing this by adding a damage resistance property to each custom armor item. For example a mail hauberk (chain shirt) has damage resistance slashing 3 and damage resistance piercing 1.

The main problem with this approach is that the standard damage resistance properties increase the cost of the items too much, and also standard damage resistance only comes in steps of 5. The later is easy to solve. I've added more damage resistance values to the 2da file. However I still have the item cost problem which I've tried solving in the following ways:

(1) I've created a custom item property that only applies to armor and added it to the main 2das (itemprops, itempropdefs), and created custom 2das as needed for this property. This item property shows up. Cost works as expected. The text describing the properties effects appears as I want it to.
BUT
my custom property is not recognized during combat, and so the armor does not actually have damage resistance.
QUESTION
how can I get NWN to recognize my custom item property? Does damage resistance only work if you use row 23 in the itemprops 2da?

(2) I've modified the existing damage resistance 2das to minimize cost. Unfortunately - cost of damage resistance is minimized even when I would prefer it not be. Any suggestions on how to eliminate cost increases for physical damage when applied to armor, but to have normal cost increases in all other circumstances?
               
               

               


                     Modifié par henesua, 17 février 2011 - 03:24 .
                     
                  


            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
Custom Item Properties
« Reply #1 on: February 17, 2011, 03:31:10 am »


               There is a value decrease option with up to -50. you could add that to each armor, lowering it to the value you wish. Another route, though probably a bit more confusing is to only allow armor to be bought and sold at special shops, where the buy and sell values for that store are tweeked to reflect what you think the armor should be at. The main problem with that is you have to be extra vigilent with the other stores in your mod so players can't sell it for more than it sells for. good luck!
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Custom Item Properties
« Reply #2 on: February 17, 2011, 04:04:24 am »


               

SHOVA wrote...

There is a value decrease option with up to -50. you could add that to each armor, lowering it to the value you wish.

This optiuon is there only if you use PRC or CEP (CEP stoleborrowed the idea from PRC). Default NWN doesn't allow to reduce cost, but this functionality can be added (change the cost) into some of the new itemproperties of material and quality (I know ugly) or by copying the PRC/CEP decrease value itemproperties (which needs hak otherwise players will see nonsenses on the item (which is reason I didn't provided this feature in my community patch).

Setting these new damage resistance costtable values to 0.0 doesn't helped?

And why you are doing this manually, seems to me that you want to apply DnD variant rule about armor. If thats true, then you can do it via scripting when the player equips the armor. If you then add the itemproperty as a temporary, it won't affect cost of the item and you spare hours of time... I did the same to allow bards to cast in light armor btw (not community patch feature, that was for my PW).
               
               

               


                     Modifié par ShaDoOoW, 17 février 2011 - 04:11 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Custom Item Properties
« Reply #3 on: February 17, 2011, 05:03:10 am »


               The solution was to implement parallel DR values in iprp_resistcost.2da I have the normal cost version, and the zero cost version each listed in the same 2da. I then created custom tlk table items so that I can differentiate between the two types when I am applying the property. Its not as clean as I wanted to do it, but it appears that NWN requires the use of certain rows in the property list for certain game properties. Damage Resistance for example must be defined in row 23 of itemprops. Any other row will not work for damage resistance. So this seems to be the best way to do it.



Shadow, the reason I am doing this manually is that I am also making custom armor types with new appearances chosen from a hak, new names for the items, new descriptions, and new statistics. So I have to make all of the armor anyway. The existing armor in NWN is poorly done, has poor graphic resources, and needed refined game rules.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Custom Item Properties
« Reply #4 on: February 17, 2011, 10:20:17 am »


               

henesua wrote...

The solution was to implement parallel DR values in iprp_resistcost.2da I have the normal cost version, and the zero cost version each listed in the same 2da. I then created custom tlk table items so that I can differentiate between the two types when I am applying the property. Its not as clean as I wanted to do it, but it appears that NWN requires the use of certain rows in the property list for certain game properties. Damage Resistance for example must be defined in row 23 of itemprops. Any other row will not work for damage resistance. So this seems to be the best way to do it.

Yes itemproperties are from big part hardcoded. Any new one will be just non-functional placeholder (which can be usefull too).

But I still don't understand why you are even trying to make a new itemproperty. You can just add those new values at the end of iprp_rezistcost.2da like

11         XXXXXincustomTLK   Resist_1/-   1       0
12         XXXXXincustomTLK   Resist_2/-   2       0
13         XXXXXincustomTLK   Resist_3/-   3       0
14         XXXXXincustomTLK   Resist_4/-   4       0

and thats it
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Custom Item Properties
« Reply #5 on: February 18, 2011, 05:04:16 pm »


               Thats exactly what I said the solution was. The problem is that by combining both kinds of resistance - the zero cost and the normal - you could confuse a builder about what the different entries are meant for. So a separate item property just for armor was what i wanted.



Anyway, like I said above, the solution was to include the zero cost resistance rows along with the normal cost rows in iprp_resistcost.2da



It works, but its ugly.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Custom Item Properties
« Reply #6 on: February 19, 2011, 06:22:56 am »


               well it doesnt seem ugly to me, but OK there is a way



any custom property does nothing by default, but it is possible to script it



so you will make a new resist item property with these values and then you must make a script in OnEquip and UnEquip, this script will check if the new resist item property is on the item, and if so then it gets a value of it. And then it applies a effect of damageresistance of the given value.



You can make that effect also invisible on the effect list by a workaroud I promoted in Homebrew thread in these forum (somewhere in the scripting forum beginnings...)
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Custom Item Properties
« Reply #7 on: February 19, 2011, 09:50:57 pm »


               Thats a nice trick. I'm happy enough with how it is working now, but thank you for the lead on how to solve this with scripts.