current max exp

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
RayB
Posts: 140
Joined: Fri Mar 06, 2015 3:45 am

current max exp

Post by RayB »

In Grim 2 the maximum experience needed for a level up starts out at 1000. This maximum increases as the game progresses. Is there a function I can use to get the current maximum experience needed for a level up at any point in the game? I know I can use setSkillPoints() or addSkillPoints() or trainSkill() to add level ups but I would like to know how many experience points are needed to get to the next level up.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: current max exp

Post by AndakRainor »

This function returns xp needed to level up for the current level:

Code: Select all

levels = {1,2,3,4,5,6,7,8,9,10,20,25,50,50,50,50,100,100,500,1000}
function xpUp(level) return level>0 and levels[math.min(#levels,level)]*1000 or 0 end
Post Reply