Page 1 of 1
[Request] Corrupted Strength in it's own talent category
Posted: Sat Jun 06, 2015 7:52 am
by waveris
Tried adding a different version of corrupted strength to it's own talent category so i could edit the damage type and play adventurer "reavers" for specific elements, but couldn't get it to work.
Just looking for the "melee attack on spell cast" part to be added, maybe Bloodlust too?
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sat Jun 06, 2015 11:58 pm
by lukep
For that melee attack, you need to look at mod/class/Actor.lua, find "function _M:postUseTalent(ab, ret, silent)" (which contains Corrupted Strength's code) and use a hook/superload to add your own version of that bit.
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sun Jun 07, 2015 3:45 am
by waveris
No errors are happening, but the talent category isn't showing up in the list, nor does it show up if i set a class to start with the category unlocked.
newTalentType{ allow_random=true, type="corruption/reaving", name = "reaving", description = "x" }
ActorTalents:loadDefinition("/data-mod1/talents/corruption/reaving.lua")
in reaving.lua and load.lua respectively. Is there anything else i need to do, or a file i should check to make sure it's loading the category?
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sun Jun 07, 2015 5:49 am
by lukep
Ah, that's a second problem you'll have to deal with. Adventurers get their talents by looking at all of the existing classes and grabbing the categories from there. You need to make a class with your custom talent tree in it, even if it isn't a playable class.
EDIT: oops, it looks like you've covered this already. I'm not sure what's stopping the talent category from showing up, maybe try grabbing some addon for a class, removing 90% of it, and dropping your code in there?
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sun Jun 07, 2015 8:28 am
by waveris
It's working now after using what you suggested, thanks.
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sun Jun 07, 2015 9:48 am
by waveris
Alright, i looked at a bunch of other addons and couldn't work out how to get the actor.lua file working. Currently absolutely no talents consume resources on cast, nor do they go on cooldown.
local _M = loadPrevious(...)
local Talents = require "engine.interface.ActorTalents"
local super_postUseTalent = _M.postUseTalent (((some addons were using baseXX instead of super_XX so idk ??)))
function _M:postUseTalent(ab, ret, silent)
if not util.getval(ab.no_energy, self, ab) then
self:useEnergy(self:getTalentSpeed(ab) * game.energy_to_act)
-- Free melee blow
if ab.is_spell and ab.mode ~= "sustained" and self:knowTalent(self.T_REAVING) and not self:attr("forbid_reaving_blow") and not self.turn_procs.reaving then
local tgts = {}
for _, c in pairs(util.adjacentCoords(self.x, self.y)) do
local target = game.level.map(c[1], c[2], Map.ACTOR)
if target and self:reactionToward(target) < 0 then tgts[#tgts+1] = target end
end
if #tgts > 0 then
self.turn_procs.reaving = true
DamageType:projectingFor(self, {project_type={talent=self:getTalentFromId(self.T_REAVING)}})
self:attackTarget(rng.table(tgts), DamageType.COLD, self:combatTalentWeaponDamage(self.T_REAVING, 0.5, 1.1), true)
DamageType:projectingFor(self, nil)
end
end
end
end
return _M
All the lower case 'reaving' were originally 'corrupted_strength', wasn't sure if they needed changing but i did it anyway
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sun Jun 07, 2015 11:11 am
by HousePet
Since you haven't called super_postUseTalent anywhere, you've removed all the original functions of postUseTalent, like costs and cooldowns.
Re: [Request] Corrupted Strength in it's own talent category
Posted: Sun Jun 07, 2015 12:09 pm
by stinkstink
Did the code I sent you the other night not work? You should just be do this without having to superload anything in Actor.lua by putting a callback into the talent you want to trigger the attacks:
Code: Select all
callbackOnTalentPost = function(self, t, ab, ret, silent)
if ab.is_spell and ab.mode ~= "sustained" and not self:attr("forbid_corrupted_strength_blow") and not self.turn_procs.corrupted_strength then
local tgts = {}
for _, c in pairs(util.adjacentCoords(self.x, self.y)) do
local target = game.level.map(c[1], c[2], Map.ACTOR)
if target and self:reactionToward(target) < 0 then tgts[#tgts+1] = target end
end
if #tgts > 0 then
self.turn_procs.corrupted_strength = true
DamageType:projectingFor(self, {project_type={talent=t}})
self:attackTarget(rng.table(tgts), DamageType.COLD, self:combatTalentWeaponDamage(t.id, 0.5, 1.1), true)
DamageType:projectingFor(self, nil)
end
end
end,