ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Sun Jun 25, 2017 5:20 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Tue Jan 28, 2014 6:48 pm 
Offline

Joined: Tue Jan 28, 2014 6:39 pm
Posts: 2
Hi! I'm new to this game and also to Lua, I'm beginning to learn it :)

So, I've followed the ToME wikia about how to make an addon. The thing is, I wanted to change the description of the warrior class to something silly (just to try it it works!). So, I've created a directory for my addon (tome-yeahmola), and inside of it the needed directories for the warrior class, like this:

"...TalesMajEyal/addons/tome-yeahmola/superload/data/birth/classes/warrior.lua"

I thought following the wiki example, when it changes the mana_sustain attribute from Arcane Power with a single line, modyfing other things would be as easy. But I'm wrong of course! the game doesn't work with my AddOn (it got stuck in the loading screen). The following is written inside my warrior.lua file:

Code:
local _M = loadPrevious(...)

BirthDescriptors.birthdescriptors_def.BD_WARRIOR.desc = {"Warrior are so ugly you should bite a car"}

return _M



So here's my problem :_D, I don't have any clue about what I should write to reach that class property. Is there any guide which tells it more clearly? Could you help me with this pleaaaase? :mrgreen:


Yours sincerely,
Vatticson


Top
 Profile  
 
PostPosted: Wed Jan 29, 2014 4:27 am 
Offline
Spiderkin

Joined: Sat Feb 11, 2012 1:12 am
Posts: 543
If an addon you're creating is causing the game to fail to load, you can usually search te4_log.txt for Lua Error to get a general idea of what's causing the problem.


Top
 Profile  
 
PostPosted: Wed Jan 29, 2014 4:29 am 
Offline
Uruivellas

Joined: Sun Nov 03, 2013 12:14 am
Posts: 762
I don't have the best experience, but perhaps you could try calling the class in a data/birth/whatever.lua, and "inserting" the new description there?

For an example, the Arcanum class pack pretty much replaces the Alchemist, so you could look there for general advice,

Best of luck,
The Revanchist :)


Top
 Profile  
 
PostPosted: Wed Jan 29, 2014 5:45 am 
Offline
Uruivellas

Joined: Thu Jan 16, 2014 4:56 am
Posts: 645
The newTalent() function in \engine\interface\ActorTalents.lua takes Arcane Power and turns it into T_ARCANE_POWER with lines 64 and 79

Code:
34   Talents = self,
...
64   t.short_name = t.short_name:upper():gsub("[ ']", "_")
...
79   t.id = "T_"..t.short_name
80   self.talents_def[t.id] = t


and lines 34 and 80 pull it together so that self.talents_def[t.id] is the same as Talents.talents_def.T_ARCANE_POWER

In \engine\Birther.lua, there is:

Code:
55   t.short_name = t.short_name:upper():gsub("[ ]", "_")


but that doesn't come into play further below:

Code:
65   self.birth_descriptor_def[t.type][t.name] = t


So in order to access t.desc, (I think) you need to change your BirthDescriptors.birthdescriptors_def.BD_WARRIOR.desc to Birther.birth_descriptor_def.class.Warrior.desc

_________________
My addons: UI Mod, Auto-explore & Rest Tweaks, Dev Tools,
Bosses Gone AWOL??!?


Top
 Profile  
 
PostPosted: Thu Jan 30, 2014 3:08 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5471
Oh yeah, I was going to explain what was wrong with this code last night, but then I didn't get around to turning the computer on.

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Thu Jan 30, 2014 10:03 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5471
getBirthDescriptor("class", "Warrior").desc = {"Warrior are so ugly, you should bite a car."}

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Sat Feb 01, 2014 1:30 pm 
Offline

Joined: Tue Jan 28, 2014 6:39 pm
Posts: 2
Marson wrote:
The newTalent() function in \engine\interface\ActorTalents.lua takes Arcane Power and turns it into T_ARCANE_POWER with lines 64 and 79

Code:
34   Talents = self,
...
64   t.short_name = t.short_name:upper():gsub("[ ']", "_")
...
79   t.id = "T_"..t.short_name
80   self.talents_def[t.id] = t


and lines 34 and 80 pull it together so that self.talents_def[t.id] is the same as Talents.talents_def.T_ARCANE_POWER

In \engine\Birther.lua, there is:

Code:
55   t.short_name = t.short_name:upper():gsub("[ ]", "_")


but that doesn't come into play further below:

Code:
65   self.birth_descriptor_def[t.type][t.name] = t


So in order to access t.desc, (I think) you need to change your BirthDescriptors.birthdescriptors_def.BD_WARRIOR.desc to Birther.birth_descriptor_def.class.Warrior.desc


That didn't worked, but thanks to you i've found that function (string.gsub) and i've studied it and tried to understand it, so that's cool for my code learning :) Thanks!

Quote:
getBirthDescriptor("class", "Warrior").desc = {"Warrior are so ugly, you should bite a car."}


It works, thank you ^^.


Top
 Profile  
 
PostPosted: Sat Feb 01, 2014 4:14 pm 
Offline
Uruivellas

Joined: Thu Jan 16, 2014 4:56 am
Posts: 645
That probably should have been

Birther.birth_descriptor_def["class"]["Warrior"].desc

but I had a Mad Cow moment. The function HousePet posted is even better, as it does error checking.

_________________
My addons: UI Mod, Auto-explore & Rest Tweaks, Dev Tools,
Bosses Gone AWOL??!?


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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