How do Talents work

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Charidan
Higher
Posts: 64
Joined: Wed Jul 22, 2015 8:12 pm

How do Talents work

#1 Post by Charidan »

The next phase of the Player AI is getting it to activate talents and infusions. Preferably, I can set up a generic framework so the AI can look at its talents and work out how to use them on its own (overambition ho!). The problem is:

How do Talents and Infusions actually work internally? I can find the definitions of Talents, but they're just data objects, without a lot of hints on how to look them up or call them. They seem to mostly define functions which presumably get hooked into things. How does a player look up what talents they have? Can I get at the basic information on the Talent (like Activated vs Sustained, etc)?
Currently developing the Player AI addon. You can get it from the T-Engine Addon Hub or Steam
You can also view the source code.

grayswandir
Uruivellas
Posts: 708
Joined: Wed Apr 30, 2008 5:55 pm

Re: How do Talents work

#2 Post by grayswandir »

Take a look at engine/interface/ActorTalents.lua. Actors inherit from this, so they have all the methods and data defined there.

Basically, when newTalent is called, it stores the table in ActorTalents.talents_def.T_TALENT_ID. You can also get at it from self:getTalentFromId"T_TALENT_ID". That is literally returning the same table which is passed to the newTalent call. newTalent justs adds some extra fields to it and stores it in the proper places.

An actor's talents themselves are just stored in their talents table along with their level. So, like, game.player.talents will be something like {T_TALENT_1 = 2, T_TALENT_2 = 5, ...}

You might want to take a look at engine/ai/talented.lua. That just randomly selects a known talent to be used, so it'll probably be a good example.
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. :)

Charidan
Higher
Posts: 64
Joined: Wed Jul 22, 2015 8:12 pm

Re: How do Talents work

#3 Post by Charidan »

Thanks! I've got some incredibly basic talent use working now, currently just activating all Sustained talents. Progress!
Currently developing the Player AI addon. You can get it from the T-Engine Addon Hub or Steam
You can also view the source code.

Post Reply