scripting new skill / class
Re: scripting new skill / class
I would guess you aren't running beta 2.1.15 or later?
Re: scripting new skill / class
I have 2.1.16petri wrote:I would guess you aren't running beta 2.1.15 or later?
... and ingame console command
Code: Select all
party.party:getChampion(1):setClass("my_custom_class")
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: scripting new skill / class
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
Hobbit / King is there, so conclusion is we really need assetpack ![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Thanks for your help!
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Thanks for your help!
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: scripting new skill / class
Sweet! Hobbit Kings will rule the world!
Re: scripting new skill / class
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.
Last edited by Leki on Fri Nov 07, 2014 4:13 pm, edited 1 time in total.
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: scripting new skill / class
It is optional. There must be something else.Leki wrote:comparing my script and hobbit the only difference is, that onRecomputeStats probably is not optional as scripting definitions says
EDIT: well, sort of "optional", without it you get very little health!
Re: scripting new skill / class
Petri and Leki - thank you both of you!!
Those examples were a great help![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Those examples were a great help
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: scripting new skill / class
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!
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!
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: scripting new skill / class
Oh, sometimes things like these happen. Great that you got it working! Have fun!