Purity Posted January 21, 2014 Share Posted January 21, 2014 Very basic snippet, helpful for the paint in your script. public static int getExperienceUntilLevel(int currentExperience, int level) { int experience = 0; for(int i = 1; i < level; i++) { experience += Math.floor(i + 300 * Math.pow(2, i / 7.0f)); } return (int) Math.floor(experience / 4) - currentExperience; } 1 Link to comment Share on other sites More sharing options...
While Posted January 21, 2014 Share Posted January 21, 2014 pretty sure you copied this... at least give credits to whoever u copied from Link to comment Share on other sites More sharing options...
Purity Posted January 21, 2014 Author Share Posted January 21, 2014 pretty sure you copied this... at least give credits to whoever u copied from Uh.. I interpreted it from this formula, which is from the Runescape wikia. I wouldn't really classify that as copying.. but I've references the source regardless.. 1 Link to comment Share on other sites More sharing options...
While Posted January 21, 2014 Share Posted January 21, 2014 Uh.. I interpreted it from this formula, which is from the Runescape wikia. I wouldn't really classify that as copying.. but I've references the source regardless.. As long as you understand and know which formula it is I guess it's fine.. Link to comment Share on other sites More sharing options...
pitoluwa Posted January 21, 2014 Share Posted January 21, 2014 What's the problem of understanding that formula? Nice one matey, thanks for it . 1 Link to comment Share on other sites More sharing options...
pitoluwa Posted January 21, 2014 Share Posted January 21, 2014 What's the problem of understanding that formula? Nice one matey, thanks for it . Link to comment Share on other sites More sharing options...
liverare Posted January 22, 2014 Share Posted January 22, 2014 Nice, but computing the required XP on each call (especially on paint) will only result in performance issues. I'd suggest just caching the values into a giant 2D array. 1 Link to comment Share on other sites More sharing options...
Purity Posted January 22, 2014 Author Share Posted January 22, 2014 Nice, but computing the required XP on each call (especially on paint) will only result in performance issues. I'd suggest just caching the values into a giant 2D array. That's exactly what I do with my script ;) Link to comment Share on other sites More sharing options...
FrostBug Posted January 22, 2014 Share Posted January 22, 2014 (edited) Math operations are usually very expensive (Especially the Pow() operation) I'd recommend just indexing a single-dimensional array @Liverare, not sure why you would want to do a 2d array EDIT: This is the one I use public static final int[] XP_TABLE = {0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431}; Edited January 22, 2014 by FrostBug Link to comment Share on other sites More sharing options...