- Joined
- Sep 19, 2006
- Messages
- 152
I'm just starting out in JASS, and patience isn't really my strong point. At any rate, I'm working on a one-time self-destroying trigger to create any one of six items at a select location. Originally I used an array to define these 6 items, such as SpecialItem[1] - SpecialItem[6], but it seems an overkill use of an array. Now I've trying building an itempool then selecting an item from this group, but there seems to exist some confusion between "item" and "item-type". I've written "INSERT VARIABLE HERE" to indicate where this value should be, but I can find no information on it. Any help would be much appreciated.
On a side-note, I've just used "0" in place of the "item weight" portion of the item pool functions, simply because I don't really know what it's asking for.
function CreepsDeath_Event01 takes nothing returns boolean
if ( not ( GetRandomInt(1, 100) == 1 ) ) then
return false
endif
return true
endfunction
function CreepsDeath_Condition01 takes nothing returns boolean
if ( not CreepsDeath_Event01() ) then
return false
endif
return true
endfunction
function CreepsDeath_Action01 takes nothing returns nothing
local itempool UniqueItemGroup
call ItemPoolAddItemType(UniqueItemGroup,shea,0)
call ItemPoolAddItemType(UniqueItemGroup,rwiz,0)
call ItemPoolAddItemType(UniqueItemGroup,I04N,0)
call ItemPoolAddItemType(UniqueItemGroup,rpsh,0)
call ItemPoolAddItemType(UniqueItemGroup,fwss,0)
call ItemPoolAddItemType(UniqueItemGroup,skul,0)
endfunction
function CreepsDeath_Action02 takes nothing returns nothing
local unit DyingUnit = GetDyingUnit()
local location DyingUnitPoint = GetUnitLoc(DyingUnit)
call CreateItemLoc ---- INSERT VARIABLE HERE ----, DyingUnitPoint)
call RemoveLocation (DyingUnitPoint)
set DyingUnit = null
call DestroyTrigger (gg_trg_CreepsDeathUnique )
endfunction
//====================================================
function InitTrig_CreepsDeathUnique takes nothing returns nothing
set gg_trg_CreepsDeathUnique = CreateTrigger( )
call DisableTrigger (gg_trg_CreepsDeathUnique)
call TriggerRegisterPlayerUnitEventSimple(gg_trg_CreepsDeathUnique, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition (gg_trg_CreepsDeathUnique, Condition( function CreepsDeath_Condition01) )
call TriggerAddAction (gg_trg_CreepsDeathUnique, function CreepsDeath_Action01)
call TriggerAddAction (gg_trg_CreepsDeathUnique, function CreepsDeath_Action02)
endfunction
On a side-note, I've just used "0" in place of the "item weight" portion of the item pool functions, simply because I don't really know what it's asking for.
function CreepsDeath_Event01 takes nothing returns boolean
if ( not ( GetRandomInt(1, 100) == 1 ) ) then
return false
endif
return true
endfunction
function CreepsDeath_Condition01 takes nothing returns boolean
if ( not CreepsDeath_Event01() ) then
return false
endif
return true
endfunction
function CreepsDeath_Action01 takes nothing returns nothing
local itempool UniqueItemGroup
call ItemPoolAddItemType(UniqueItemGroup,shea,0)
call ItemPoolAddItemType(UniqueItemGroup,rwiz,0)
call ItemPoolAddItemType(UniqueItemGroup,I04N,0)
call ItemPoolAddItemType(UniqueItemGroup,rpsh,0)
call ItemPoolAddItemType(UniqueItemGroup,fwss,0)
call ItemPoolAddItemType(UniqueItemGroup,skul,0)
endfunction
function CreepsDeath_Action02 takes nothing returns nothing
local unit DyingUnit = GetDyingUnit()
local location DyingUnitPoint = GetUnitLoc(DyingUnit)
call CreateItemLoc ---- INSERT VARIABLE HERE ----, DyingUnitPoint)
call RemoveLocation (DyingUnitPoint)
set DyingUnit = null
call DestroyTrigger (gg_trg_CreepsDeathUnique )
endfunction
//====================================================
function InitTrig_CreepsDeathUnique takes nothing returns nothing
set gg_trg_CreepsDeathUnique = CreateTrigger( )
call DisableTrigger (gg_trg_CreepsDeathUnique)
call TriggerRegisterPlayerUnitEventSimple(gg_trg_CreepsDeathUnique, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition (gg_trg_CreepsDeathUnique, Condition( function CreepsDeath_Condition01) )
call TriggerAddAction (gg_trg_CreepsDeathUnique, function CreepsDeath_Action01)
call TriggerAddAction (gg_trg_CreepsDeathUnique, function CreepsDeath_Action02)
endfunction