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

[Spell] ShapeShift Error

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
186
Basically I set up 2 Druid forms

Spirit Wolf
Spirit Bear

however when I use them the Wolf turns into a Raven, and the bear turns into grizzly bear not spirit bear, any idea how to fix?

also I use SpellBook System, and buyable Abilities

when hero shapeshifts it breaks the spellbook and removes the abilities

is there any way around this

I did try set skin trigger, it changed skin but everything else stayed the same, it didn’t add extra stats and when u turned to Wolf that way, the Wolf was a range attacker shooting bolts, not turning to melee, so that idea didn’t work either

Note: map is being made in Reforged WE

one more thing, is there away to change cliff type without having to recreate the map

as atm it dirt cliffs but want it to be the clean square edge one if that makes sense
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
also I use SpellBook System, and buyable Abilities

when hero shapeshifts it breaks the spellbook and removes the abilities

is there any way around this
When you add an ability to a unit you need to use UnitMakeAbilityPermanent on it to make it persist through morphs. This is a JASS function that is not accessible with GUI. I would recommend doing:
  • Set AbiltyVar = Some Ability
  • Set UnitVar = The Unit
  • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
Just change the variable names to match your variables, but keep the udg_ prefixes.
 
Level 7
Joined
Nov 6, 2019
Messages
186
When you add an ability to a unit you need to use UnitMakeAbilityPermanent on it to make it persist through morphs. This is a JASS function that is not accessible with GUI. I would recommend doing:
  • Set AbiltyVar = Some Ability
  • Set UnitVar = The Unit
  • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
Just change the variable names to match your variables, but keep the udg_ prefixes.


EDIT: I Figured out how the call make perm works, however you can only make abilities added via AddAbility Trigger, Only 1 ability is added that way, and i have got that working perfectly.

However rest of them are added via a Ability System, when u pick up a item it auto consumes and adds to the right Catagory

However, when morph it removes the catagories from the spell book, but as there not added via AddAbility
that script will not work for the abilities, Any other way?

On other note, that still doesnt explain why my morphs are not turning into the selected heros in the ability options

Bear turns into a brown bear, not a Spirit bear thats set in ability
Wolf turns into a Raven for some reason, not the wolf set in ability

i Use this Ability System [code=jass] Abilities System + Buy Abilites subsystem

i need to figure out how to make the Catagories within the spell book, and the spells within them catagories to stay when morphing

NOTE: i use this Equipment System Equipment v2.5.2

When i morpth this ability is not effected at all in anyway, and that is basically a ability with abilities inside it like spell book, yes it is equipment, but shows as a ability as when u left click a item it remvoe itemf rom inventory, and adds a ability inside the equipment ability. so as said basically a spellbook that isnt effected
 

Attachments

  • ERROR.png
    ERROR.png
    39.3 KB · Views: 34
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,023
You just need to modify one of the functions in the ability system to make them permanent after application:
JASS:
    private function Action takes nothing returns nothing
        
        local integer i = GetItemTypeId( GetManipulatedItem( ) )
        call RemoveItem( GetManipulatedItem( ) )
        call UnitAddAbility( GetTriggerUnit( ) , i:ItemAbility )
        
    endfunction

//Becomes this:

    private function Action takes nothing returns nothing
        
        local integer i = GetItemTypeId( GetManipulatedItem( ) )
        call RemoveItem( GetManipulatedItem( ) )
        call UnitAddAbility( GetTriggerUnit( ) , i:ItemAbility )
        call UnitMakeAbilityPermanent(GetTriggerUnit(), true, i:ItemAbility) //<<<<<<<<<<<<<<<<        
    endfunction
The equipment is unaffected because the author already made the abilities permanent immediately after adding, which you can see here:
JASS:
call UnitMakeAbilityPermanent(source, true, node.bonus)
call SetUnitAbilityLevel(source, node.bonus, node.quantity)
 
Level 7
Joined
Nov 6, 2019
Messages
186
You just need to modify one of the functions in the ability system to make them permanent after application:
JASS:
    private function Action takes nothing returns nothing
      
        local integer i = GetItemTypeId( GetManipulatedItem( ) )
        call RemoveItem( GetManipulatedItem( ) )
        call UnitAddAbility( GetTriggerUnit( ) , i:ItemAbility )
      
    endfunction

//Becomes this:

    private function Action takes nothing returns nothing
      
        local integer i = GetItemTypeId( GetManipulatedItem( ) )
        call RemoveItem( GetManipulatedItem( ) )
        call UnitAddAbility( GetTriggerUnit( ) , i:ItemAbility )
        call UnitMakeAbilityPermanent(GetTriggerUnit(), true, i:ItemAbility) //<<<<<<<<<<<<<<<<      
    endfunction
The equipment is unaffected because the author already made the abilities permanent immediately after adding, which you can see here:
JASS:
call UnitMakeAbilityPermanent(source, true, node.bonus)
call SetUnitAbilityLevel(source, node.bonus, node.quantity)


That didnt work, it still removed the Catagories, and without the catagories, theres no spells, so it removed the spells again

Spells.png



these 3, catagories within the spell book, are required for the spells, and they remove when morphing, and i tested it without them books showing, one of the passives in spellbook give a buff when u have it, but when u morph the buff goes and so does all the catagories
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
...yes you have to make those categories permanent too. Every ability. Including the spellbook abilities.

When a unit morphs, every ability you have not used the make permanent function on will be removed. EVERY ABILITY.
 
Level 7
Joined
Nov 6, 2019
Messages
186
...yes you have to make those categories permanent too. Every ability. Including the spellbook abilities.

When a unit morphs, every ability you have not used the make permanent function on will be removed. EVERY ABILITY.

