library ItemDrop
globals
private hashtable H = InitHashtable()
endglobals
//
function chance takes integer i returns boolean
return GetRandomInt(0,100) <= i
endfunction
//
function additem takes integer i,integer ch,integer itemdata returns nothing
call SaveInteger(H,i,ch,itemdata)
endfunction
//
function getitem takes integer i,integer ch returns integer
local integer it = LoadInteger(H,i,ch)
return it
endfunction
//
function destroy takes integer i returns nothing
call FlushChildHashtable(H,i)
endfunction
//
endlibrary
//
test
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Set u = Peasant 0002 <gen>
Custom script: call additem(GetUnitTypeId(udg_u),0,'afac')
Custom script: call additem(GetUnitTypeId(udg_u),1,'spsh')
//
test 1
Events
Unit - A unit Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(chance(100))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(chance(70))
Then - Actions
Item - Create (getitem(GetUnitTypeId(GetTriggerUnit()),0)) at (Position of (Triggering unit))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(chance(30))
Then - Actions
Item - Create (getitem(GetUnitTypeId(GetTriggerUnit()),1)) at (Position of (Triggering unit))
Else - Actions
Else - Actions