Spell makes unit dissappear entirely!

Ghoulord

New Member
Reaction score
2
I want to try and get a spell called 'Disguise' that changes the casting unit from its own form into an exact replica of the target unit. I've got the code i'm using here, and am basing it off the Invisiblity spell.

Code:
Disguise Trigger
Events
    Unit - A unit Begins casting an ability
Conditions
    ((Triggering player) is in Humans) Equal to True
    (Ability being cast) Equal to Disguise 
Actions
    Wait 2.00 game-time seconds
    Unit - Replace (Triggering unit) with a (Unit-type of (Targeted unit)) using The old unit's relative life and mana
    Unit - Change color of (Casting unit) to (Color of (Owner of (Targeted unit)))
    Wait 30.00 game-time seconds
    Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The old unit's relative life and mana
    Unit - Change color of (Triggering unit) to (Color of (Owner of (Triggering unit)))

As i say somewhre in this code, the unit vanishes from the map, even after the 30 game time seconds are up. Any suggestions?
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
You use the Triggering unit wrongly. Your second replace action tries to replace the triggering unit (which doesn't exist anymore, because it's already replaced).
First, change Targeted Unit to Target Of Ability Being Cast. (I think Targeted Unit is the wrong reference for this. At least 100% works with Target Of Ability Being Cast)
Then you need to make a variable and store the Target Of Ability Being Cast in it and use this variable, because, afaik, Target Of Ability Being Cast loses it's value after a wait command.
 

Ghoulord

New Member
Reaction score
2
New code here, but now it makes the Target Unit vanish, and leaves the disguised unit as the mimiced target!

Code:
Disguise Trigger
    Events
        Unit - A unit Begins casting an ability
    Conditions
        ((Triggering player) is in Humans) Equal to True
        (Ability being cast) Equal to Disguise 
    Actions
        Set Disguise = (Target unit of ability being cast)
        Wait 2.00 game-time seconds
        Unit - Replace (Casting unit) with a (Unit-type of Disguise) using The old unit's relative life and mana
        Unit - Change color of (Casting unit) to (Color of (Owner of (Target unit of ability being cast)))
        Wait 30.00 game-time seconds
        Unit - Change color of Disguise to (Color of (Owner of (Casting unit)))
        Unit - Replace Disguise with a (Unit-type of (Casting unit)) using The old unit's relative life and mana
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
Code:
Nahkampf-Initialisierung
    Ereignisse
        Unit - A unit Begins casting an ability
    Bedingungen
    Aktionen
        Set DisgCasterType = (Unit-type of (Triggering unit))
        Set Disguise = (Target unit of ability being cast)
        Einheit - Replace (Triggering unit) with a (Unit-type of Disguise) using Alte Einheit: Rel.  life and mana
        Set DisgCaster = (Last replaced unit)
        Wait 5.00 game-time seconds
        Einheit - Replace DisgCaster with a DisgCasterType using Alte Einheit: Rel.  life and mana

This one works. Sorry for the German/English. But I guess you can decrypt it :p
DisgCaster and Disguise are unit variables. DisCasterType is a Unit-Type variable. I don't know if there's a easier way using gui, but that one definately works.
 

Ghoulord

New Member
Reaction score
2
any thoughts on changing the colours too? i mean, your code works fine and everything, but i just need to tweak it so that the colour of the disguised unit matches that of his target. at the minute, it keeps it's colour and then when it changes back it changes the target units colour.
Code:
Disguise Trigger
    Events
        Unit - A unit Begins casting an ability
    Conditions
        ((Triggering player) is in Humans) Equal to True
        (Ability being cast) Equal to Disguise 
    Actions
        Set DisguiseCasterType = (Unit-type of (Triggering unit))
        Set Disguise = (Target unit of ability being cast)
        Wait 2.00 game-time seconds
        Unit - Change color of (Casting unit) to (Color of (Owner of (Target unit of ability being cast)))
        Unit - Replace (Triggering unit) with a (Unit-type of Disguise) using The old unit's relative life and mana
        Set DisguiseCaster = (Last replaced unit)
        Wait 30.00 game-time seconds
        Unit - Change color of Disguise to (Color of (Owner of (Casting unit)))
        Unit - Replace DisguiseCaster with a DisguiseCasterType using The old unit's relative life and mana

oh, and +rep for this part of problem fixed.
 
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