MadBeardMan
May 27th, 2017, 12:02
Morning All,
Been stuck on this the last few nights, it's the final puzzle that I need to solve to be able to move on for the WOiN (What's Old is New) ruleset.
When a Skill check is performed, the dice roll and report back and explode and are spot on, just one thing I need to do, if Luck Dice are used I need to reduce the 'Luck Dice Pool' that's attached to the character sheet (off the .id node).
Within the onDiceLanded there's no access to the DB it would seem, so an emails to JPG and he suggested adding a ResultHandler, which I've done (see below), now I'm struggling here, I have access to the rSource which in turn I can find the actor, but when I query the DB I get the string 'luckdicepool' returned and not the number 3.
Here's the code and against each Print line I've added what's displayed in the console.
function onInit()
Interface.onHotkeyActivated = actionHotkey;
ActionsManager.registerResultHandler("skill", onRoll);
end
function onRoll(rSource, rTarget, rRoll)
print "Help me Obi Wan";
if rSource then
local sActorType, sActorNode = ActorManager.getTypeAndNodeName(rSource);
print (sActorType); // Shows 'PC'
print (sActorNode); // Shows 'charsheet.id-0002'
myActor = ActorManager.getActor(sActorType, sActorNode);
if myActor then
print "I have an Actor"; // Shows this.
else
print "NO Actor";
end
print(DB.getValue("id-00002", "luckdicepool", 0)); // Shows the string "luckdicepool" not the 3 I'm expecting
else
print ("No source");
end
end
Aside from this I've also noticed this stops the dice result from displaying, I'm not worried about that yet, just want to access the characters data....
So is there an Obi-wan who can help?
Cheers
Col
Been stuck on this the last few nights, it's the final puzzle that I need to solve to be able to move on for the WOiN (What's Old is New) ruleset.
When a Skill check is performed, the dice roll and report back and explode and are spot on, just one thing I need to do, if Luck Dice are used I need to reduce the 'Luck Dice Pool' that's attached to the character sheet (off the .id node).
Within the onDiceLanded there's no access to the DB it would seem, so an emails to JPG and he suggested adding a ResultHandler, which I've done (see below), now I'm struggling here, I have access to the rSource which in turn I can find the actor, but when I query the DB I get the string 'luckdicepool' returned and not the number 3.
Here's the code and against each Print line I've added what's displayed in the console.
function onInit()
Interface.onHotkeyActivated = actionHotkey;
ActionsManager.registerResultHandler("skill", onRoll);
end
function onRoll(rSource, rTarget, rRoll)
print "Help me Obi Wan";
if rSource then
local sActorType, sActorNode = ActorManager.getTypeAndNodeName(rSource);
print (sActorType); // Shows 'PC'
print (sActorNode); // Shows 'charsheet.id-0002'
myActor = ActorManager.getActor(sActorType, sActorNode);
if myActor then
print "I have an Actor"; // Shows this.
else
print "NO Actor";
end
print(DB.getValue("id-00002", "luckdicepool", 0)); // Shows the string "luckdicepool" not the 3 I'm expecting
else
print ("No source");
end
end
Aside from this I've also noticed this stops the dice result from displaying, I'm not worried about that yet, just want to access the characters data....
So is there an Obi-wan who can help?
Cheers
Col