Holding 2-Handed Weapons with both hands

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
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Holding 2-Handed Weapons with both hands

Post by Azel »

Okay so Heavy Weapons require the Heavy Weapons skill, and the higher your Strength the greater the damage added. If you level up your Heavy Weapons skill high enough, you can hold a 2-Handed Weapon in one hand. That's great, however, there should be a benefit to continuing to hold a 2-Handed weapon with both hands (eg, a higher base damage). Has anyone considered this?

Basically, I'm thinking if the player gets the Heavy Weapons skill to max level (lvl 5) then I want to give a higher damage bonus if they continue to use a 2-Handed weapon with both hands. I'm 2 weeks away from releasing the final version of my Mod so I probably don't have much time to experiment on my own. Thus I figured I would ask here in case anyone has accomplished something similar.

:mrgreen:
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Holding 2-Handed Weapons with both hands

Post by AndakRainor »

In a trait definition you can use:

onComputeCritChance
onComputeCooldown
onComputeAccuracy

I made this trait for example :

Code: Select all

defineTrait{
	name = "accurate_throw",
	uiName = "Accurate Throw",
	icon = 1,
	description = "Throw attacks gain Accuracy +10.",
	onComputeAccuracy = function(champion, weapon, attack, attackType, level)
		if level > 0 and attackType == "throw" then return 10 end
	end,
},
or you have this but it applies at all times :

Code: Select all

defineTrait{
	name = "parry",
	uiName = "Parry",
	icon = 1,
	description = "You gain Evasion +20 when equipped with heavy weapons.",
	onRecomputeStats = function(champion, level)
		if level > 0 then
			local item1 = champion:getItem(ItemSlot.Weapon)
			local item2 = champion:getItem(ItemSlot.OffHand)
			if (item1 and item1:hasTrait("heavy_weapon")) or (item2 and item2:hasTrait("heavy_weapon")) then
				champion:addStatModifier("evasion", 20)
			end
		end
	end,
},
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Holding 2-Handed Weapons with both hands

Post by Azel »

Badass. I think I can work with that. Thanks!
User avatar
Slava
Posts: 74
Joined: Sun Aug 30, 2015 2:10 pm

Re: Holding 2-Handed Weapons with both hands

Post by Slava »

Code: Select all

onUnequipItem = function(self, champion, action, slot, skillLevel)
			if
			champion:getSkillLevel("heavy_weapons") == 5 then
			champion:addTrait("two_handed_mastery") end
			end,

Code: Select all

onRecomputeStats = function(self, champion, action, slot)
			champion:removeTrait("two_handed_mastery")
			end,
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Holding 2-Handed Weapons with both hands

Post by akroma222 »

Slava wrote:

Code: Select all

onUnequipItem = function(self, champion, action, slot, skillLevel)
			if
			champion:getSkillLevel("heavy_weapons") == 5 then
			champion:addTrait("two_handed_mastery") end
			end,

Code: Select all

onRecomputeStats = function(self, champion, action, slot)
			champion:removeTrait("two_handed_mastery")
			end,
^^This can easily be done automatically through the skill def
SpoilerShow

Code: Select all

defineSkill{
	name = "heavy_weapons",
	uiName = "Heavy Weapons",
	priority = 130,
	iconAtlas = "mod_assets/textures/customSkills1.tga",
	icon = 0,
	--icon = 105,
	description = "Heavy Weapons affects how well you wield weapons such as axes, maces and some Swords and Polearms. Each skill level increases the Damage of your Heavy Weapon attacks by 20%.\n\n[Level 3]: 15% Chance to Stun enemies.\n[Level 4]: Wield 2-Handed Weapons with 1 hand.",
	traits = { [3] = "stun_strike_HV", [4] = "two_handed_mastery" },
}
For the record... I have given a penalty to energy regen and cooldown times if wielding two handed weapons in both hands
Technically I guess there should be a damage penalty too...
Post Reply