- Joined
- Jun 19, 2007
- Messages
- 53
Im new to Jass. Im trying to make a simple trigger where when any unit owned by brown player dies it has a 20% chance to drop an item, of which can be one of the three stat increasing tome (tdex, tint, tstr). So I half GUI half Jass'd this:
So, uh, whats wrong with it.
JASS:
function Trig_ItemDrops_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetDyingUnit()) == Player(11) ) ) then
return false
endif
return true
endfunction
function Condtionz takes integer i returns boolean
if i > 21 then
return false
endif
return true
endfunction
function Trig_ItemDrops_Actions takes nothing returns nothing
local itempool ip
local item i
local integer chance
call ItemPoolAddItemType(ip, 'tdex', 1)
call ItemPoolAddItemType(ip, 'tint', 1)
call ItemPoolAddItemType(ip, 'tstr', 1)
set chance = GetRandomInt(0, 100)
if ( Condtionz(chance) ) then
call PlaceRandomItem(ip, GetLocationX(GetUnitLoc(GetDyingUnit())), GetLocationY(GetUnitLoc(GetDyingUnit())))
else
endif
endfunction
//===========================================================================
function InitTrig_ItemDrops takes nothing returns nothing
set gg_trg_ItemDrops = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ItemDrops, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_ItemDrops, Condition( function Trig_ItemDrops_Conditions ) )
call TriggerAddAction( gg_trg_ItemDrops, function Trig_ItemDrops_Actions )
endfunction
So, uh, whats wrong with it.