Custom Armor (solved)

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Custom Armor (solved)

Post 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 :)
Last edited by Dunkler on Sun Nov 16, 2014 7:04 pm, edited 1 time in total.
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: Custom Armor

Post 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,           
		},
	}
}   


Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Custom Armor

Post 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 :)?
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: Custom Armor (solved)

Post 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.)
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: Custom Armor (solved)

Post 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"
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Custom Armor (solved)

Post 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:
Post Reply