learnTalent at Birth?

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Pisastrish
Thalore
Posts: 157
Joined: Wed Sep 28, 2016 8:07 pm

learnTalent at Birth?

#1 Post by Pisastrish »

How can I modify a class that already exists to gain a talent at birth without overloading the file? I'm looking to do this with a talent like teleport anglowen, so having it learn a category and automatically put points in it doesn't work.

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: learnTalent at Birth?

#2 Post by HousePet »

Short answer, if you know how to edit a class already:
getBirthDescriptor("subclass", "<replace with class name>").talents["<replace with talent id>"] = 1


Long answer, if you are using a separate file to store all the class changes in one neat package:
Start with the ToME:load hook.
In the ToME:load hook put:
local Birther = require "engine.Birther"
Birther:loadDefinition("path to birth editing file here")

Inside this birth editing file put:
getBirthDescriptor("subclass", "<replace with class name>").talents["<replace with talent id>"] = 1


If you just want to do nothing else, you can simplify it:
class:bindHook('ToME:load', function(self, data)
local Birther = require 'engine.Birther'
Birther:getBirthDescriptor("subclass", "<replace with class name>").talents["<replace with talent id>"] = 1
end)
My feedback meter decays into coding. Give me feedback and I make mods.

Pisastrish
Thalore
Posts: 157
Joined: Wed Sep 28, 2016 8:07 pm

Re: learnTalent at Birth?

#3 Post by Pisastrish »

Thank you!

Post Reply