Page 2 of 3

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 3:43 pm
by petri
I would guess you aren't running beta 2.1.15 or later?

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 3:45 pm
by Leki
petri wrote:I would guess you aren't running beta 2.1.15 or later?
I have 2.1.16

... and ingame console command

Code: Select all

party.party:getChampion(1):setClass("my_custom_class")
works.[/color]

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 3:51 pm
by petri
Then you should be good to go. You probably have an error in the scripts. Here's something to get you up to speed:

Code: Select all

defineRace{
	name = "hobbit",
	uiName = "Hobbit",
	inventoryBackground = "assets/textures/gui/inventory_backgrounds/human_$sex.tga",
}

defineTrait{
	name = "hobbit",
	uiName = "Hobbit",
	icon = 0,
	--iconAtlas = "mod_assets/textures/skills.tga",
	description = "As a hobbit you are really short.",
	onRecomputeStats = function(champion, level)
		if level > 0 then
			champion:addStatModifier("dexterity", 10)
		end
	end,	
}

defineCharClass{
	name = "king",
	uiName = "King",
}

defineTrait{
	name = "king",
	uiName = "King",
	icon = 1,
	--iconAtlas = "mod_assets/textures/skills.tga",
	description = "...",
	gameEffect = [[- Health 60 (+7 per level), Energy 30 (+3 per level)]],
	onRecomputeStats = function(champion, level)
		if level > 0 then
			level = champion:getLevel()
			champion:addStatModifier("max_health", 60 + (level-1) * 7)
			champion:addStatModifier("max_energy", 30 + (level-1) * 3)
		end
	end,
}

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 3:54 pm
by Leki
Hobbit / King is there, so conclusion is we really need assetpack :twisted:
Thanks for your help!

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 4:01 pm
by petri
Sweet! Hobbit Kings will rule the world!

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 4:11 pm
by Leki
Comparing my definition and hobbits: the only difference is, that 'onRecomputeStats' probably is not optional as scripting definitions says. Adding that took my custom class to work.

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 4:12 pm
by petri
Leki wrote:comparing my script and hobbit the only difference is, that onRecomputeStats probably is not optional as scripting definitions says
It is optional. There must be something else.

EDIT: well, sort of "optional", without it you get very little health!

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 4:39 pm
by akroma222
Petri and Leki - thank you both of you!!
Those examples were a great help :D

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 4:42 pm
by Leki
Well... You were right petri, looking for the reason of this mess, I went through system and here is the true story:
I made definition, It was ok, but the game wasnot updated! Looking for solution, after crashes I restarted game very first - and it happened few times. After last crash I started to type my post, but during this time, steam decided that it's 'good time' to update the game to 2.1.16. You wrote reply fast so when you asked for version, I checked it and it was 2.1.16 and my next try with script was with your's hobbit and it worked of course - as My custom class as well...
and all this happened because I use my notebook right now and instead of my desktop where LoG is allways updated, this one was not - so some times shit happens, haha, have a nice day man!

Re: scripting new skill / class

Posted: Fri Nov 07, 2014 4:44 pm
by petri
Oh, sometimes things like these happen. Great that you got it working! Have fun!