Metamorphosis.

Ryuu

I am back with Chocolate (:
Reaction score
64
Hello, this is not a problem, but rather a 'how?' thread.
You see, my old unit has this ability x, but my new unit has the ability y.
y replaces x when the unit has morphed.
x and y are both supposed to have the same level.

But how do I make it that way?
 

Avaleirra

Is back. Probably.
Reaction score
128
Event
a unit starts the effect of an ability
condition
ability equal to Metamorphosis
actions
add " spell y" to triggering unit
set level of "spell y" to level of "spell x" for triggering unit
remove "spell y" from triggering unit



This is just a guess. Sorry for the freehand

avaleirra
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Nope, it doesnt work. For some reason when I morph the ability y didnt appear at all.
 

Avaleirra

Is back. Probably.
Reaction score
128
Really? Try adding spell y to the metamorphosis unit in the OE. Then remove the line
add ability spell y.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Nope, it doesnt work. For some reason regardless or not i have the ability x, y still appears. My main purpose was to put y the same level as x. But in this case, even when I did not have x on the old unit, the new unit still has y.
 

Joccaren

You can change this now in User CP.
Reaction score
54
Check if the level of x is greater than zero before adding y?
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Nope, still didn't work. y was added at all, regardless or not if x was level 1 or 100.

My current code:

Trigger:
  • spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Metamorphosis
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of x for (Triggering unit)) Greater than 0
        • Then - Actions
          • Unit - Add y to (Triggering unit)
        • Else - Actions
      • Unit - Set level of y for (Triggering unit) to (Level of x for (Triggering unit))
      • Unit - Remove x from (Triggering unit)
 

Avaleirra

Is back. Probably.
Reaction score
128
put the last 2 actions under the "then-actions" although I'm not sure if that will do anything.
 

reyghost

New Member
Reaction score
14
Hi, Im not sure but I dont think you can use triggering unit to refer to the unit before morphing and after; as metamorphosis uses 2 diferent units, probably triggering unit will refer to the unit that actually casts the spell wich is the unit supposed to have x ability,but after that it morphs to another units,doesnt matter how similar to the first one it is,and therefore triggering unit will not refer to the desired one.
Anyone with more knowledge can confirm this ?
 

tooltiperror

Super Moderator
Reaction score
231
Metamorphosis replaces the unit with a new unit with the same items and relative health and mana, waits a period of time, then brings the original unit back.

I think you need to set the new unit in a variable somehow, but I'm not sure.
 

Avaleirra

Is back. Probably.
Reaction score
128
I thought of that, but apparently adding spell y to the metamorphosis unit in OE doesn't work.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Both units can be referred to by the same variables, it should. I remembered looking in to a map and seeing this ..
 

the_ideal

user title
Reaction score
61
I can't figure out why it doesn't work, but here's a troubleshooting tip:
Try to do this same thing but with an ability other than metamorphosis. If it works, then the problem is with the way Warcraft III "thinks" about metamorphosis. If it still doesn't work, then the problem is with the code.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Use "unit finishes casting an ability" instead, because that's the point at which it has changed into the new unit-type.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Right, I'm kind of a noob if you would excuse me.
Anyway, I've made this:

Trigger:
  • trigger 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Metamorphosis
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MUIsetting Equal to 8000
        • Then - Actions
          • Set MUIsetting = 0
        • Else - Actions
          • Set MUIsetting = (MUIsetting + 1)
      • Set CastingUnit[MUIsetting] = (Triggering unit)
      • Set Level_of_x[MUIsetting] = (Level of x for CastingUnit[MUIsetting])


Trigger:
  • trigger 2
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Metamorphosis
    • Actions
      • For each (Integer A) from 1 to MUIsetting, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CastingUnit[(Integer A)] Equal to (Triggering unit)
            • Then - Actions
              • Unit - Add y to (Triggering unit)
              • Unit - Set level of y for (Triggering unit) to Level_of_x[(Integer A)]
            • Else - Actions


Unfortunately, that still didn't work.
y was added, regardless or not if x was level 1 or 100.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
This should do:

Trigger:
  • Morph Ability Swap
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Metamorphosis
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of X for (Triggering unit)) Greater than 0
        • Then - Actions
          • Unit - Add Y to (Triggering unit)
          • Unit - Set level of Y for (Triggering unit) to (Level of X for (Triggering unit))
          • Unit - Remove X from (Triggering unit)
        • Else - Actions
          • Unit - Add X to (Triggering unit)
          • Unit - Set level of X for (Triggering unit) to (Level of Y for (Triggering unit))
          • Unit - Remove Y from (Triggering unit)
 

Ryuu

I am back with Chocolate (:
Reaction score
64
Sorry to say once again, this didn't work.
Again, the ability y was added, regardless or not if the original unit has x.

However, Weep, I would like to question you on this point:

Code:
          Then - Actions
                Unit - Add Y to (Triggering unit)
                Unit - Set level of Y for (Triggering unit) to (Level of X for (Triggering unit))
                Unit - Remove X from (Triggering unit)
          Else - Actions
                Unit - Add Y to (Triggering unit)
                Unit - Set level of Y for (Triggering unit) to (Level of X for (Triggering unit))
                Unit - Remove X from (Triggering unit)

Did you realise that the Else - Actions is actually a repeat of Then - Actions ?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Sorry to say once again, this didn't work.
Again, the ability y was added, regardless or not if the original unit has x.
What kind of ability is X, unit or hero? Do both forms of the unit have it by default? (That is, does the unit retain X after morphing without the trigger?)

If not, it'll be harder to retain the unit's level of the ability.

Did you realise that the Else - Actions is actually a repeat of Then - Actions ?
My mistake. Edited.
 

Ryuu

I am back with Chocolate (:
Reaction score
64
> What kind of ability is X, unit or hero?

x is a hero ability. y is a unit ability.​

> Do both forms of the unit have it by default? (That is, does the unit retain X after morphing without the trigger?)

Yeah, it does without the trigger. However, that isn't my intention.​
 

vypur85

Hibernate
Reaction score
803
Code:
Event
 A unit starts the effect of an ability
Condition
 Ability being cast Equal to Metamorphosis
Actions
 If then else
  Condition
    Unit-type of (Triggering unit) Equal to YourNormalUnitType
  Then - Action
    Unit - Add Ability Y to (Triggering unit)
    Unit - Set level of Ability Y to level of Ability X...
    Player - Disable Ability X for (Owner of (Triggering unit))
  Else - Action
    Player - Enable Ability X for (Owner of (Triggering unit))
    Unit - Remove Ability Y to (Triggering unit)

Try this. Not sure if it works. It's MPI though. And while morphed, the Ability X cannot be leveled.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top