change owner and the change back?

Grymlax

Probably not around
Reaction score
138
this should be a really simple trigger but i'm new with the editor.

okey i'm doing a spell which changes the ownership of a unit for x seconds and then change it back. the problem i got is when i'm trying to change the unit back to the original owner, then nothing happends.

This is a simple version of my trigger:

Code:
Possession
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Possession
    Actions
        Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Retain color
        Wait 10.00 seconds
        Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Target unit of ability being cast)) and Retain color

it doesn't work either if i change the
Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Target unit of ability being cast)) and Retain color

to
Unit - Change ownership of (Target unit of ability being cast) to (Previous owner) and Retain color

or
Unit - Change ownership of (Ownership-changed unit) to (Previous owner) and Retain color

help would be apprieciated.

thx
//Grymlax
 

Tinki3

Special Member
Reaction score
418
Use a player-type variable to initially store the owner of the target unit,
which you can then use later to refer back to:

Code:
Set TargOwner = (Owner of (Target unit of ability being cast))
...
Unit - Change ownership of (Target unit of ability being cast) to TargOwner and Retain color

You might also want to store the target unit into a variable to prevent data-loss.
 

Grymlax

Probably not around
Reaction score
138
ok thx

thx guys i will try that tomorrow right now it's 2.20 am in sweden
 

Grymlax

Probably not around
Reaction score
138
my trigger now looks like this
Code:
 possession
    Events
        Unit - A unit Begins casting an Ability
    Conditions
        (Ability being cast) Equal to possession
    Actions
        Set PossessionP = (Owner of (Target unit of ability being cast))
        Set possessionU = (Target unit of ability being cast)
        Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Triggering unit)) and Retain color
        Wait 10.00 seconds
        Unit - Change ownership of possessionU to PossessionP and Retain color

is this enough or do i need to reset the variables somehow after the spell is finished??
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top