How to DB.getChild() using a string value?
So I'm trying to get the value of a field for the source and target based on the use of a power. The source is the ability that the power uses and the vs is the ability that the target will use to defend (think multiple options based on situation). When I use my below code, I get a nil when accessing the data of what should have a value. Am I wrong in thinking I can use a string variable for the DB.getChild() function?
Code:
function resolvePowerTest(rSource, rTarget, rRoll, rPower)
local sSName = ActorManager.getCreatureNodeName(rSource);
local sTName = ActorManager.getCreatureNodeName(rTarget);
local sPSource = rPower.power_source.getValue(); <-- provides the correct source ability string
local sPVs = rPower.power_vs.getValue(); <-- provides the correct vs ability string
Debug.chat(sPSource .. " vs. " .. sPVs);
local sSourceVal = DB.getChild(sSName, sPSource).getValue(); <-- return nil, however a DB.getChildren() will return the correct objects including the one I'm looking for
Debug.chat(sSourceVal);
local sVsVal = DB.getChild(sTName,sPVs).getValue(); <-- return nil, however a DB.getChildren() will return the correct objects including the one I'm looking for
Debug.chat(sVsVal);
local tRoll = ActionsManager.roll(rTarget, nil, rRoll, nil)
local nTotal = ActionsManager.total(rRoll) + rRoll.nBonuses;
local sSuccess = testResult(nTotal - 5);
Debug.chat(sSuccess);
end
Am I just missing something simple (my Lua skills are basic at best) or can this not be done?
Thanks in advance.