how to add a script to a class that executes on each lvl up

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
nockermensch
Posts: 2
Joined: Sun Aug 26, 2012 10:57 pm

how to add a script to a class that executes on each lvl up

#1 Post by nockermensch »

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.

catwhowalksbyhimself
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

#2 Post by catwhowalksbyhimself »

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"

grayswandir
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

#3 Post by grayswandir »

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.
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. :)

nockermensch
Posts: 2
Joined: Sun Aug 26, 2012 10:57 pm

Re: how to add a script to a class that executes on each lvl

#4 Post by nockermensch »

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.
I did this, copying the model shown in Zonk's Tweaked racials addon and it worked correctly. This game is amazingly moddable.

Thanks for the advice.

Post Reply