Local variables and replacing units..

RedOrb

You can change this now in User CP.
Reaction score
14
Hi all,

I want to use unit - replace to create a temporary transformation. Simply, I only want the triggering unit (which could be one of many units) to be replaced with the transformation unit, and then after a wait of 25 seconds, it would turn back. I realise I could use unit - hide, and perhaps that would be simpler, but I like using unit - replace because of it's utility. Local variables don't hold up here it seems.. It needs to be MUI though.
Any help would be great !
 

vypur85

Hibernate
Reaction score
803
Code:
Morph
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Channel 
    Actions
        Custom script:   local unit udg_unit_var
        Custom script:   local integer i
        Custom script:   set i = GetUnitTypeId(GetTriggerUnit())
        Unit - Replace (Triggering unit) with a Footman using The old unit's relative life and mana
        Set unit_var = (Last replaced unit)
        Selection - Add unit_var to selection
        Wait 3.00 game-time seconds
        Custom script:   call ReplaceUnitBJ( udg_unit_var, i, bj_UNIT_STATE_METHOD_RELATIVE )
        Selection - Add (Last replaced unit) to selection
        Custom script:   set udg_unit_var = null
This seems to work fine.
 

RedOrb

You can change this now in User CP.
Reaction score
14
Code:
Morph
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Channel
    Actions
        Custom script:  local unit udg_unit_var
        Custom script:  local integer i
        Custom script:  set i = GetUnitTypeId(GetTriggerUnit())
        Unit - Replace (Triggering unit) with a Footman using The old unit's relative life and mana
        Set unit_var = (Last replaced unit)
        Selection - Add unit_var to selection
        Wait 3.00 game-time seconds
        Custom script:  call ReplaceUnitBJ( udg_unit_var, i, bj_UNIT_STATE_METHOD_RELATIVE )
        Selection - Add (Last replaced unit) to selection
        Custom script:  set udg_unit_var = null
This seems to work fine.

Thanks Vypur, it works great! =D
 
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