Author Topic: Craftable Piecemeal Armors  (Read 510 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Craftable Piecemeal Armors
« on: August 14, 2012, 12:00:56 am »


               I'm fishing for ideas here...

I have this idea that armors should be able to work as an assembly of pieces, but I am not sure how to implement it.

At present in Arnheim I have defined a set of basal armors. Think of them as "under" armor:
clothing, padding, leather, hides, studded leather

Over these you can wear an armored vest, the "top" armor:
shirt of ring mail, chain hauberk, or breast plate.

Also - typically armors combined in this way go from light armor to medium armor, but not necessarily. Still its a good way to think about it, and to understand that heavy armors are not produced in this way.

I could make a system that swaps the armored vest on or off fairly easily, BUT when you consider magical armor and tracking item properties with the correct item it becomes more difficult.

Does anyone have any great ideas for how to handle this? A simple way to define a data structure using local variables that track which itemproperties go with which component? Then how about how you handle item properties that shouldn't stack?

Now I could just sit down with a tablet and work this all out, but before doing so I'd like to hear out what ideas others might have. I have not implemented a forge style system that allows players to add magic properties to their items, but perhaps it would be instructive to consider how these work before designing the mix and match armors.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #1 on: August 14, 2012, 04:59:06 am »


               Well I think there is clearly justification for modular approach to armor as you suggest.  Unfortunately though the models deliniate the various pieces of armor that does not translate into the game with different AC for different parts of the body, arms, legs, chest, etc..  if you are in plate or whatever armor then all pieces are regarded as that same AC.
So that's where we are, and if you want a modular approach then just basically can't get there from here.  Strictly from a theoretical approach you could get the type of armor for each slot, hands, boots, chest, head, and then use your local int's set on every piece of armor describing it's Armor Type, so the numbers for AT/AC: 0=none 1=padded...plate=8.  Next add up the numbers for the slots and divide by the number of slots so add all AT/iSlots = AC, overall armor class.
You could rewrite called shot to get the specific AT of the spot(s) attacked use the hands slot for arms,  then the boots for legs. I really like the approach just don't know about the difficulty of the implementation.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #2 on: August 14, 2012, 05:40:03 am »


               I am doing something much more simple than that, and implemented it as separate items.

Example:
I have created the following armor items: Chain Hauberk, Leather Armor, Leather armor with Chain Hauberk.

HOWEVER It seems to me that a player that has leather armor, and then finds a chain hauberk, should be able to make Leather Armor with Chain Hauberk by first putting on the leather, and then with a crafting action wear the chain hauberk over the leather.

From a crafting standpoint:
leather armor + chain hauberk = Leather armor with Chain Hauberk

AND this much of the crafting is very easy to do. You create a copy of the base item, modify it as appropriate, then put it on the PC as all standard armor crafting works in NWN.
BUT I have not implemented it yet because I am unsure (1) how best to combine magical/extraordinary item properties for combined armor, (2) how best to track the item properties so that when the base and vest are separated that their appropriate item properties are restored to them. and there is also the issue of item name and description to consider.

With regards to how other things like boots, bracers, gloves, belts, helmets etc... are combined with armor, that is no big deal since the engine gives you different inventory slots for these items. I have considered a system that changes clothing appearance when these items are equipped and unequipped. But that is only aesthetic so its a bit down my list of things to take on right now. Plus there is the issue of performance to consider. Every time a PC modifies armor appearance it creates client side lag for all nearby PCs
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #3 on: August 14, 2012, 01:33:06 pm »


               NWNX can alter the base AC of armour or clothing without the need to alter the torso piece for it.  I'd considered making a similar system to what you're suggesting myself when I'd seen that function.

 It would just be a matter of ensuring all the various non-torso parts have the proper AC value assigned to them in the 2da files, and then determining what percentage you wanted each piece to affect the value of the whole.

 For non-NWNX, you'd have to alter the torso part to accomplish the AC change, but at least wouldn't have to worry about transferring over properties or variables that way.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #4 on: August 14, 2012, 05:13:55 pm »


               But what about item properties and variables on the "vest"?

If you have a magic chain hauberk and magic leather, what happens when the two combine, and then when separated again?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #5 on: August 14, 2012, 05:45:24 pm »


               I suppose in that case you'd need to compare the enhancements on both, and merge them keeping only the higher of the two items bonuses.  GetItemPropertyCostTableValue might be enough to let you know which has the higher bonus on any matched type.

 Easiest way to keep track of the originals would be object storing in a database, I suppose.
 My understanding of a stored local object is that it's just a pointer, so that route likely wouldn't work.  It's unfortunate, since storing the two originals as local objects on the combined outfit would have been simplest if it could be made to persist through log outs, and resets.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #6 on: August 14, 2012, 05:55:17 pm »


               Hmmm... storing the entire object. I had not considered that. If I went that route, the last problem to solve would be how to handle changes to the combined armor.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #7 on: August 14, 2012, 09:41:24 pm »


               So you would just combine the properites.  So if the underlayer leather gave resist to negative, and the top gave resistance to fire, you would have a combined piece that gave resists to both types of damage.  Yeah I get it now more of a crafting type problem.  Usually someone would wear something underneath metal armor anyway, to protect the body from the metal itself.
So for the crafting/uncrafting you would have to make some sort of table script deliniating each component piece and what it can be crafted with.  First off no metal on metal, no over piece with another over piece and  no under piece combines with another underpiece. Maybe just a local metal 1, leather 1, etc.. Then you would have to resolve every combination forwards and backwards to make and unmake.
So leather + chainmail = (creates) chain haubrek
chain haubrek - (uncombines) leather + chainmail
So you have a bit of work creating and destroying different armors.
Failed.Bard's comment on the function in NWNX might be something to look into too.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Craftable Piecemeal Armors
« Reply #8 on: August 14, 2012, 11:03:26 pm »


               Yeah as of now I have impleented the following, but not the crafting method of combining and separating.

So I have
- Ring shirt over
clothing, leather, hide
- Chain Hauberk over
clothing, leather, studded leather
- Steel Breast Plate over
clothing, leather, studded leather

I think I could add padded armor to each of those, it seems that one should be able to put a steel breast plate over chain, scale, lamellar or ring armor, but I haven't worked all that out yet.