• 🏆 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!

Berserk resets mana to zero

Status
Not open for further replies.
Level 18
Joined
Nov 21, 2012
Messages
835
Human Priest has "Berserk" (instead of Heal)
When Priest cast "Berserk" he benefits from disabled spell book with ability "Item Life Regeneration" inside.

  • loop
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Priest
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Berserk) Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: c+
                  • Unit - Add Spell Book Conflagration to (Picked unit)
                • Else - Actions
                  • Game - Display to (All players) the text: c-
                  • Unit - Remove Spell Book Conflagration from (Picked unit)
            • Else - Actions
If regular Priest upgrade "Priest Adept Training" 'Rhpt' is made 2 times (unlocks "Dispel Magic" and "Inner Fire") then cast "Berserk" will cause to Priest lose all mana (drops to zero).
What is going on???
 

Attachments

  • SpellBookResetMana.w3x
    17.3 KB · Views: 61

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
It does not happen, if you use the default spell book abilities. You can use item life regeneration wihtout spell book though, because it is hidden.
I have no idea how this is connected to the upgrade though. Makes no sense for me.
 
Level 13
Joined
May 10, 2009
Messages
868
Man, I don't even know how to start typing this message. I'm speechless and can't comprehend why this bug happens this way... It seems the problem lies on the Mana Point Bonus from Priest Training upgrade, and also a spell book with any ability added to it (an empty spell book won't do anything). I've started messing around with the upgrade's base and increment fields, and depending on the numbers you assign to them, your priest gets his current mana points set to a different value as soon as a spell book is given to him. By default, base and increment fields are set to 100 mana points. If you set both to 99, when you add the spell book to a priest, he gets his current mp set to 199. Setting base value to 95 and 100 to increment, his current mp is set to 158.

The easiest way to fix that is storing the unit's current mp before adding a spell book, and restore it after you give a spell book to it.

Edit: typo
 
Last edited:
Level 18
Joined
Nov 21, 2012
Messages
835
It seems the problem lies on the Mana Point Bonus from Priest Training upgrade
Looks like you're right.
If Priest's base mana pool is 200 - then as long as after upgrades max mana on Priest will be below 100% of base value (below 400) all works fine.

If max mana after upgrades will be equal to base value * 2 then bug reset mana to zero will appear.

If max mana after upgrades will rise above 2xbase value then diffrent bug appears: after adding spell book mana is immediately set to max!

Im also thinking about game version.. I'm still on 1.28.0.7205
btw whats your version BloodSoul ?

after next tests I found out that these bugs appear when adding spell book while unit has buff:

  • mana shield
  • immolation
  • wind walk
  • berserk
  • roar
didnt test more, thats horrible..
 
Level 13
Joined
May 10, 2009
Messages
868
btw whats your version
1.27b (1.27.1.7085)

after next tests I found out that these bugs appear when adding spell book while unit has buff
Argh, I thought that terrible bug would only happen with mana point bonus. ):

EDIT: I tried to reproduce the same bug with those buffs you mentioned, but they're working as intended for me.
 
Last edited:
Level 11
Joined
Jun 2, 2004
Messages
849
This is bizarre. It seems likely the unit's current mana is being updated much like as if the upgrade was researched (to give the same percentage of total mana), but buggy values are being used and it's resulting in floating point errors. Nice find.
 
Level 18
Joined
Nov 21, 2012
Messages
835
This bugs also affects life points. But starts affectings when the numbers are near 2x the initial value.
Thats also true.

If unit's base hp is 300, then if he gets by upgrade more or equal 300hp bonus, then adding spell book while he has buff (listed in my previous post) will kill the unit.

It seems likely the unit's current mana is being updated
I dont understand why it is udated if unit gets disabled spell book ability with passive spells inside? It does not cost mana. I barrely remember something like that related to Bonus Mod with MaxHP/MaxMana addon, where author told us to not using upgrades with this system. I didnt know it is so bizarre buged with life and mana values.
 
Status
Not open for further replies.
Top