[Solved] Making a Morphing Hero With Custom Spells (for each morph)

So this is gonna be some advanced stuff I imagine

The Ultimate Goal (ignoring limitations)

A hero that can
  • have dozens of abilities to learn (only a few actually creating an actual useable button)
  • these abilities (passives, with no useable button) are just dummies, where most of the complexity happens in trigger editor
  • these abilities once unlocked no longer will be listed to learn
  • Have the ability to morph into a different hero, with a different set of abilities to learn (as well as sharing SOME, which are learned for both when learned by one)
  • The FIRST hero shoots lightning bolts with its attacks (must use unit ability "lightning attack"
  • The SECOND hero uses a custom barrage ability (which is locked behind learning a skill) to fire multiple projectiles (must use a custom barrage ability)

Solutions/Problems
------------------------------
(1)

- Make abilities in spell books. Different spell books being a default on each hero

ISSUE:

- Test: only 1 of the 2 heroes has a spellbook
- morphing first time works (spell book is included and includes all abilities that are supposed to be included)
- when you un-morph,
then morph back some of the abilities are just gone...
- Switches (of the 3 abilities) 1 vs 2 vs 3 showing (always same 1 when only 1, always same 2 when only 2 showing).


honorable mention to the issue: I originally just was going to have both heroes use the same spellbook... but if its the same book the morph full clears it
------------------------------
(2)
-. (technically just 1.5)

ISSUE:

- Having a spell book with spells, if they inherit from the same copied ability - they all cast at once. No matter what variables I change (the order ID and stuff along those lines)
- ... has forced me to NEST my books. such that each spell gets its own book... May be making this VASTLY more complicated...

------------------------------
(3)

- Have Barrage locked behind one of these spell book abilities

ISSUE:

- When morphing, it doesnt properly start the Barrage ability as being disabled. (where i re-enable it if the variable for it is true)
- Made a kludge where learning a skill runs the same trigger that the morph is meant to run - here it properly disables it

------------------------------
(4)

- Make it so learning abilities removes them

ISSUE:
  • Works prior to morph
  • After morph, most things are borked anyway - so hard to test directly
  • once morph goes back to showing all 3, ones it previously hid/removed are shown again


------------------------------
(5)

- Make it so some abilities are locked behind others being finished (have made upgrade "abilities" which increase radius and damage for an ranged cleave ability)

ISSUE:

- I got this almost working at some point... but since i started going crazy trying to fix issue (1), it no longer works at all
------------------------------

What I believe the primary culprit is

EVENTS:

- "A unit begins casting an ability"

CONDITIONS:

- Ability being cast = morph ability

and (I have tried both these conditions seperately)
  • LightningMode == true (is defaulted as true, this same function sets it to false. it is set to true by a similar function which checks if its == to false)
  • Unit == Unmorphed (the thing happening here is that unmorphed, first morphing. Unmorphed is lightning mode = true)

.............

I have many different things after this, but the first one it runs is

- If (Learnt_ExtraMeteors Equal to True) then do (Unit - For (Triggering unit), Ability Extra Meteors 1 , Disable ability: False, Hide UI: False) else do (Unit - For (Triggering unit), Ability Extra Meteors 1 , Disable ability: True, Hide UI: True)

This is the code i refer to in (3) where the kludge using (learn skill) works properly. Hence why I believe this function as a whole is somehow the culprit.
------------------------------

Included is the map I have been doing this on. It is driving me mad. I have spent over a dozen hours trying to get this working.

I substituted my custom model for a basic one (Archimonde)


NOTES:

  • anywhere you see me adding an ability via trigger, did not originally occur. I only attempted that after not including it didnt work...
  • Most relevant abilities (the ones that trigger editor has you "learn" an "actual" ability from are under Orc (I used farsight as my basic spell because I couldnt get any of the instant charge use ones from items to work...)
  • Hero is Undead->Custom->Hero
  • Morph is based off Bear Form
------------------------------
ALSO

Question: Why have half of these decided not to be formatted as bullet points...

I already had to start by doing "- ." as a first bullet point because I am aware that it doesnt even count the first one. So i can do that then edit and delete it once theyve been made to bullet points...
------------------------------

*****************************
EDIT --- SOLVED
*****************************



The big issue was that when morphing, the "triggering unit" was equal to the previous form. So when i removed abilities from the previous form, it wouldnt remove them from the new form you just morphed into

The fix to this is quite a bit of a kludge. In that, it wont work if you want to have multiple instances of this hero (Which isnt a problem for me, but might be for anyone who is searching and finds this post)

I made 2 unit variables, Form1 and Form2.

When you first morph (from initial to 2nd form), it captures the triggering unit and stores it in Form1.
Then when you morph from the secondary back to the initial, it captures the triggering unit as Form2.

This allows me to remove abilities from Form2 (Instead of "triggering unit) when morphing to the secondary form a 2nd time. Which is precisely when the issue has occurred.

Some of the other issues I had here might still exist. I have started working mostly from the ground up to try and get this working.

Most i believe are entirely just a result of this though


EDIT 2:

issue (1) came up again. The spellbooks (the 3 inside the main one) shared a Data -Order ID.
 

Attachments

  • PleaseHelpMe5.w3m
    32.4 KB · Views: 1
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
You likely need to make abilities permanent, or the spellbook that houses them.

Also, here's some examples of morphing heroes with alternate abilities, maybe it'd interest you?
 
Top