Need help with creating/replacing (specific) units

Status
Not open for further replies.
I am trying to make a shadow form spell for a druid hero on one of my maps. The way I have tried going about it is the following:



I tried using the "replace unit" and then set last replaced unit to a variable. The problem I have is that I can't replace it back, I can only create/replace to unit types, not unit variables. That fucks up the level progress etc. of the hero. Any easy way to go about this?
I thought maybe I could remove the new unit and create the correct unit variable for the old unit but again, it seems I can only create unit types, not unit variables. That's horribly stupid.



I have also tried using the bear form spell, but it makes my hero unable to choose any spells when it levels up? Also will the alternate form unit of this adhere to the variables that was set to the normal form unit?
 
Have you tried using this method? Hero passive transformation

Thanks this worked, however, now I am having a problem of saving the abilities and ability levels. When I morph I want new abilities for my morph unit, but I just have the old abilities. In addition to that I have to re-learn every ability whenever I morph.

I already know how to add/remove abilities and set their level, including saving a specific ability to an integer and adding it back to the hero. My method is extremely ineffective though, and would require an insane amount of different variations of the trigger I am using. Till now I have tried the following:

Setting variable to ability levels

Code:
Fanofknives level 1
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Fan of Knives
        (Level of Fan of Knives for (Triggering unit)) Equal to 1
    Actions
        Set fanofknivestest = (Ability being cast)


Fanofknives level 2
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Fan of Knives
        (Level of Fan of Knives for (Triggering unit)) Equal to 2
    Actions
        Set fanofknivestest2 = (Ability being cast)

etc..

And then:

Morphing to shadowform and removing the ability fan of knives:


Code:
To shadowform 1
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Shadow Form (1)
        (Level of Fan of Knives for (Triggering unit)) Equal to 1
    Actions
        Unit - Add Shadow form to (Triggering unit)
        Unit - Remove Shadow form from (Triggering unit)
        Unit - Remove fanofknivestest from (Triggering unit)
        Animation - Change (Triggering unit)'s vertex coloring to (10.00%, 10.00%, 10.00%) with 30.00% transparency



morphing back and adding the correct level of fan of knives:

Code:
To druidform 1
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Shadow Form (1)
        (Level of Fan of Knives for (Triggering unit)) Equal to 1
    Actions
        Unit - Add Druid form  to (Triggering unit)
        Unit - Remove Druid form  from (Triggering unit)
        Unit - Add fanofknivestest to (Triggering unit)
        Unit - Set level of fanofknivestest for (Triggering unit) to 1
        Animation - Change (Triggering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency


This works if my hero is just going to have one ability, but obviously I want the hero to have mroe. So then with the way I have in mind I would add more conditions for every single spell level combination of four spells. If I want 5 spell levels for 2 of the spells, 3 levels for 1 and 2 levels for the last spell then that leaves me with thousands of combinations, and it would take me months to make the correct triggers for this one simple spell :p

Surely there is a simpler way than this, with some arrays but I am not that advanced, and I do not fully understand the concept of array variables.
 
Last edited:
Status
Not open for further replies.
Top