Dirac
22710180
- Reaction score
- 147
JASS:
library Illusion initializer onInit uses/*
*/ RegisterPlayerUnitEvent /* hiveworkshop.com/forums/jass-functions-413/snippet-registerplayerunitevent-203338/
*/ Dummy /* thehelper.net/forums/showthread.php/167231-Dummy
Special thanks:
-Jedi (Detection of new illusions)
***********************************************************************
*
* function UnitCreateIllusionById takes unit whichUnit, player forPlayer, integer abilityId, integer level returns unit
* - The ability must be based off Item Illusion
*
**********************************************************************/
globals
private unit LastCreatedIllusion
endglobals
function UnitCreateIllusion takes unit whichUnit, player forPlayer, integer abilityId, integer level returns unit
call Dummy[abilityId].load()
set Dummy[abilityId].level=level
set Dummy.owner=forPlayer
call Dummy[852274].castOnTarget(whichUnit)
call Dummy[abilityId].unload()
return LastCreatedIllusion
endfunction
private function onCreate takes nothing returns boolean
if Dummy.is(GetSummoningUnit()) then
set LastCreatedIllusion=GetSummonedUnit()
endif
return false
endfunction
private function onInit takes nothing returns nothing
call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SUMMON,function onCreate)
endfunction
endlibrary