ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Tue Sep 18, 2018 3:48 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How do Talents work
PostPosted: Tue Sep 29, 2015 10:41 pm 
Offline
Higher

Joined: Wed Jul 22, 2015 8:12 pm
Posts: 56
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.


Top
 Profile  
 
 Post subject: Re: How do Talents work
PostPosted: Tue Sep 29, 2015 11:20 pm 
Offline
Uruivellas

Joined: Wed Apr 30, 2008 5:55 pm
Posts: 708
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. :)


Top
 Profile  
 
 Post subject: Re: How do Talents work
PostPosted: Thu Oct 01, 2015 11:26 pm 
Offline
Higher

Joined: Wed Jul 22, 2015 8:12 pm
Posts: 56
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group