• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How does "Need Hero XP Table" work?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

So I set this game constants field "Need Hero XP Table" to "0" with a single entry.

The side effect is that level one heroes instantly level to level 2 whenever they get XP (it requires 0 xp).

And heroes cannot be set to level 2, even if you call "SetHeroLevel(..., 2, ...)"

However, I would like it to take xp to get from 1 to 2 and be able to set heroes to level 2.

How would I fix this?

29yrtkk.png
 
Last edited:

EdgeOfChaos

E

EdgeOfChaos

Set NeedHeroXP to the EXP you want it to take to get to level 2. It should only affect the first level. Or you *might* be able to leave it blank and game will specify needed xp.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
This is the problem:

heroes cannot be set to level 2, even if you call "SetHeroLevel(..., 2, ...)"

So if I do this:

JASS:
local unit u = ...
...
call SetHeroLevel(u, 2, true)

The unit will actually be level 1, and not level 2!

I would like to to be level 2.
 
The "NeedHeroXpFormua<ACB>" fields are used to define a quadratic function to determine how much experience a hero needs to level up to a level. The "NeedHeroXp" table is used to overwrite the experience needed for some levels. The table overwrite the first X levels' needed experience, where X is the number of entries in the table. If there are no entries in the table then all values are taken from the function instead. Oddly enough, the default function's required experience for level 1 is 200, which is the same as the override value in the table.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Ah so ACB are constants for which variables?

so the hero EXP formula is this, with x = the level needed

(A * x^2) + (B * x) + (C * 1)

?
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
So if I do this:

JASS:
local unit u = ...
...
call SetHeroLevel(u, 2, true)

The unit will actually be level 1, and not level 2!

I would like to to be level 2.

So the OP asked why this happens. The helper site didn't explain caveats about permutations of the hero XP constants. OP still unsolved :/
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
This is the problem:



So if I do this:

JASS:
local unit u = ...
...
call SetHeroLevel(u, 2, true)

The unit will actually be level 1, and not level 2!

I would like to to be level 2.

Are you trying to decrease a hero's level?

Yes -> Take a look at SetHeroLevelBJ, read comments.

No -> Make sure variable u is a valid unit.Because this works for me.
call SetHeroLevel(CreateUnit(Player(0), 'Hblm', 0, 0, 0), 2, true)
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
Make sure variable u is a valid unit.Because this works for me

How do you think I was testing this? The OP clearly states it works for any other level except level 2.

That wouldn't make any sense: a non-valid unit can be visualized + set at any level but level 2??

Are you trying to decrease a hero's level?

Nope.

No it doesn't work when my advanced constants are like this (again it was in OP):

29yrtkk.png


I can set a hero to any level BUT level 2. If I set a hero to level 2, it just gets set to level 1 instead.

The OP says:

So I set this game constants field "Need Hero XP Table" to "0" with a single entry.

The side effect is that level one heroes instantly level to level 2 whenever they get XP (it requires 0 xp).

And heroes cannot be set to level 2, even if you call "SetHeroLevel(..., 2, ...)"

However, I would like it to take xp to get from 1 to 2 and be able to set heroes to level 2.

How would I fix this?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Hmm sorry, didn't read carefully about global constants.

Not sure you consider this as a fix, but if you need to set level to 2 you can do this.
JASS:
call SetHeroLevel(u, 3, true)
call UnitStripHeroLevel(u, 1)
 
Status
Not open for further replies.
Top