yes but you cant make them perm, as it is 3 abilities within a ability, i tried the first suggestion u said, custom script, that didnt work as there not added via AddAbility, i also tried, the script change of the spell system, that didnt work, and i also tried adding the catagories via item, like the abilities are added, but again that didnt work

EDIT: i got the catagory to add via the spell book system, picking up an item, however even with the spellbook system set to make perm to abilities added, it still removes them from the book when you change form, so the built in spellbook system make perm, doesnt work or is wrong

so this did not make the ability from item perm

JASS:
    private function Action takes nothing returns nothing
       
        local integer i = GetItemTypeId( GetManipulatedItem( ) )
        call RemoveItem( GetManipulatedItem( ) )
        call UnitAddAbility( GetTriggerUnit( ) , i:ItemAbility )
        call UnitMakeAbilityPermanent(GetTriggerUnit(), true, i:ItemAbility) //<<<<<<<<<<<<<<<<       
       
    endfunction
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,023
Okay I think you're still not understanding me and there are some additional funky things in play with spell books. Let's take a step back and talk through it from the start:
  • If a unit has a spell in the OE and it morphs into a unit that does not have that spell in the OE it will lose the ability (and regain it when morphing back)
  • If a unit has a spell added with triggers and morphs into a unit type that does not have that spell in the OE it will lose the ability (and not regain it when morphing back)
  • If the unit morphed into also has the ability in the OE, or UnitMakeAbilityPermanent is used on that ability before morphing it will be retained
    • If the ability is a Spell Book, all of its sub abilities will be lost even though the spell book itself is retained
  • Spell Book sub-abilities can be retained under two conditions:
    • UnitMakeAbilityPermanent was used on the sub-ability prior to the morph (will also be retained when un-morphing)
    • The morphed unit also has the ability in its OE ability list (will be retained during the morph but lost when un-morphing)
Thus, any time you morph a unit you must be sure that all of its current abilities as well as the sub-abilities of any spell book (and sub-abilities of any further spellbooks that are themselves sub-abilities of a spellbook) have had UnitMakeAbilityPermanent called on them. The easiest time to do this is at the time when you add the ability to the unit. This is what my fix for the Abilities System addresses.

Now, I realize that sometimes you add a spellbook that contains other spellbooks which you use to categorize the abilities. The problem is that these sub-spellbooks are not having UnitMakeAbilityPermanent called on them because they are not being directly added to the unit (they are automatically added when the main spellbook is added). To fix this all you have to do is actually use UnitMakeAbilityPermanent on the sub-spellbooks right after you add them. If they are already present on the unit in the OE then you need to call it whenever a unit with those abilities enters the map. Here are triggers that do those things:

  • -------- When you add the spellbook ability --------
  • Set UnitVar = (Triggering Unit) //or however you get the unit
  • Set AbilityVar = (Main Spellbook Ability)
  • Unit - Add AbilityVar to UnitVar
  • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
  • Set AbilityVar = (Sub-Spellbook for Passive Abilities)
  • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
  • Set AbilityVar = (Sub-Spellbook for Active Abilities)
  • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
  • Set AbilityVar = (Sub-Spellbook for Random Abilities)
  • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
    • (Level of Main Spellbook Ability for (Triggering Unit)) greater than 0
  • Actions
    • Set UnitVar = (Triggering Unit) //or however you get the unit
    • Set AbilityVar = (Sub-Spellbook for Passive Abilities)
    • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
    • Set AbilityVar = (Sub-Spellbook for Active Abilities)
    • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
    • Set AbilityVar = (Sub-Spellbook for Random Abilities)
    • Custom script: call UnitMakeAbilityPermanent(udg_UnitVar, true, udg_AbilityVar)
 
Level 7
Joined
Nov 6, 2019
Messages
186
@Pyrogasm

I understood, pretty much everything you said, just u never explained how to make a sub ability Perm, however from the post its same way, which i did, and it worked perfectly, however the abilities added via ability system, are not staying perm, so adding the extra part to the system didnt work, anywho i am gonna try make perm when player picks up that item, but it has 2 ID's does the ability that way, so gonna try both

EDIT: yeah that didnt work, gets error when saving

  • asdad
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Hero manipulating item)) Equal to Druid
          • (Item-type of (Item being manipulated)) Equal to AbilityToAdd
        • Then - Actions
          • Set VariableSet Druid = (Unit-type of (Hero manipulating item))
          • Set VariableSet DruidS1P = AbilityToAdd
          • Custom script: call UnitMakeAbilityPermanent(udg_Druid, true, udg_DruidS1P)
        • Else - Actions
EDIT2: is strange i thought to try get it to make ability perm when you enter a specific region, so i picked up item, went to the region to test it, then morphed, and it still removed the ability

EDIT3: ok i got it working when entering a Region, but most likely players with Morph before going to region so that wont work, but was checking to find out is all :p

EDIT4: I figured a way around this issue to make abilities perm, just alot of work

EDIT5: Now i got that working, to figure out why my hero turns into a raven not a wolf, or a grizzlybear nto a spirit bear
 
Last edited:
Level 7
Joined
Nov 6, 2019
Messages
186
Yes the unit in the function call is a specific unit not a unit type.

Its all good i sorted out the entire spell system, to be perm, Thanx for help on that.

I just to figure out how to fix the morphing, as i said they dont turn into the heros thats set in the ability

So @Pyrogasm any idea how to fix my morpth ability, so it turns into the unit on the spell, as said many times, the Wolf Form turns into a raven, and Bear form turns into a grizzly bear, but both are set to Spirit Wolf and Spirit Bear
 
Last edited:
Status
Not open for further replies.
Top