| 12-06-2007, 02:06 AM | #1 |
I'm trying to create a function that will give me the required exp at a certain level, depending on the Constant Factor, Level Factor, Previous Level Factor and Table. I have tried numerous ideas with different combinations of the 4 values, I have searched on Google, these forums, the Hive and WC3Jass to fine no true answer. The functions found work on the default table, but fail with modified values. I came up with one function for modified values, but it fails on the default values. Right now I am at a loss, and want to kick Blizzard for not creating a GetHeroRequiredXP() native. My back-up plan is to create a dummy unit and set it to the level above, and then get the current exp of the current unit (same as the exp required to reach the level) but I could not get the exp of the last level. If anyone has any ideas, suggestions or anything that will ease my troubles, I am listening. Edit: It turns out I can get the last level with my back-up method. So if no arithmetic solution is found, I'm going with the hero level option. |
| 12-06-2007, 03:32 AM | #2 |
Why not just figure out how much is required for the last level manually and then just use a global for it? Simply create a unit on map init and set its level to the maximum level. Voilà; you can write down the XP required. |
| 12-06-2007, 03:39 AM | #3 |
I am using the following function to get the XP for the next level (required XP) JASS:private function GetMaxXP takes integer level returns integer local unit u set level = level + 1 if level == 1 then return 0 endif if GXPForLevel[level] == 0 then set u = CreateUnit(Player(12), DummyHeroUnit, 0., 0., 0.) call SetHeroLevel(u, level, false) set GXPForLevel[level] = GetHeroXP(u) call RemoveUnit(u) set u = null endif return GXPForLevel[level] endfunction It works fine. I was just hoping if someone has the arithmetic way of getting the XP required, using the Gameplay Constant values. |
| 12-20-2007, 07:45 AM | #4 |
I could probably come up with an equation if you could explain to me what each of those constants does/means. Constant Factor - I dunno. Level Factor - Adds level*<value> to required experience. Previous Value Factor - I dunno. Table - I'm not sure... It hard-codes the required experience for the level of it's index in the table? |
| 12-20-2007, 02:30 PM | #5 |
it has already been solved. Look at the last 2 posts for it. http://hilton.vs.oiccam.com/showthread.php?t=98183 |
