Page 1 of 2

Making Addons Halp

Posted: Thu Apr 02, 2015 8:30 pm
by astralInferno
Is there a 'addons for dummies' thread anywhere? Has anyone written a guide to doing things? Is there an IRC where I could beg people to hold my hand as I fail to look competent?
I think I might be able to muddle through a really simple addon just by reading one that I have and mimicking it, but I'm still nervous.

...like, the wiki says to make a directory. Does it just mean a folder? None of the other addons are folders they're TEAAs...

Edit: iiiif it's not clear I have zero coding knowledge at all.

Re: Making Addons Halp

Posted: Thu Apr 02, 2015 8:32 pm
by Micbran
Open up a TEAA with 7zip or whatever.

Re: Making Addons Halp

Posted: Thu Apr 02, 2015 8:32 pm
by grayswandir
A .teaa is just a zip file holding the addon folder (the one the wiki tells you to make). A good starting point is to unzip a few of the simpler addons and poke them a bit. :)

Re: Making Addons Halp

Posted: Thu Apr 02, 2015 8:33 pm
by Micbran
grayswandir wrote:A .teaa is just a zip file holding the addon folder (the one the wiki tells you to make). A good starting point is to unzip a few of the simpler addons and poke them a bit. :)
That awkward moment when you both post at the same time.

Re: Making Addons Halp

Posted: Thu Apr 02, 2015 8:51 pm
by astralInferno
grayswandir wrote:A .teaa is just a zip file holding the addon folder (the one the wiki tells you to make). A good starting point is to unzip a few of the simpler addons and poke them a bit. :)
(Looks down at WinRAR)
"newBirthDescriptor {
type = 'subrace',
name = 'Fallen',"

...hee.

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 2:38 am
by astralInferno
New question, miraculously may be the last for now...

How do you set what icon a talent uses? New effects have it as part of their description, but talents don't seem to. Do you have to include the icon you want to use as new data named after the talent?

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 2:46 am
by grayswandir
Talents have their icon filename default to their shortname. You can override this with the image field, just like effects do.
Effects also have a default filename, but a lot of the time they reuse the talent icon instead.

Relevant code from data/talents.lua:

Code: Select all

if not t.image then
	t.image = "talents/"..(t.short_name or t.name):lower():gsub("[^a-z0-9_]", "_")..".png"
end
So, generally you just put the image file in the proper place in the overload directory.

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 2:49 am
by astralInferno
You're a lifesaver! If all goes well, I'll be testing this in a few minutes.

edit: ...didn't work! I'll have to read through all the code again. wwhelp.

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 10:32 am
by astralInferno
Okay, I managed to find the FIRST bug (missed a comma), but I don't know what's messing things up this time...

Lua Error: /engine/utils.lua:1782: /data-rhalorenrace/talents.lua:64: '}' expected (to close '{' at line 57) near 'getSave'
At [C]:-1
At [C]:-1 error
At /engine/utils.lua:1782 loadfilemods
At /engine/interface/ActorTalents.lua:31 loadDefinition
At /hooks/rhalorenrace/load.lua:9
At [string "return function(l, self, data) local ok=false..."]:1
At /mod/load.lua:271
At [C]:-1 require
At /engine/Module.lua:160 load
At /engine/Module.lua:955 instanciate
At /engine/utils.lua:2197 showMainMenu
At /engine/init.lua:162
At [C]:-1 dofile
At /loader/init.lua:204

newTalent{
short_name = 'INFERNO_SHIELD_OF_TAINT',
name = "Shield of Taint",
type = {"race/rhaloren", 2},
mode = "passive",
require = racial_req2,
points = 5
getSave = function(self, t) return self:combatTalentScale(t, 5, 25, 0.75) end,
power = function(self, t) return self:combatTalentScale(t, 7, 25) end,
passives = function(self, t, p)
self:talentTemporaryValue(p, "combat_spellresist", t.getSave(self, t))
self:talentTemporaryValue(p, "resists",{[DamageType.NATURE]=t.power(self, t)})
end,
info = function(self, t)
local netpower = t.power(self, t)
return ([[Unnatural power flows through the Rhalorens veins, helping them resist magic and causing natural energies to recoil from them.
Increase spell save by +%d and nature resistance by %d%%.]]):
format(t.getSave(self, t), netpower)
end,
}

