PDA

View Full Version : 5E - Next Level extension



KlatuB
July 26th, 2022, 00:25
I originally posted this in the Extension forum of the Armory with no answer yet, I'm hoping to have better luck here finding an answer.

I have finally found time to fix an extension I wrote originally for FGC and ported over to FGU.

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=53729&stc=1&d=1658791318

The extension adds a new field called "Next Level", when the "Total Level" changes the below code will automatically update the "Next Level" and calculate the remaining XP to reach that level. The code was originally added to "manager_char.lua" in the "addClassRef()" function, looking at the current "manager_char.lua" file it has considerably less code than before. I have trying to find the correct script to put the code in, but I've not had any success.


-- ******************************
-- 5E Level Progression
-- ******************************
local nNewNextLevel = 0;
if nTotalLevel then
if nTotalLevel == 1 then nNewNextLevel = 300; end
if nTotalLevel == 2 then nNewNextLevel = 900; end
if nTotalLevel == 3 then nNewNextLevel = 2700; end
if nTotalLevel == 4 then nNewNextLevel = 6500; end
if nTotalLevel == 5 then nNewNextLevel = 14000; end
if nTotalLevel == 6 then nNewNextLevel = 23000; end
if nTotalLevel == 7 then nNewNextLevel = 34000; end
if nTotalLevel == 8 then nNewNextLevel = 48000; end
if nTotalLevel == 9 then nNewNextLevel = 64000; end

if nTotalLevel == 10 then nNewNextLevel = 85000; end
if nTotalLevel == 11 then nNewNextLevel = 100000; end
if nTotalLevel == 12 then nNewNextLevel = 120000; end
if nTotalLevel == 13 then nNewNextLevel = 140000; end
if nTotalLevel == 14 then nNewNextLevel = 165000; end
if nTotalLevel == 15 then nNewNextLevel = 195000; end
if nTotalLevel == 16 then nNewNextLevel = 225000; end
if nTotalLevel == 17 then nNewNextLevel = 265000; end
if nTotalLevel == 18 then nNewNextLevel = 305000; end
if nTotalLevel == 19 then nNewNextLevel = 335000; end

if nTotalLevel >= 20 then nNewNextLevel = 335000; end
end

Debug.console("Next Level: ", nNewNextLevel);
DB.setValue(nodeChar, "expneeded", "number", nNewNextLevel);
-- ******************************
-- 5E Level Progression
-- ******************************