Page 1 of 1

Custom Armor (solved)

Posted: Sun Nov 16, 2014 6:45 pm
by Dunkler
Hello
I created the following custom Armor

Code: Select all

defineObject{
          name = "EinfachesStoffhemd",
          baseObject = "base_item",
          components = {
          {
             class = "Model",
             model = "assets/models/items/knife.fbx",
          },
          {
             class ="Item",
             uiName = "Einfaches Stoffhemd",
             gfxAtlas = "mod_assets/textures/items.tga",
             gfxIndex = 7,
             weight = 0.2,                        
             description = "Ein einfaches Hemd aus Stoff"
          },
          {
             class = "EquipmentItem",
             Protection = 1,
             Slot = 4,           
          },
       }
    }   
But some things dont work.

First im still using the knife.fbx because o dont know what the name for the clothings model is :D

The item is supposed to equip to the chest (Slot 4) but it still equips to the main and offhand....what is my mistake?

The item shows protection +1 if i examine it...but the protection does not increase on the charakter sheet...again what is my mistake?

Any help would be great :)

Re: Custom Armor

Posted: Sun Nov 16, 2014 6:58 pm
by Prozail
Here is a working one.
First of all, protection and slot should be lowercase. I really have no idea what effect setting "slot" has, it has nothing to do with enabling what slot it eqips to. What does affect it though is the item-traits: traits = { "chest_armor" }

Code: Select all


defineObject{
          name = "EinfachesStoffhemd",
          baseObject = "base_item",
          components = {
          {
             class = "Model",
             model = "assets/models/items/knife.fbx",
          },
          {
             class ="Item",
             uiName = "Einfaches Stoffhemd",
             gfxAtlas = "mod_assets/textures/items.tga",
             gfxIndex = 7,
             weight = 0.2,                        
	     traits = { "chest_armor" },
             description = "Ein einfaches Hemd aus Stoff"
          },
          {
             class = "EquipmentItem",
             protection = 1,
             slot = 4,           
		},
	}
}   



Re: Custom Armor

Posted: Sun Nov 16, 2014 7:04 pm
by Dunkler
Ah thank you! I would have never thought of using chest_armor trait :)

It seems chest_armor trait also made the Protection +1 work correctly...odd.

Does that mean you cant make a weapon that gives protection +1? Or would you have to give a weapon an armor trait too?


oh and you dont know what the fbx for the clothes model is by chance :)?

Re: Custom Armor (solved)

Posted: Sun Nov 16, 2014 7:22 pm
by Prozail
i think that was the uppercase "Protection" that made it non-working. i have weapons that give stats.

also, you can get the fbx of any simply by doing print(spawn("peasant_tunic").model:getModel()) in the console. (you can find out gfx-id-values and such using the same method.)

Re: Custom Armor (solved)

Posted: Sun Nov 16, 2014 7:24 pm
by Prozail
A small guide to item-traits.

When making stuff equippable, setting slot in EquipmentItemComponent doesn't seem to do anything (please correct me if im wrong). To be able to equip it, you need to set specific traits in the ItemComponent.

Here is a short list on what enables what slots.

Chest - "chest_armor"
Cloak - "cloak"
Head - "helmet"
Neck - "necklace"
Hands - "gloves"
Legs - "leg_armor"
Feet - "boots"
Ring/Bracer - "bracers"

For weapons there are more choices.. Some that works are:
"light_weapon", "heavy_weapon", "shield"

Re: Custom Armor (solved)

Posted: Sun Nov 16, 2014 7:31 pm
by Dunkler
Thank you again! That will help me a lot and get me started through hundreds and maybe thousand of items i need to create :twisted: