creating classes

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
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

creating classes

Post by Gradunk »

I'm trying to find out how to either make a new class or set champions to a specific one. i tried removing the class traits and adding different ones but they're just stacking on top of eachother so i start with 120hp and mana lvl 1 cause i have 2 classes at the same time etc. thanks
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: creating classes

Post by zimberzimber »

Gradunk wrote:I'm trying to find out how to either make a new class or set champions to a specific one. i tried removing the class traits and adding different ones but they're just stacking on top of eachother so i start with 120hp and mana lvl 1 cause i have 2 classes at the same time etc. thanks
Champion:setClass(class) to change a champions class

You can see how to define your own custom class in the asset packs char_classes.lua and traits.lua file.
You'll have to give the class and the trait provided by the class the same name. (The one that calculates health, energy, and provides unique benefits)
My asset pack [v1.10]
Features a bit of everything! :D
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: creating classes

Post by Gradunk »

wow there's almost nothing to it lol thanks
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: creating classes

Post by zimberzimber »

Thats true for the stats part.
Adding interesting unique class benefits is where the fun begins ;)
My asset pack [v1.10]
Features a bit of everything! :D
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: creating classes

Post by Gradunk »

yea thats what i was looking for. like drakkan did in eye of atlantis where you start with the one champion. he was a pirate with all different stats and skills etc. not just the name
i'm looking for how to do a whole new class from the ground up. sry for the poor description of what i'm trying to do lol
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: creating classes

Post by akroma222 »

Hey Gradunk,
glad to hear of some new Class mods happening ;)
I can probably send you my class.lua or post a few examples here... (always happy to assist)

Zimber - We really need a beginners/ how to/ trouble shooting thread for creating Race/ Class/ (and therefore - traits)
thoughts buddy??

Akroma
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: creating classes

Post by Gradunk »

can you send me yours? i can use it as a reference and ask if i have further questions. that would be the best and likely easiest way. thanks a bunch!

and yes i agree that would be glorious
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: creating classes

Post by akroma222 »

Gradunk wrote:can you send me yours? i can use it as a reference and ask if i have further questions. that would be the best and likely easiest way. thanks a bunch!
and yes i agree that would be glorious
Hey! Slow reply - very sorry :roll:
Ok, Ill post 3 Class definitions here + a screen shot of each Class' tool tip in-game

PLZ NOTE - I have altered the vanilla Races & Classes alot .... Im pretty sure Ive made the biggest mess of it Ive seen so far :lol:
Don't feel like you need to complicate things as much as I tend to (I know Im going to start regretting it soon ;) )
The screen shots may present these Classes as over powered - but actually - alot of special features / abilities are Exceptions to new Restrictions I have placed on Champion creation
Some of the code for some "Special" things is listed in other areas
(EG - Specialisation: Maces - gives Champ the Weapon Specialist trait when Equipped w Mace - this is included in my Mace Item definitions)


*Barbarian*
SpoilerShow
Image
SpoilerShow

Code: Select all

-------------------------------------------------------------BARBARIAN
defineCharClass{
	name = "barbarian",
	uiName = "Barbarian",
	optionalTraits = 2,
	skillPoints = 2,
	traits = { "correct_resistance", "stun_strike_2H", },
	skills = {	heavy_weapons = 1 }
}
defineTrait{
	name = "barbarian",
	uiName = "Barbarian",
	iconAtlas = "mod_assets/textures/gui/legacy_custom_icons1.tga",
	icon = 16,
	description = "Barbarians of the Midland Wastes do not care about finesse in combat, but instead rely on brute force to ensure their survival and that their enemies are defeated, and stay defeated. Barbarians are known for their quick tempers and ability to knock out opponents with single strikes.",
	gameEffect = [[
	<>-------------------------------------------------------------<> Base	
	Health 70, Energy 30
	Heavy Weapons Skill +1
	<>----------------------------------------------------------<> Levelup
	Health +8, Energy +3 
	Food Consumption +1%
	<>----------------------------------------------------------<> Special
	Immune: Burdened & Grappled
	Resist: Weakened & Injuries +25%
	Specialisation: Axes, Maces & Fistclaws
	Skill Equalize: Athleticism & Unarmed Combat
	Your 2-Handed Weapon Attacks gain: Stun +15%
	Leadership: gain the Warchief trait
	<>-----------------------------------------------------------<> Magic
	Spellbooks: Nil]],
	onRecomputeStats = function(champion, level)
		if level > 0 then
			local lvl = champion:getLevel()
			champion:addStatModifier("max_health", 70 + (lvl - 1) * 8)
			champion:addStatModifier("max_energy", 30 + (lvl - 1) * 3)
			champion:addStatModifier("food_rate", lvl)
		end
	end,
	onReceiveCondition = function(champion, cond, level)
		if level > 0 then
			if cond and cond == "burdened" then
				return false
			end 
			if cond and (cond == "weakened" or string.match(cond, "_wound$")) then
				if math.random() < 0.25 then
					return false
				end
			end
		end
	end,
}
*Battle Mage*
SpoilerShow
Image
SpoilerShow

Code: Select all

------------------------------------------------------BATTLEMAGE		
defineCharClass{
	name = "battle_mage",	
	uiName = "Battle Mage",
	optionalTraits = 2,
	skillPoints = 2,
	traits = { "correct_resistance", "hand_caster", "armor_expert"},
	skills = {	staves_runewands = 1}
}
defineTrait{
	name = "battle_mage",
	uiName = "Battle Mage",
	iconAtlas = "mod_assets/textures/gui/legacy_custom_icons1.tga",
	icon = 14,
	description = "The Battle Mages of Old Amadacia are quite comfortable wielding front line Stave Weapons, as well as blasting with powerful Spells from afar. There are few Battlemages left worthy of the Title, but one day they hope to gather whats left of their Order and restore the School of Wizardry's former pressence and magnificence.",
	gameEffect = [[
	<>-------------------------------------------------------------<> Base	
	Health 40, Energy 60
	Staff & Wand Skill +1
	<>----------------------------------------------------------<> Levelup
	Health +4, Energy +6 
	Elemental Resistances +1
	<>----------------------------------------------------------<> Special
	Specialisation: Staves
	Stave Special Attack Energy Costs -25%
	Stave Special Attack Buildup Times -50%
	Equipped Stave Willpower bonus +50%
	Equipped Armour Weight -50%
	Leadership: Staff Defence extends to Party
	<>-----------------------------------------------------------<> Magic
	Spellbooks: Mage & Enchanter
	You can Cast Spells without RuneItems]],
 	onRecomputeStats = function(champion, level)
		if level > 0 then
			local lvl = champion:getLevel()
			champion:addStatModifier("resist_fire", lvl)
			champion:addStatModifier("resist_shock", lvl)
			champion:addStatModifier("resist_cold", lvl)
			champion:addStatModifier("resist_poison", lvl)
			champion:addStatModifier("max_health", 40 + (lvl-1) * 4)
			champion:addStatModifier("max_energy", 60 + (lvl-1) * 6)
			---------------------------------------------------------stave WIL +50%
			if champion:getLevel() > 1 then
				for slot = 1,2 do
					local item = champion:getItem(slot)
					if item and item:hasTrait("stave") then
						if item.go.equipmentitem and item.go.equipmentitem:getWillpower() then
							local w = item.go.equipmentitem:getWillpower()
							champion:addStatModifier("willpower", math.floor(w / 2))
						end
					end
				end
			end
		end
	end,
}
* Monk *
SpoilerShow
Image
SpoilerShow

Code: Select all

-------------------------------------------------------------MONK
defineCharClass{
    name = "monk",
    uiName = "Monk",
	optionalTraits = 2,
	skillPoints = 2,
	traits = { "correct_resistance", "light_equipment"},
	skills = {unarmed = 1}
}
defineTrait{
    name = "monk",
    uiName = "Monk",
    iconAtlas = "mod_assets/textures/gui/legacy_custom_icons1.tga",
	icon = 8,
    description = "Monks hailing from the fabled Sun Temples devote their time and energy to honing fine physical and mental skills in peace and solitude. They ponder the mysteries of the mind and strive to overcome the meddlings of the physical planes. This isolates but also enlightens them, giving Monks access to truly marvellous abilities and self control.",
    gameEffect = [[
	<>------------------------------------------------------------<> Base	
	Health 60, Energy 40
	Unarmed Combat Skill +1
	<>---------------------------------------------------------<> Levelup
	Health +6, Energy +4 
	Fire & Cold Resistances +1
	<>---------------------------------------------------------<> Special
	Immune: Insanity & Bloodlust
	Resist: Blinded & Slowed +25%
	Skill Equalize: Athleticism & Accuracy
	Specilaisation: Fistclaws & Polearms
	Agile + 2-Handed Fistclaws: Multistrike +5% 
	Reach + Polearm: Counterstrike Melee Attacks +10% 
	Light Equipment Restrictions 
	<>----------------------------------------------------------<> Magic
	Level 7 + Meditation: Psionic Spellbook]],
	onRecomputeStats = function(champion, level)
        if level > 0 then
            local lvl = champion:getLevel()
			champion:addStatModifier("resist_fire", lvl)
			champion:addStatModifier("resist_cold", lvl)
            champion:addStatModifier("max_health", 60 + (lvl-1) * 6)
            champion:addStatModifier("max_energy", 40 + (lvl-1) * 4)
        end
    end,
	onReceiveCondition = function(champion, cond, level)
		if level > 0 then
			if cond and (cond == "blinded" or string.match(cond, "^slow_")) and math.random() <= 0.25 then	
				return false
			end
			if cond and (string.match(cond, "^bloodlust_") or cond == "insane") then	
				return false
			end
		end
	end,
}
Last edited by akroma222 on Tue Mar 14, 2017 6:32 am, edited 1 time in total.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: creating classes

Post by akroma222 »

I have not posted all the code for various Functions (EG Skill Equalize, custom traits etc)
....but am happy to do so & explain on request (good to know FaQ if Im to put together a thread on this)
I will gather up all the solid & tested Information I have on Race/Class stuff and create a Thread v shortly
Akroma
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: creating classes

Post by Gradunk »

Thanks akroma! clearly you have added quite a few traits and skill and stuff but i can do pretty much everything i want with those examples. ill let you know if i have any troubles when i have time to actually implement the modding

only question so far as i'm sure it matters... what .lua file do i put the code in?
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
Post Reply

Return to “Mod Creation”