i posted an askin for help in the map forum about how to do something, and got the tips to try to write the trigger in JASS instead, problem is i have never used JASS so i have done my best to get this to work after the help i got in the map forum.
what i want to do is so when a unit dies it creates an item for the weapon he carried at his corpse, and that the item dissapears after about 20 seconds.
however i cant get my script to work, if someone can point out what i did wrong and how it should be done i would be very gratefull, cause i tried and tried different scripts for about 1 hour and cant seem to understand JASS and what im doing wrong fully.
my "script" is however like this:
what i want to do is so when a unit dies it creates an item for the weapon he carried at his corpse, and that the item dissapears after about 20 seconds.
however i cant get my script to work, if someone can point out what i did wrong and how it should be done i would be very gratefull, cause i tried and tried different scripts for about 1 hour and cant seem to understand JASS and what im doing wrong fully.
my "script" is however like this:
Code:
function Trig_item_Func001C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetDyingUnit()) == 'h00C' ) ) then
return false
endif
return true
endfunction
function Trig_item_Func002C takes nothing returns boolean
if ( not ( GetUnitTypeId(GetDyingUnit()) == 'h00A' ) ) then
return false
endif
return true
endfunction
function Trig_item_Func005001 takes nothing returns boolean
local item i
return ( CheckItemStatus(i, bj_ITEM_STATUS_OWNED) == true )
endfunction
function Trig_item_Actions takes nothing returns nothing
local item i=GetLastCreatedItem()
if ( Trig_item_Func001C() ) then
call CreateItemLoc( 'I009', GetUnitLoc(GetDyingUnit()) )
else
endif
if ( Trig_item_Func002C() ) then
call CreateItemLoc( 'I00B', GetUnitLoc(GetDyingUnit()) )
else
endif
set i= GetLastCreatedItem()
call TriggerSleepAction( 2.00 )
if ( Trig_item_Func005001() ) then
call DoNothing( )
else
call RemoveItem( i )
endif
endfunction
//===========================================================================
function InitTrig_item takes nothing returns nothing
set gg_trg_item = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_item, Player(1), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_item, function Trig_item_Actions )
endfunction