Stv
March 6th, 2020, 18:21
I just tried my 5e reliable talent extension in FGU and it throws an error :
[3/6/2020 6:17:17 PM] [<color="red">ERROR</color>] Script execution error: [string "scripts/reliabletalent.lua"]:50: attempt to compare nil with number.
In FGC, this code works fine.
local sPCNodeName = ActorManager.getCreatureNodeName(rSource);
local nodeFeatureList = DB.getChild(sPCNodeName, "featurelist");
local critfail=false
if nodeFeatureList and
string.match(rMessage.text,"PROF")and not string.match(rMessage.text,"PROF x1/2") then
for k, nodeFeature in pairs (nodeFeatureList.getChildren()) do
if DB.getValue(nodeFeature, "name", ""):lower() == "reliable talent" then
---Check the value of the 1st die in the message(D20 roll, and if it's <10 change it to 10, add a notification to the output message then exit the loop)
for _,v in pairs(rMessage.dice) do
--new stuff in here so possibly breaking things
--
--
--check if the critical fail/success settings option is on and check for crit
if OptionsManager.isOption("AFAIL","yes") then
--if result is a one, then flag as a critical fail
if v.result==1
then rMessage.text="[CRITICAL FAIL]\r"..rMessage.text
critfail=true
--if result is a 20 then flag as a critical success
else if v.result==20 then
v.result=20
rMessage.text="[CRITICAL SUCCESS]\r"..rMessage.text
end
end
end
if v.result<10 and critfail==false then
local temp=v.result
v.result=10
rMessage.text="Reliable Talent\r[Dropped "..temp.."]\r"..rMessage.text
end
end
break;
end
end
end
The offending part of the code is this line :
if v.result<10 and critfail==false then
If I Debug the value of v.result at that point it 1st reports the correct value, but then it's like it runs the debug line again but this time returns a value of nil.
Anyone got any ideas or can shove me in the right direction ?
Cheers, Stv.
[3/6/2020 6:17:17 PM] [<color="red">ERROR</color>] Script execution error: [string "scripts/reliabletalent.lua"]:50: attempt to compare nil with number.
In FGC, this code works fine.
local sPCNodeName = ActorManager.getCreatureNodeName(rSource);
local nodeFeatureList = DB.getChild(sPCNodeName, "featurelist");
local critfail=false
if nodeFeatureList and
string.match(rMessage.text,"PROF")and not string.match(rMessage.text,"PROF x1/2") then
for k, nodeFeature in pairs (nodeFeatureList.getChildren()) do
if DB.getValue(nodeFeature, "name", ""):lower() == "reliable talent" then
---Check the value of the 1st die in the message(D20 roll, and if it's <10 change it to 10, add a notification to the output message then exit the loop)
for _,v in pairs(rMessage.dice) do
--new stuff in here so possibly breaking things
--
--
--check if the critical fail/success settings option is on and check for crit
if OptionsManager.isOption("AFAIL","yes") then
--if result is a one, then flag as a critical fail
if v.result==1
then rMessage.text="[CRITICAL FAIL]\r"..rMessage.text
critfail=true
--if result is a 20 then flag as a critical success
else if v.result==20 then
v.result=20
rMessage.text="[CRITICAL SUCCESS]\r"..rMessage.text
end
end
end
if v.result<10 and critfail==false then
local temp=v.result
v.result=10
rMessage.text="Reliable Talent\r[Dropped "..temp.."]\r"..rMessage.text
end
end
break;
end
end
end
The offending part of the code is this line :
if v.result<10 and critfail==false then
If I Debug the value of v.result at that point it 1st reports the correct value, but then it's like it runs the debug line again but this time returns a value of nil.
Anyone got any ideas or can shove me in the right direction ?
Cheers, Stv.