Making Addons Halp

A place to post your add ons and ideas for them

Moderator: Moderator

Message
Author
astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Making Addons Halp

#1 Post 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.

Micbran
Sher'Tul
Posts: 1154
Joined: Sun Jun 15, 2014 12:19 am
Location: Yeehaw, pardner

Re: Making Addons Halp

#2 Post by Micbran »

Open up a TEAA with 7zip or whatever.
A little bit of a starters guide written by yours truly here.

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

Re: Making Addons Halp

#3 Post 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. :)
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. :)

Micbran
Sher'Tul
Posts: 1154
Joined: Sun Jun 15, 2014 12:19 am
Location: Yeehaw, pardner

Re: Making Addons Halp

#4 Post 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.
A little bit of a starters guide written by yours truly here.

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#5 Post 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.

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#6 Post 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?

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

Re: Making Addons Halp

#7 Post 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.
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. :)

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#8 Post 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.

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#9 Post 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.)

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

Re: Making Addons Halp

#10 Post by HousePet »

Comma missing after points = 5? Or is that the one you already found?
My feedback meter decays into coding. Give me feedback and I make mods.

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#11 Post 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?
Last edited by astralInferno on Fri Apr 03, 2015 11:59 am, edited 1 time in total.

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

Re: Making Addons Halp

#12 Post by HousePet »

You haven't defined Penetration.
My feedback meter decays into coding. Give me feedback and I make mods.

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#13 Post by astralInferno »

...oh man that IS obvious. I knew it would be obvious.
Thank you so much. DXD

astralInferno
Uruivellas
Posts: 834
Joined: Mon Jan 27, 2014 10:40 am

Re: Making Addons Halp

#14 Post 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.

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

Re: Making Addons Halp

#15 Post 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".
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. :)

Post Reply