Skill Requirements for Items

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
User avatar
David Ward
Posts: 103
Joined: Wed Jan 07, 2015 11:44 pm
Location: Vancouver, BC, Canada

Skill Requirements for Items

Post by David Ward »

How should I go about making new skill requirements for items?

Right now, the "Armor" skill has the effect of reducing evasion if the light armor and heavy armor traits, which are acquired by having 2 and 4 on the Armor skill respectively. Is there a way to change this to make it so that there could be, say, reduced protection from the armor if the character does not have Armor skill 1, or 2, or 3, 4, all the way up to 5?

Would it be better to just make a completely new skill that ties into armor-based items, with new traits to go with that?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Skill Requirements for Items

Post by minmay »

Sure. Just use the onRecomputeStats() hook of your skill to modify protection/evasion/etc depending on equipped items.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
David Ward
Posts: 103
Joined: Wed Jan 07, 2015 11:44 pm
Location: Vancouver, BC, Canada

Re: Skill Requirements for Items

Post by David Ward »

Seems simple, but not so easy to put into code. Will do some mucking around with onRecomputeStats() then.
User avatar
David Ward
Posts: 103
Joined: Wed Jan 07, 2015 11:44 pm
Location: Vancouver, BC, Canada

Re: Skill Requirements for Items

Post by David Ward »

So here's the thing, minmay.

I made a piece of armor and added in the following:

requirements = { "armors", 3 },

When I load the game in the editor for testing, this warning appears:

warning! invalid component property equipmentitem.requirements

No skill requirements appear on the item's stat sheet in the inventory, and no skill requirement is applied (i.e. I can equip the piece of armor and get its protection bonuses even if the character equipping it doesn't meet the intended skill requirements).

What would be your best suggestion on how to fix that?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Skill Requirements for Items

Post by minmay »

EquipmentItemComponent does not have a requirements field. ItemActionComponents and UsableItemComponents do.
David Ward wrote:No skill requirements appear on the item's stat sheet in the inventory, and no skill requirement is applied (i.e. I can equip the piece of armor and get its protection bonuses even if the character equipping it doesn't meet the intended skill requirements).
If you want to prevent the player from getting EquipmentItemComponent bonuses if they do not meet the requirements, you have to add a RunePanelComponent and place your requirements there; it is the only ItemActionComponent that prevents EquipmentItemComponent from conferring bonuses. See this post.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
David Ward
Posts: 103
Joined: Wed Jan 07, 2015 11:44 pm
Location: Vancouver, BC, Canada

Re: Skill Requirements for Items

Post by David Ward »

Thank you very much, minmay.
Post Reply