How to Reference Illusions

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,009
Alright so I want to work with illusions for spells. I don't know how to reference them or get them to be reference. I know it's possible, it's been done in DotA for Phantom Lancer.

I want to make it so the illusion can be moved to a certain location or modified or anything like that. Only way I know to create illusions is with the item spell, unfortunately.
 
This one will move the created illusion to the position of the caster (in DotA, the dummy that creates the illusion is probably given a Wand of Illusions ability, it is issued an order of 852274, has a cast range of 99999.00 and the illusion is moved to the position of the caster).
JASS:
function Trig_Melee_Initialization_Conditions takes nothing returns boolean
    return IsUnitIllusion(GetSummonedUnit())
endfunction

function Trig_Melee_Initialization_Actions takes nothing returns nothing
    local unit u = GetSummonedUnit()
    local unit u1 = GetSummoningUnit()
    local real x = GetUnitX (u1)
    local real y = GetUnitY (u1)
    call SetUnitX (u, x)
    call SetUnitY (u, y)
    set u = null
    set u1 = null
endfunction

//===========================================================================
function InitTrig_One takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( t, Condition( function Trig_Melee_Initialization_Conditions ) )
    call TriggerAddAction( t, function Trig_Melee_Initialization_Actions )
endfunction

Generally, refer to the illusion as Summoned Unit.
 
I post here simple trigger example about Phantom Lancer doppenwalk in GUI (example isnt MUI):

  • Phatom Cloak
    • Events
      • Jednostka - A unit starts the effect of ability
    • Conditions
      • (Ability being cast) equals to Phantom Cloak
    • Actions
      • Set PC_caster = (Triggering unit)
      • Unit - Create 1 Dummy [Illusion] for (Owner of PC_caster) at (Position of PC_caster) facing (Facing of PC_caster) degrees
      • Hero - Create Illusion Rod and give it to (Last created unit)
      • Hero - Order (Last created unit) to use (Last created item) on PC_caster
  • Illusion Order
    • Events
      • Jednostka - A unit enters (Playable map area)
    • Conditions
      • ((Entering unit) is an illusion) equals to True
    • Actions
      • Unit - Move (Entering unit) instantly to (Position of PC_caster), facing (Facing of PC_caster) degrees
      • Unit - Order (Entering unit) to Ruch ((Position of PC_caster) offset by 650.00 towards (Facing of PC_caster) degrees)
thats the easiest way, enojy.
 
@watermelon_1234, yeah, I intentionally didn't use GetTriggerUnit(), because I didn't remember which of the Summoner or the Summoned unit it refers to.

@Spinnaker, you can do it with ability too.
  • Unit - Add Wand of Illusions to (Last created unit)
  • Custom script: call IssueTargetOrderById (GetLastCreatedUnit(), 852274, GetTriggerUnit())
 
Level 8
Joined
Sep 7, 2008
Messages
320
I post here simple trigger example about Phantom Lancer doppenwalk in GUI (example isnt MUI):

  • Phatom Cloak
    • Events
      • Jednostka - A unit starts the effect of ability
    • Conditions
      • (Ability being cast) equals to Phantom Cloak
    • Actions
      • Set PC_caster = (Triggering unit)
      • Unit - Create 1 Dummy [Illusion] for (Owner of PC_caster) at (Position of PC_caster) facing (Facing of PC_caster) degrees
      • Hero - Create Illusion Rod and give it to (Last created unit)
      • Hero - Order (Last created unit) to use (Last created item) on PC_caster
  • Illusion Order
    • Events
      • Jednostka - A unit enters (Playable map area)
    • Conditions
      • ((Entering unit) is an illusion) equals to True
    • Actions
      • Unit - Move (Entering unit) instantly to (Position of PC_caster), facing (Facing of PC_caster) degrees
      • Unit - Order (Entering unit) to Ruch ((Position of PC_caster) offset by 650.00 towards (Facing of PC_caster) degrees)
thats the easiest way, enojy.

In entering trigger , you should use check buff conditons .
 
In entering trigger , you should use check buff conditons .

I said i have posted simply way.

PharaoH yeah you got right. ;o

Is there a simple way to apply this to illusions of a specific spell and not all illusions in general?

I have an idea on how to do it, but nothing simple.
Post your intentions, what you exactly want so we can solve your problem perfectly.
 
Status
Not open for further replies.
Top