-
Mushroomstamp
- Posts: 210
- Joined: Wed Oct 27, 2010 11:34 am
#1
Post
by Mushroomstamp » Sun Nov 07, 2010 4:11 pm
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" />
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#2
Post
by jduartedj » Sun Nov 07, 2010 4:40 pm
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
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#4
Post
by jduartedj » Sun Nov 07, 2010 8:21 pm
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.
-
Administrator
- Site Admin
- Posts: 5331
- Joined: Sat Jan 05, 2008 4:21 pm
#5
Post
by Administrator » Sun Nov 07, 2010 8:37 pm
If you have skills that are not in the current skills database, let us know so we can add them.
-
jduartedj
- Posts: 599
- Joined: Sat Dec 19, 2009 12:18 am
- Location: Lisbon
-
Contact:
#6
Post
by jduartedj » Mon Nov 08, 2010 5:39 pm
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!
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests