- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, i am trying to create an item just like scroll of protection but which give s frost armor to unit in 900 radius. To do this possible i created 1 item, and 2 abilities.
Item - Ice Path
Dummy Ability 1 - Thunder clan (when the hero uses this ability it triggers the code and calls the dummy unit). This ability also provides the item with an unique cold down time and prevents bugs [i think].
Dummy ability 2 - The frost Armor. the dummy unit will cast this ability in friendly units. It needs to be a different ability because it must not have mana cost and the duration time is different.
But somehow i have several errors in my script code and i don't know how to correct them ... i am the first to admit i have a lot to learn about AOE JASS spells.
Anyway here is the code:
As you can see when the hero uses the item this code is fired. The codes picks all allied units in a 900 AOE and gives them frost armor.
The main error is: Cannot convert unit to location .... ( i make no idea what this means). Anyway plz help ...
Item - Ice Path
Dummy Ability 1 - Thunder clan (when the hero uses this ability it triggers the code and calls the dummy unit). This ability also provides the item with an unique cold down time and prevents bugs [i think].
Dummy ability 2 - The frost Armor. the dummy unit will cast this ability in friendly units. It needs to be a different ability because it must not have mana cost and the duration time is different.
But somehow i have several errors in my script code and i don't know how to correct them ... i am the first to admit i have a lot to learn about AOE JASS spells.
Anyway here is the code:
JASS:
function IcePath_Conds takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'I012'
endfunction
//================================================================
function IcePath_Acts takes nothing returns nothing
local group Targets = CreateGroup()
local unit vic
local unit caster = GetTriggerUnit()
local unit dummmy
call GroupEnumUnitsInRange( Targets, GetLocationX( caster ), GetLocationY( caster ), 900, Filter(null) )
loop
set vic = FirstOfGroup( Targets )
exitwhen vic==null
if IsUnitAlly(vic, GetOwningPlayer(caster)) then
set dummmy = CreateUnit(GetOwningPlayer(caster), 'h01H', GetUnitX(vic), GetUnitY(vic), 0)
call UnitAddAbility(dummmy, 'A043')
call IssueTargetOrder(dummmy, "frostarmor", vic)
call UnitApplyTimedLife(dummmy, 'BTLF', 2.5)
endif
call GroupRemoveUnit(Targets,vic)
endloop
call DestroyGroup(Targets)
set Targets = null
set caster = null
set dummmy = null
endfunction
//===========================================================================
function InitTrig_Ice_Path takes nothing returns nothing
local trigger IcePath = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( IcePath, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( IcePath, Condition( function IcePath_Conds) )
call TriggerAddAction( IcePath, function IcePath_Acts )
endfunction
As you can see when the hero uses the item this code is fired. The codes picks all allied units in a 900 AOE and gives them frost armor.
The main error is: Cannot convert unit to location .... ( i make no idea what this means). Anyway plz help ...