HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A Item Drop System

02-07-2004, 09:02 PM#1
BloodHunter
If you want a great itme drop system, here it is.

function Trig_Item_Drop_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
return false
endif
if ( not ( GetRandomInt(1, 4) == 1 ) ) then
return false
endif
return true
endfunction

function Trig_Item_Drop_Actions takes nothing returns nothing
call TriggerSleepAction( 1.00 )
call CreateItemLoc( ChooseRandomItemBJ(GetUnitLevel(GetTriggerUnit())), GetUnitLoc(GetTriggerUnit()) )
endfunction

//===========================================================================
function InitTrig_Item_Drop takes nothing returns nothing
set gg_trg_Item_Drop = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Drop, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Item_Drop, Condition( function Trig_Item_Drop_Conditions ) )
call TriggerAddAction( gg_trg_Item_Drop, function Trig_Item_Drop_Actions )
endfunction

What this does is give a 25% chance to drop a item the level of the dying unit.
02-08-2004, 09:51 PM#2
Vexorian
IT is not really impressive, has a lot of memory leaks and there is no real reason to make it JASS, also dropping items from spawned units was difficult before blizzard gave us the GetUnitLevel function, now it is too easy