• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Upgraded unit lost Spell Book (Bug?)

Status
Not open for further replies.
Level 8
Joined
Sep 30, 2012
Messages
205
I encountered a bug..
I have a unit, a tower for example that can be upgraded.
Both units have the same spell book.
But the upgraded unit seems to have lost its spell book.
Anyone knows how to fix this?

I also en counter problems giving the upgraded unit the ability back via triggers..
An upgraded unit doesn't seem to be "finished with construction" nor did it "enter the game" or "finished researching".. - how can you determine the upgraded unit?

Thanks in advance!
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Have you tried call UnitMakeAbilityPermanent(udg_YourUnit, true, udg_AbilityID) ?

To see the ID of the ability, go to Object Editor -> Abilities Tab -> Press CTRL + D
Now, you can see the ID of each ability (the Ability Name is changed to Spell ID), find the ability and enter it in the parameter using the said function.

Example;
  • Set Caster = (Triggering unit)
  • Custom script: call UnitMakeAbilityPermanent(udg_Caster, true, 'AHfs')
This will make the Caster to have the Flame Strike (AHfs) ability to permanently stays to that unit.
Usually this problem occurs when the unit faces a morphing stage, in this case, your tower is changing to a new unit via upgrade.

The ID you are looking for, is the Spell Book ability.
If only the Spell Book retains while the spell inside is lost, you have to make for the abilities' ID inside the book too.

NOTE: And yeah, it is CASE-SENSITIVE, remember to put the ' ' encloses the Ability ID.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
A better way is just making an identical copy of the spellbook to be put on the alternate unit.
The thing is that when a unit is remade for whatever reason(morph/upgrade), then the game doesn't check for the abilities inside the spellbook.
Thus, it just looks "Alright, the new unit has this ability, so no need to add it".
The result is that the spellbook ability itself is kept, but not the ones inside it.
(My spellbook tutorial also brings out this detail)
 
Level 8
Joined
Sep 30, 2012
Messages
205
Jup that solved it.
Thanks you guys!
well i didn't had cool-downs so the choice was easy, just created identical copies of the spell book.
that solved the problem. oh and yes the entire spell book was gone and not just the spells inside the book. but nvm its fixed now :)
 
Status
Not open for further replies.
Top