Page 1 of 1

Compare Nil, showing on copied talent code

Posted: Tue May 19, 2015 6:03 pm
by xnd
Here, I copied Carbon Spikes to give it to Chrono Xorn. I did not change the code.
Getting a new kind of nil error.

http://pastebin.com/ntLPepAv

this is the line 942 in the error:
if self.carbon_armor < maxspikes then

Re: Compare Nil, showing on copied talent code

Posted: Tue May 19, 2015 6:04 pm
by xnd
Swallow, also.

http://pastebin.com/8Sef6W2H


this is line 1309-1316 referred in the error:

action = function(self, t)
local tg = self:getTalentTarget(t)
local x, y, target = self:getTarget(tg)
if not target or not self:canProject(tg, x, y) then return nil end

self:logCombat(target, "#Source# tries to swallow #Target#!")
local hit = self:attackTarget(target, DamageType.NATURE, self:combatTalentWeaponDamage(t, 1.6, 2.5), true)
if not hit then return true end

Re: Compare Nil, showing on copied talent code

Posted: Wed May 20, 2015 8:02 am
by Dienes
Well its both caused by somehow having self.carbon_armor equal nil. So either activate isn't being called for it so carbon_armor never gets set to anything or there is something weird where getArmor is returning nil. I see getArmor calls getParadoxSpellpower(), do you have getParadoxSpellpower() in Chrono_Xorn.lua? If not that call will default to nil and its possible that combatTalentSpellDamage() returns nil in that situation so that might be where its coming from.

If that's no help I'd suggest you throw print() at it until something turns up. I'd suggest sticking something like

Code: Select all

print("xnd: carbon spikes activate: power= "..power)
in the activate function after the local power ... line and then

Code: Select all

print("xnd: carbon spikes callbackOnActBase: maxspikes= "..maxspikes.." , self.carbon_armor= "..self.carbon_armor) 
after local maxspikes line.

Swallow is caused by the same issue. If you looked in mod/class/interface/combat.lua:882 you'd see it also makes mention of self.carbon_armor. Its a hard coded case to handle the carbon armor talent. So once you fix this bug you will also have to fix that since it will try to call target:forceUseTalent(target.T_CARBON_SPIKES, {ignore_energy=true}) on your xorn to deactivate carbon spikes because you reused the same attr carbon_spikes and self.carbon_armor, which won't work.

Re: Compare Nil, showing on copied talent code

Posted: Fri May 22, 2015 3:41 am
by xnd
thanks for responding,

i have paradox spellpower, and if i load the carbon spikes from the original game itself, give it pts in the class lua, it works without this error, just no way to lvl it up as it wont show in the P screen since it is chrono / other and i dont want all of other added.

i encounter way too many errors i dont understand so i just added it there, 5 pts, like whatever. chronoxorn still dying on lvl 1 of ID or in 1st spider quest usually, cause i havent added enough.

currently interest is down on this, ...errors....