-
January 6th, 2022, 23:03 #761
- Join Date
- Nov 2017
- Location
- North Carolina, USA
- Posts
- 266
-
January 6th, 2022, 23:16 #762
Ok, ok,
in your debug you get
s'rRoll: ' | { s'nBonuses' = s'0', s'aDice' = { #1 = { s'value' = #87, s'type' = s'd100', s'result' = #87 }, s'expr' = s'd100' }, s'nMod' = #-20, s'sType' = s'wpn1_a_emlRollAction', s'bSecret' = bFALSE, s'SkillScore' = s'65', s'sDesc' = s'Attack EML Test Result For ML 80 - 15 PP [-20]' }
whenever data is being sent in these arrays it is converted to a string so that is one potential issue
but then I see this and I am confused
local sModDesc, nMod = ModifierStack.getStack(true);
this command gets the Modifier stack descriptions and modifiers and saves them into sModDesc and nMod
but it looks like (from your rRoll) that you are already sending that in your roll - most likely in your RW properties where you have set Use Modifier Stack and Reset Modifier Stack to True
so there wont be anything in the modifier stack for your manual command to retrieve.
To get the Modifier data into your result change
if nResult > nSkillScore then
to
nResult = nResult + tonumber(rRoll.nMod);
if nResult > nSkillScore then
this is retrieving the nMod from the rRoll (rRoll.nMod) and converting the string value to a number tonumber() and then adding it to nResult nResult = nResult + tonumber(rRoll.nMod)
That is probably the fix for you right now...
-
January 6th, 2022, 23:16 #763
oh and get rid of the modifierstack line
-
January 6th, 2022, 23:37 #764
- Join Date
- Nov 2017
- Location
- North Carolina, USA
- Posts
- 266
Works great! How do I get it to stop at 1? For example, in one test with a -20 modifier, it returned -8 on a roll of 12. I would have that thought this parameter would have been inherent to rRoll, but perhaps I've tweaked it enough in this script to disable most of the built in stuff? This is what I ended up with:
function Skill(rSource, rTarget, rRoll)
Debug.chat("rRoll: ", rRoll);
local nSkillScore = tonumber(rRoll.SkillScore);
Debug.chat("nSkillScore: ", nSkillScore);
local nResult = rRoll.aDice[1].result;
Debug.chat("nResult: ", nResult);
local sResult = '';
nResult = nResult + tonumber(rRoll.nMod);
if nResult > nSkillScore then
if nResult % 5 == 0 then
sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Critical Failure ";
else
sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Marginal Failure ";
end
else
if nResult % 5 == 0 then
sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Critical Success ";
else
sResult = ' (' .. nResult .. " vs EML " .. nSkillScore .. ") = Marginal Success ";
end
end
local rMessage = ActionsManager.createActionMessage(rSource, rRoll);
rMessage.text = rMessage.text .. sResult;
Comm.deliverChatMessage(rMessage);
return true
end
-
January 6th, 2022, 23:54 #765
Change this:
nResult = nResult + tonumber(rRoll.nMod);
if nResult > nSkillScore then
to this:
nResult = nResult + tonumber(rRoll.nMod);
if nResult > 1 then nResult = 1; end
if nResult > nSkillScore then
-
January 7th, 2022, 00:32 #766
- Join Date
- Nov 2017
- Location
- North Carolina, USA
- Posts
- 266
Thanks for your help! I'll leave you alone for a couple days. ;-)
-
January 8th, 2022, 12:31 #767
- Join Date
- Nov 2017
- Location
- North Carolina, USA
- Posts
- 266
So here is an excerpt from the managerChar script:
local nbknees = 0;
local neknees = 0;
local npknees = 0;
local nfknees = 0;
local nbcalves = 0;
local necalves = 0;
local npcalves = 0;
local nfcalves = 0;
local nbfeet = 0;
local nefeet = 0;
local npfeet = 0;
local nffeet = 0;
for k,v in pairs (nodeChar.getChild("inventorylist").getChildren())
do if v.getChild("carried").getValue() == 1 then
nbskull = nbskull+v.getChild("bskull").getValue()
neskull = neskull+v.getChild("eskull").getValue()
npskull = npskull+v.getChild("pskull").getValue()
nfskull = nfskull+v.getChild("fskull").getValue()
nbface = nbface+v.getChild("bface").getValue()
neface = neface+v.getChild("eface").getValue()
npface = npface+v.getChild("pface").getValue()
nfface = nfface+v.getChild("fface").getValue()
nbneck = nbneck+v.getChild("bneck").getValue()
neneck = neneck+v.getChild("eneck").getValue()
npneck = npneck+v.getChild("pneck").getValue()
nfneck = nfneck+v.getChild("fneck").getValue()
Whenever I add a piece of armor that hits a blank entry I get this error:
[1/8/2022 7:27:33 AM] [ERROR] Script execution error: [string "campaign/Scripts/managerChar.lua"]:99: attempt to index a nil value
Line 99 is "nbskull = nbskull+v.getChild("bskull").getValue()"
Normally I would replace "nbskull = nbskull+v.getChild("bskull").getValue()" with "DB.setValue(nodeWin, "bskull", "number", bskull);" and that would solve the "nil value" problem. But I dont know how to do that with the +v.getChild math string.
Do I need to set the default value for each box at "0" in RW or in the script? Or is there another way to get around the error?
-
January 8th, 2022, 12:39 #768
try
nbskull = nbskull+DB.getValue(v, "bskull", "number", 0);
Does that work?
Please also confirm that nbskull already exists before ln99 and you know that equipped is carried == 2 right?
-
January 9th, 2022, 17:11 #769
- Join Date
- Nov 2017
- Location
- North Carolina, USA
- Posts
- 266
OK, so I have everything working now. CS is done (though I am loath to say that, as I am sure I am jinxing myself, we'll find out TUE night). Screens of major changes:
new abilities.PNG
new inventory.PNG
new notes.PNG
-
January 9th, 2022, 21:50 #770
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks