Page 1 of 1
Cast X when stunned
Posted: Sun Nov 07, 2010 4:11 pm
by Mushroomstamp
I'm trying to code Shield of Truth in skills.lua, so that it casts when stunned. Once I'm stunned, I get the below error and the script stops;
...classes/skill.lua:327: Attempt to index local 'checktab' <a nil value>
What does that mean? How can I make the below code work? Or do I need to do it another way? Maybe an onPreSkillCast script?
Code: Select all
<skill name="KNIGHT_SHIELD_OF_TRUTH" skilltab="4" skillnum="7" mana="150" cooldown="60" type="buff" target="self" inbattle="true" reqbufftype="debuff" reqbuffcount="1" reqbufftarget="self" reqbuffname="Stun" />
Re: Cast X when stunned
Posted: Sun Nov 07, 2010 4:40 pm
by jduartedj
Mushroomstamp wrote:I'm trying to code Shield of Truth in skills.lua, so that it casts when stunned. Once I'm stunned, I get the below error and the script stops;
...classes/skill.lua:327: Attempt to index local 'checktab' <a nil value>
What does that mean? How can I make the below code work? Or do I need to do it another way? Maybe an onPreSkillCast script?
Code: Select all
<skill name="KNIGHT_SHIELD_OF_TRUTH" skilltab="4" skillnum="7" mana="150" cooldown="60" type="buff" target="self" inbattle="true" reqbufftype="debuff" reqbuffcount="1" reqbufftarget="self" reqbuffname="Stun" />
Ahhh Found it!
if you check the code below in skill.lua you'll see that the TARGET is "player" and NOT "self"
therefore it would try to index something that doesn't exist, i.e., a nil value! Just change it to player!
Code: Select all
if( self.ReqBuffName ~= "" ) then
local checktab;
if( self.ReqBuffTarget == "player" ) then
if( self.ReqBuffType == "buff" ) then
checktab = player.Buffs;
else
checktab = player.Debuffs;
end;
elseif( self.ReqBuffTarget == "target" ) then
if( self.ReqBuffType == "buff" ) then
checktab = target.Buffs;
else
checktab = target.Debuffs;
end;
end
if( self.ReqBuffCount > (checktab[self.ReqBuffName] or 0) ) then
return false;
end;
end
Re: Cast X when stunned
Posted: Sun Nov 07, 2010 8:02 pm
by Mushroomstamp
You kick ass - thanks so much!
Re: Cast X when stunned
Posted: Sun Nov 07, 2010 8:21 pm
by jduartedj
Mushroomstamp wrote:You kick ass - thanks so much!
You're Welcome!Aand this reminds me to update my skills file, i've been using an old r4xx version because i have some elite skills that are (were?) not on the db.
Re: Cast X when stunned
Posted: Sun Nov 07, 2010 8:37 pm
by Administrator
If you have skills that are not in the current skills database, let us know so we can add them.
Re: Cast X when stunned
Posted: Mon Nov 08, 2010 5:39 pm
by jduartedj
Administrator wrote:If you have skills that are not in the current skills database, let us know so we can add them.
Actually One of my first posts last year was about that and i don't think that skill is in the DB yet xD
Serioulsy i'll check my skills, thx!