- Joined
- Jun 1, 2007
- Messages
- 98
I've been trying to get this to work but every attempt fails:
I want to make it so that it creates a unit in front of the triggering unit when he uses the Snowball item.
Here is the thing which fires it off:
An image of the object:
JASS:
function MakeUnit takes unit u, integer unitID returns nothing
local real unitx = GetUnitX( u )
local real unity = GetUnitY( u )
local real unitfacing = GetUnitFacing( u )
call CreateUnit( GetOwningPlayer( u ), unitID, unitx, unity, unitfacing )
endfunction
function Snowball takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer unitID = 'B001'
call MakeUnit( u, unitID )
set u = null
endfunction
I want to make it so that it creates a unit in front of the triggering unit when he uses the Snowball item.
Here is the thing which fires it off:
JASS:
function Snowball_Conditions takes nothing returns boolean
if ( not( GetItemTypeId( GetManipulatedItem()) == 'I000' ) ) then
return false
endif
return true
endfunction
function InitTrig_Snowball takes nothing returns nothing
set gg_trg_Snowball = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Snowball, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( gg_trg_Snowball, Condition( function Snowball_Conditions ) )
call TriggerAddAction( gg_trg_Snowball, function Snowball )
endfunction
An image of the object:
