Question is in the title.
I'm trying to create a new class and I'd like to run a function on each level up (on certain levels, the class would gain extra talents). How do I make this hook? Module is standart ToME4.
Also, on a more general question, is there some place where I can look for this kind of info? I'm trying to figure things by examining the existing lua scripts, with limited success so far.
how to add a script to a class that executes on each lvl up
Moderator: Moderator
-
- Posts: 2
- Joined: Sun Aug 26, 2012 10:57 pm
-
- Wyrmic
- Posts: 249
- Joined: Sun Aug 15, 2004 1:19 am
- Location: Plainville, CT
Re: how to add a script to a class that executes on each lvl
I just put a list of hooks I on the wiki. There isn't an onlevelup on though, but DG did say to ask for more hooks if you needed them, so you might want to just ask him.
"I am the cat that walks by himself. All ways are alike to me."
--Rudyard Kipling, "The Cat That Walked By Himself"
--Rudyard Kipling, "The Cat That Walked By Himself"
-
- Uruivellas
- Posts: 708
- Joined: Wed Apr 30, 2008 5:55 pm
Re: how to add a script to a class that executes on each lvl
Take a look at the levelup defined in engine/interface/ActorLevel.lua.
It says something about checking self._levelup_info.
Or, you can just do your standard superloading, and superload levelup() in mod/Actor.lua. Make sure to call the original, and then just add a check for your class or something.
It says something about checking self._levelup_info.
Or, you can just do your standard superloading, and superload levelup() in mod/Actor.lua. Make sure to call the original, and then just add a check for your class or something.
Addons: Arcane Blade Tweaks, Fallen Race, Monk Class, Weapons Pack
Currently working on Elementals. It's a big project, so any help would be appreciated.
Currently working on Elementals. It's a big project, so any help would be appreciated.

-
- Posts: 2
- Joined: Sun Aug 26, 2012 10:57 pm
Re: how to add a script to a class that executes on each lvl
I did this, copying the model shown in Zonk's Tweaked racials addon and it worked correctly. This game is amazingly moddable.grayswandir wrote:Take a look at the levelup defined in engine/interface/ActorLevel.lua.
It says something about checking self._levelup_info.
Or, you can just do your standard superloading, and superload levelup() in mod/Actor.lua. Make sure to call the original, and then just add a check for your class or something.
Thanks for the advice.