afisakov
You can change this now in User CP.
- Reaction score
- 37
I want to make it so that when a unit casts mirror image, the player automatically has both the casting hero and the images selected at the end of the ability.
This way the enemy can't spot real hero as the only one running away, and u don't get stuck behind ur images.
The default on this map is that only the hero is selected, not the images, so they tend to get in the way.
I have tried to make it myself, but game crashes from my version, maybe you can tell me where I went wrong?
P.S.
When I did it without the wait, it just did nothing, prob because images were not made yet (perhaps casting time of spell itself?)
Thank you in advance for the help
This way the enemy can't spot real hero as the only one running away, and u don't get stuck behind ur images.
The default on this map is that only the hero is selected, not the images, so they tend to get in the way.
I have tried to make it myself, but game crashes from my version, maybe you can tell me where I went wrong?
Code:
function Trig_2mir_Conditions takes nothing returns boolean
return (GetSpellAbilityId()=='A004') or (GetSpellAbilityId()=='A075')
endfunction
function ilorcaster takes nothing returns boolean
return IsUnitIllusionBJ(GetFilterUnit())
endfunction
function selections takes player p returns nothing
call SelectUnitAddForPlayer(GetEnumUnit(),GetOwningPlayer(GetEnumUnit()))
endfunction
function Trig_2mir_Actions takes nothing returns nothing
call TriggerSleepAction(.5)
set tp1=GetUnitLoc(GetTriggerUnit())
set tg=GetUnitsInRangeOfLocMatching(300,tp1,Condition(function ilorcaster))
call ForGroup(tg,function selections)
call DestroyGroup(tg)
call RemoveLocation(tp1)
endfunction
...
set udg_trigger2mir=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(udg_trigger2mir,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(udg_trigger2mir,Condition(function Trig_2mir_Conditions))
call TriggerAddAction(udg_trigger2mir,function Trig_2mir_Actions)
When I did it without the wait, it just did nothing, prob because images were not made yet (perhaps casting time of spell itself?)
Thank you in advance for the help