The error is saying that there should be a } on the line with getSave, but the talents its based on don't have one. Can anyone point out the obvious for me?
(I'm saddened that this reveals what I was working on. I wanted it to be a surprise.)

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 10:42 am
by HousePet
Comma missing after points = 5? Or is that the one you already found?

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 11:38 am
by astralInferno
Ah! No, that'll be it. Commas are my bane, thank you. X_x

(A few minutes later after realising she left this on the post screen)

I ACTUALLY GOT IN GAME THIS TIME. A Momentous occasion. I mean, I don't seem to have a doll working, and apparently I messed up my third talent real bad somehow, but I got in!

Lua Error: /engine/interface/ActorTalents.lua:80: bad argument #3 to 'info' (number expected, got nil)
At [C]:-1
At [C]:-1 info
At /engine/interface/ActorTalents.lua:80 info
At /mod/class/Actor.lua:5468 getTalentFullDescription
At /mod/dialogs/LevelupDialog.lua:921 getTalentDesc
At /mod/dialogs/LevelupDialog.lua:682 tooltip
At /mod/dialogs/elements/TalentTrees.lua:184 updateTooltip
At /mod/dialogs/elements/TalentTrees.lua:110 fct
At /engine/Mouse.lua:76 receiveMouseMotion
At /engine/Mouse.lua:96 delegate
At /engine/ui/Dialog.lua:602 mouseEvent
At /engine/ui/Dialog.lua:343 fct
At /engine/Mouse.lua:76

Relevant talent:

newTalent{
short_name = 'INFERNO_BLOOD_TITHE',
name = "Blood Tithe",
type = {"race/rhaloren", 3},
require = racial_req3,
points = 5,
no_energy = true,
cooldown = 30,
is_spell = true,
tactical = { BUFF = 2 },
getLifeDrain = function(self, t) return self:getTalentLevel(t) * 3 end,
getDuration = function(self, t) return self:getTalentLevelRaw(t) + 5 end,
action = function(self, t)
self:setEffect(self.EFF_BLOOD_TITHE, self:getTalentLevelRaw(t) , {power= self:getTalentLevelRaw(t)})
return true
end,
info = function(self, t)
local lifedrain = t.getLifeDrain(self, t)
local Duration = t.getDuration(self, t)
return ([[Your hunger for knowledge and powers is embodied in the way you fight, and you draw vitality from the destruction you cause.
For the next %d turns, damage you deal will cause you to heal for %d%% of the damage done.]]):
format(Duration,LifeDrain,Penetration,Damage)
end,
}

...while I'm on this spell, I'm concerned about balancing the lifedrain. My original plan was a sustain that drained an amount of your resources each turn, but when I considered coding that I cried. Currently its 3-18% for 6-10 turns, but it feels like 3% would be useless. Maybe if I make it 2/level plus a base of five or something?

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 11:58 am
by HousePet
You haven't defined Penetration.

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 12:00 pm
by astralInferno
...oh man that IS obvious. I knew it would be obvious.
Thank you so much. DXD

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 12:20 pm
by astralInferno
...I removed the penetration and the damage from the end, and it still gives exactly the same error. I am now really confused.

Re: Making Addons Halp

Posted: Fri Apr 03, 2015 1:59 pm
by grayswandir
astralInferno wrote:Lua Error: /engine/interface/ActorTalents.lua:80: bad argument #3 to 'info' (number expected, got nil)

Code: Select all

local lifedrain = t.getLifeDrain(self, t)
local Duration = t.getDuration(self, t)
return ([[Your hunger for knowledge and powers is embodied in the way you fight, and you draw vitality from the destruction you cause.
For the next %d turns, damage you deal will cause you to heal for %d%% of the damage done.]]):
	format(Duration,LifeDrain,Penetration,Damage)
That's the error message for an improper call to format. Argument #1 is the actual string itself ("Your hunger ..."), and arguments 2+ are the rest of the parameters (Duration, LifeDrain, etc.). So according to the error #3, LifeDrain, is nil, when it's supposed to be a number.

If you look, you define "local lifedrain", not "local LifeDrain".