Exide
I am amazingly focused right now!
- Reaction score
- 448
Hi.
I'm having trouble preloading items.
I figured that it would be enough to give them to a preplaced unit, and remove them from the unit, when given to him.
Since I have quite a few items I made an index list:
First trigger = index, nothing weird.
Second trigger = Counts items in the index list.
Third trigger applies the items to the PreloadUnit, and removes them straight away.
The problem is, the PreloadUnit isn't removed properly (removed it at the end of Third trigger). So I tried to take out those actions from that trigger, and put them in a trigger that has the event: Elapsed time = 1 sec. When I do that, the unit is removed, but for some strange reason all the items end up on the ground where the unit used to stand.
Ideas on how to fix this (or a better way to preload the items) are greatly appriciated.
EDIT: Problem Solved. I used a Hero instead, and it worked. (Strange, since the normal unit had an inventory, but whatever..)
I'm having trouble preloading items.
I figured that it would be enough to give them to a preplaced unit, and remove them from the unit, when given to him.
Since I have quite a few items I made an index list:
JASS:
function Trig_Item_Index_Actions takes nothing returns nothing
set udg_ItemIntegerIndex[0] = 039;I000039;
set udg_ItemIntegerIndex[1] = 039;I001039;
set udg_ItemIntegerIndex[2] = 039;I002039;
set udg_ItemIntegerIndex[3] = 039;I003039;
set udg_ItemIntegerIndex[4] = 039;I004039;
set udg_ItemIntegerIndex[5] = 039;I005039;
set udg_ItemIntegerIndex[6] = 039;I006039;
set udg_ItemIntegerIndex[7] = 039;I007039;
set udg_ItemIntegerIndex[8] = 039;I008039;
set udg_ItemIntegerIndex[9] = 039;I009039;
set udg_ItemIntegerIndex[10] = 039;I00A039;
set udg_ItemIntegerIndex[11] = 039;I00B039;
set udg_ItemIntegerIndex[12] = 039;I00C039;
set udg_ItemIntegerIndex[13] = 039;I00D039;
set udg_ItemIntegerIndex[14] = 039;I00E039;
set udg_ItemIntegerIndex[15] = 039;I00F039;
set udg_ItemIntegerIndex[16] = 039;I00G039;
set udg_ItemIntegerIndex[17] = 039;I00H039;
set udg_ItemIntegerIndex[18] = 039;I00I039;
set udg_ItemIntegerIndex[19] = 039;I00J039;
set udg_ItemIntegerIndex[20] = 039;I00K039;
set udg_ItemIntegerIndex[21] = 039;I00L039;
set udg_ItemIntegerIndex[22] = 039;I00M039;
set udg_ItemIntegerIndex[23] = 039;I00N039;
endfunction
//===========================================================================
function InitTrig_Item_Index takes nothing returns nothing
set gg_trg_Item_Index = CreateTrigger( )
call TriggerAddAction( gg_trg_Item_Index, function Trig_Item_Index_Actions )
endfunction
JASS:
function Trig_Count_Items_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i == 100
if (udg_ItemIntegerIndex<i> != null) then
set udg_NumberOfItems = udg_NumberOfItems + 1
endif
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Count_Items takes nothing returns nothing
set gg_trg_Count_Items = CreateTrigger( )
call TriggerAddAction( gg_trg_Count_Items, function Trig_Count_Items_Actions )
endfunction
</i>
JASS:
function Trig_Preload_Items_Actions takes nothing returns nothing
local unit u = udg_PreloadUnit
local integer i = 0
local integer end = udg_NumberOfItems
loop
exitwhen i > end
call UnitAddItemById(u, udg_ItemIntegerIndex<i>)
call RemoveItem(UnitItemInSlot(u, 1))
set i = i + 1
endloop
set u = null
endfunction
//===========================================================================
function InitTrig_Preload_Items takes nothing returns nothing
set gg_trg_Preload_Items = CreateTrigger( )
call TriggerAddAction( gg_trg_Preload_Items, function Trig_Preload_Items_Actions )
endfunction
</i>
First trigger = index, nothing weird.
Second trigger = Counts items in the index list.
Third trigger applies the items to the PreloadUnit, and removes them straight away.
The problem is, the PreloadUnit isn't removed properly (removed it at the end of Third trigger). So I tried to take out those actions from that trigger, and put them in a trigger that has the event: Elapsed time = 1 sec. When I do that, the unit is removed, but for some strange reason all the items end up on the ground where the unit used to stand.
Ideas on how to fix this (or a better way to preload the items) are greatly appriciated.
EDIT: Problem Solved. I used a Hero instead, and it worked. (Strange, since the normal unit had an inventory, but whatever..)