• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger Illusions?

Status
Not open for further replies.
Level 25
Joined
Jul 10, 2006
Messages
3,315
I can't seem to find the GUI version I made of this, but the idea is that you create a dummy unit, give it the Item Illusions ability (unit version), and use this custom script to make it cast on your target:
  • Custom script: call IssueTargetOrderById(udg_DummyUnit, 852274, udg_TargetUnit)
If you're using newgen, here's the vjass:
JASS:
library CreateIllusion initializer Init
    globals
        private unit IllusionCaster
        private constant integer IllusionAbility =   'A000'  //item illusion
        private constant integer IllusionUnit    =   'nalb'  //dummy caster
        private boolean IsIllusion                  //used for checking if the illusion was made by system
        unit LastCreatedIllusion                    //as at any time to reference the last illusion made by system
        real IllusionCreatedEvent                   //use to detect when an illusion is created
    endglobals
    
    function UnitCreateIllusion takes unit u returns nothing
        call SetUnitX(IllusionCaster, GetUnitX(u))
        call SetUnitY(IllusionCaster, GetUnitY(u))
        call SetUnitOwner(IllusionCaster, GetOwningPlayer(u), false)
        call IssueTargetOrderById(IllusionCaster, 852274, u)
        call SetUnitOwner(IllusionCaster, Player(15), false)
        set IsIllusion = true
    endfunction
    
    private function GetIllusion takes nothing returns nothing
        if IsIllusion then
            set LastCreatedIllusion = GetTriggerUnit()
            set IllusionCreatedEvent = 0
            set IllusionCreatedEvent = 1
        endif
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local region r = CreateRegion()
        call RegionAddRect(r, GetPlayableMapRect())
        set IllusionCaster = CreateUnit(Player(15), IllusionUnit, 0, 0, 0)
        call UnitAddAbility(IllusionCaster, IllusionAbility)
        call ShowUnit(IllusionCaster, false)
        call TriggerAddAction(t, function GetIllusion)
        call TriggerRegisterEnterRegion( t, r, null )
    endfunction
endlibrary

And how to use:
  • test select
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Custom script: call UnitCreateIllusion(GetTriggerUnit())
The system was also meant to save the created illusion to an event, but I never got around to fixing that part. The illusion creating works fine, though.
 
Level 7
Joined
Nov 18, 2012
Messages
272
I can't seem to find the GUI version I made of this, but the idea is that you create a dummy unit, give it the Item Illusions ability (unit version), and use this custom script to make it cast on your target:
  • Custom script: call IssueTargetOrderById(udg_DummyUnit, 852274, udg_TargetUnit)

You mean Item Illusions for units?

And do udg_LastCreatedUnit and udg_PickedUnit work?
 
Status
Not open for further replies.
Top