- Joined
- Dec 15, 2011
- Messages
- 1,423
Back then me and some other guys (Mag, Ruke, lfh, Nestharus, Purge) are quite enthusiastic about making an Item Indexer that functions essentially similiar to a Unit Indexer. I guess we didn't make it in the end because there wasn't a proper way to index items seamlessly like you can do with units. However, we are able to discover a (apparently perfect) way to handle deindexing for preplaced items. There wasn't The Lab at that time so the idea kinda got buried.
Today I somehow remembered about this and decided to bring it up again with hope that maybe we can finally have a true Item Indexer. Or at least this can prove useful in some other ways for people.
Here is a test script, attached below is a test map.
This method handles all possible situations that can cause a preplaced item to "disappear" from the map, namely:
You will be needing an Event Recycler to handle event leaks caused by this method (tested by lfh here). You can find more details and information here (read from page 1 to 3).
edit
Sorry for the long title. I am unable to come up with another that is short but informative enough.
Today I somehow remembered about this and decided to bring it up again with hope that maybe we can finally have a true Item Indexer. Or at least this can prove useful in some other ways for people.
Here is a test script, attached below is a test map.
JASS:
globals
trigger t = CreateTrigger()
endglobals
module OnInit
static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
struct Test extends array
private static method onEsc takes nothing returns nothing
call RemoveItem(gg_item_ratf_0010)
endmethod
private static method callBack takes nothing returns boolean
call BJDebugMsg("Deindexed")
return false
endmethod
private static method addItem takes nothing returns nothing
call TriggerRegisterDeathEvent(t, GetEnumItem())
endmethod
static method init takes nothing returns nothing
local trigger t1 = CreateTrigger()
call TriggerRegisterPlayerEvent(t1, Player(0), EVENT_PLAYER_END_CINEMATIC)
call TriggerAddAction(t1, function thistype.onEsc)
call EnumItemsInRect(bj_mapInitialPlayableArea, null, function thistype.addItem)
call TriggerAddCondition(t, function thistype.callBack)
set t1 = null
endmethod
implement OnInit
endstruct
This method handles all possible situations that can cause a preplaced item to "disappear" from the map, namely:
- Remove Item.
- Kill Item.
- Sell Item.
- Tome Usage.
- Consumable Items.
- Charged Items.
You will be needing an Event Recycler to handle event leaks caused by this method (tested by lfh here). You can find more details and information here (read from page 1 to 3).
edit
Sorry for the long title. I am unable to come up with another that is short but informative enough.