How the hell does Wexp work on promotion?

So, I’ve been having a lot of trouble figuring out how units gain Wexp when they promote. From my end, they seem to be behaving like vanilla, but some people playing my hack have reported massive Wexp gain on promotion. I don’t know what’s wrong and I would appreciate some insight. Here’s what’s happening on my end:

These are screenshots from a player:

120dc841eef66fcaf7128719f8ee75c9 863197f1ca9dbdb7634f612fe248a622 fac14b397a1621b0234478bbc2ff21c4

And these are the values I’m using:

I’ve had this issue a few times myself as well. Unsure of the exact issue because I haven’t tested it fully, but my understanding is that if the class weapon level is higher than the personal weapon level, there will be a jump in WEXP at promotion.

Similarly, if there the promoted class WEXP level is lower than the base class, there will be a decrease in level. Not sure how personal wexp plays into this though.

Perhaps someone with more expertise on the matter can weigh in, wanted to share my experience and thoughts on it

1 Like

According to Serenes Forest, if you promote and the promoted class has a higher base rank than the unpromoted, you gain a flat WEXP bonus based on rank difference.
E Rank -> D Rank is +30.
E Rank -> C Rank is + 70.
D Rank -> C Rank is +40.
etc etc.
I imagine if the difference is negative it could be decreasing the rank, and if it’s low enough it might be overflowing back into positive integers.

1 Like

This is calculated by the following function.(FE8U)

0802BD50 B5F0   push {r4,r5,r6,r7,lr}   //ApplyUnitPromotion
0802BE2E 7011   strb r1, [r2, #0x0]

Perhaps, to briefly explain this routine, it looks like this:

ramunit->wexp_sw = ramunit->wexp_sw 
	- current_class->base_wexp_sw 
	+ new_class->base_wexp_sw

ramunit->wexp_lnc = ramunit->wexp_lnc
	- current_class->base_wexp_lnc 
	+ new_class->base_wexp_lnc


In a nutshell, the wexp you have learned will be added to the new class of wexp.

Suppose your base’s class base wexp is 1.
Suppose you get 9 wexp for sw.(You swung iron sword 9 times.)

In that case, the current sw wexp is 10.
1 + 9 = 10

Immediately after that, You performed Promotion.
Suppose your new Class sw base wexp is 31.

At this time, the following calculation is performed.

10 - 1 = 9 //You have mastered wexp for only 9.
9 + 31 = 40 //Add only that value to the new class wexp.

So your sw wexp should be 40.

Let’s look at the actual data.

When he Promotes to Paladin …

His sw wexp is now 40.
This is as calculated above.

1 Like

Ah, I think I understand now. In the player’s situation, he has somewhere around 17 mastered exp for lance. Since the cavalier class has 31 base exp for lance, and so do the paladin and great knight classes, when Franz gets promoted he actually loses the 31 points from the cavalier class, resulting in a negative number (17-31= -14), which probably causes the S rank. Since my Franz has over 31 lance exp, his wepon lvl gets a correct value. Thank you so much for clarifying this. It will be useful not only for this hack, but also for others I will make. :smiley:

If the rank is the same it shouldn’t be affected though.

That’s the problem, it isn’t. Franz’s personal lance rank is E (1), while cavalier, paladin and great knight all have base rank of D (31). So when Franz promotes he loses 31 points from the cavalier class, right? If he hasn’t gotten over rank D, the result will be negative and cause the S rank. The 31 points from the promoted class are only added if the result of the subtraction is positive. At least from what I understood.
To put it simply, I just need to make sure the unit’s personal weapon level is never lower than the base class’. This is what happens in vanilla, where Franz has a D rank in lance, the same as the cavalier class. The problem with my hack is that I lowered it to E, so if somebody promotes him before getting at least D rank the issue will happen.

The bonus applies based on class, not character

But if that were true, the player’s Franz would simply be getting +31 points on promotion and becoming D rank, instead of skyrocketing straight to S.

I will run some tests tomorrow and post the results here for discussion.

Ok, so I ran 7 tests each with different parameters portraying a different situation. For every situation, the expected result is calculated with the following formula:

Expected results: (Personal wlvl - base class wlvl) if ≥ 0, then add promoted class wlvl

Test 1 - Franz with personal weapon lvl E, cavalier class rank D and paladin class rank D
Expected: 1-31=-30, so S rank regardless of promoted class wlvl

Behaved as expected.

Test 2 - Franz with personal wlvl E, cavalier rank D and paladin rank C
Expected: 1-31=-30, so rank S regardless of promoted class wlvl

Behaved as expected.

Test 3: Franz with personal rank D, cavalier rank D and paladin rank D
Expected: 31-31=0, then +31 from paladin = 31 D rank

Behaved as expected.

Test 4: Franz with personal rank D, cavalier rank D and paladin rank C
Expected: 31-31=0, then +71 from paladin = 71 C rank

Behaved as expected.

Test 5: Franz personal rank E, cavalier rank D and paladin rank E
Expected: 1-31=-30 so S rank regardless of promotion

*Did not behave as expected

Test 6: Franz personal rank E, cavalier rank E and paladin rank E
Expected: 1-1=0, then add +1 from paladin = 1 E rank

Behave as expected.

Test 7: Franz personal rank E, cavalier rank E and paladin rank D
Expected: 1-1=0, then +31 from paladin = 31 D rank

Behave as expected.


So, from what I gather, there are 2 situations that must be avoided.

  1. Personal weapon level must not be lower than the base class weapon level.

  2. Promoted class weapon level must not be lower than base class weapon level.

As long as those situations are avoided, there should be no problems.


Can’t think of a situation in which the second case would make any sense, so realistically shouldn’t ever run into that issue.
Since the only time base class weapon ranks should ever be used is in determining what weapon types an autoleveled unit of that class can use, as everyone else use their personal ranks, there is no reason a base class needs weapon levels higher than 1; similarly, the only time a promoted class needs a weapon level higher than 1 is for weapon types that classes that can promote into that class cannot use, and in that scenario it doesn’t matter what those ranks are since the character’s rank will always be 0 at the time. If you’re doing things properly, class weapon ranks exist primarily to tell generics what weapon types they’re allowed to use. If you want someone to have a rank higher than E, set it on their character.