Engine Limits and stuff

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
Marebre
Posts: 5
Joined: Wed Feb 01, 2017 4:12 pm

Engine Limits and stuff

Post by Marebre »

Hi. I'm new to modding Grimrock 2 (but not new to programming) so pardon me if my questions have already been answered elsewhere (in my defense, I did search the forum first).

The question is: what is NOT possible to change in-game?

1. BaseStats (Strength, Dexterity, Vitality and Willpower). Is it possible to change their names, description and effect (say, remove resistance bonus from stats) at all? Is it possible to add/remove BaseStat?

2. Similar question for Resistances and damage types. Is it possible to add/remove them or at least rename them (say I want Shock to be called "Psionic" or something)?

3. Custom weapon types. Is it possible to modify weapon types or add new weapon type altogether? F'r instance, "heavy_weapons" in game are defined as:

Code: Select all

defineSkill{
	name = "heavy_weapons",
	uiName = "Heavy Weapons",
	priority = 50,
	icon = 105,
	description = "Increases damage of Heavy Weapons by 20% for each skill point. At 5th skill level you can wield two-handed weapons in one hand.",
	traits = { [5] = "two_handed_mastery" },
}
But where is that 20% per-level calculated? Is that hard-coded? If I create brand new weapon type (say "Polearm") and define new skill with name = "polearms" and then make new weapons with traits = {"polearms"} will that work? (will character with that skill and that weapon get +20% damage/skill level bonus?)
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Engine Limits and stuff

Post by zimberzimber »

They're all possible.
While I'm not sure how to get the first one to work, minmay has already done that. Either PM him or wait for him to pop-in.

Second is a bit trickey, but doable.
The party object has a component that holds several functions that are called when an even they're associated with happens. (onMove when you move, onRecieveCondition, etc...)
One of them is called when a champion is damaged. You have to redirect the data to your own damage function, and do your magic there.
Unfortunetly, the damage that the undamaged hook receives cones after reduction, and while you can easily revert damage from magical sources (fire, cold, etc...), physical is more complex.
I worked around it (with minmays help) by setting all monsters pierce to math.huge, having their onHitChampion index them as a damage source (for interactions and actual pierce), and indexing their actual pierce in a global table.
I can expand much on it because I'm on a phone, and I'll have access to my computer only in about two days.

Third one is easy.
Every weapon has a function that is called when swung. You can use this function to adjust the values of the weapon.
Be warned though - make sure the function doesn't calculate the current value + bonuses, but base value + bonuses.
You could even set it up in such a way where you won't have to do that for each item individually (like for your second question), but again, I can't expand about it right now.
(There might be an onEquip item function, but I'm not sure/don't remember)
My asset pack [v1.10]
Features a bit of everything! :D
Post Reply