- Joined
- Jan 30, 2013
- Messages
- 12,878
Someone's been cooking really good lately 
set TIR_DebugMode = False from TimedItemRemover Init Trigger if you're going to use this in your map. I intentionally left it as "True" in the testmap for testing purposes.Unit - A unit Loses an item event will detect when a tome or a rune is used. This way, the trigger will register the dropped invisible tome and rune, then remove them properly. Although not immediately, it gets the job done.
How to use

Events

Conditions

Actions


-------- ------------------------------------------------------------------------ --------


-------- How to use the system --------


-------- ------------------------------------------------------------------------ --------


-------- This will be the item you want to register --------


Set TIR_Item = (Item being manipulated)


-------- ------------------------------------------------------------------------ --------


-------- This will be the duration before the item gets killed --------


Set TIR_Duration = 5.00


-------- ------------------------------------------------------------------------ --------


-------- This will register previous variables into the system --------


Trigger - Run TIR_Register (ignoring conditions)


-------- ------------------------------------------------------------------------ --------
Item Drop

Events


Unit - A unit Loses an item

Conditions

Actions


-------- - --------


Set TIR_Item = (Item being manipulated)


Set TIR_Duration = 5.00


Trigger - Run TIR_Register (ignoring conditions)


-------- - --------
Loot

Events


Unit - A unit Dies

Conditions


(Owner of (Triggering unit)) Equal to Player 2 (Blue)


(Unit-type of (Triggering unit)) Not equal to Peon

Actions


Set TIR_TempLoc = (Position of (Triggering unit))


-------- - --------


Item - Create (Random level 3 item-type) at TIR_TempLoc


Set TIR_Item = (Last created item)


Set TIR_Duration = -1.50


Trigger - Run TIR_Register (ignoring conditions)


-------- - --------


Custom script: call RemoveLocation(udg_TIR_TempLoc)
TomeRune Specific Loot

Events


Unit - A unit Dies

Conditions


(Owner of (Triggering unit)) Equal to Player 2 (Blue)


(Unit-type of (Triggering unit)) Equal to Peon

Actions


Set TIR_TempLoc = (Position of (Triggering unit))


-------- - --------


If ((Random integer number between 1 and 2) Equal to 1) then do (Item - Create Tome of Power at TIR_TempLoc) else do (Item - Create Rune of Dispel Magic at TIR_TempLoc)


Set TIR_Item = (Last created item)


Set TIR_Duration = 10.00


Trigger - Run TIR_Register (ignoring conditions)


-------- - --------


Custom script: call RemoveLocation(udg_TIR_TempLoc)
Custom Created Item

Events


Player - Player 1 (Red) types a chat message containing -i as An exact match

Conditions

Actions


Set TIR_TempLoc = (Center of (Playable map area))


-------- - --------


Item - Create (Random level 1 item-type) at TIR_TempLoc


Set TIR_Item = (Last created item)


Set TIR_Duration = 5.00


Trigger - Run TIR_Register (ignoring conditions)


-------- - --------


Custom script: call RemoveLocation(udg_TIR_TempLoc)
Mask of Death

Events


Player - Player 1 (Red) types a chat message containing -register mod as An exact match

Conditions

Actions


-------- - --------


Set TIR_Item = Mask of Death 0035 <gen>


Set TIR_Duration = 5.00


Trigger - Run TIR_Register (ignoring conditions)


-------- - --------


Trigger - Turn off (This trigger)
TimedItemRemover Init

Events


Map initialization

Conditions

Actions


-------- ------------------------------------------------------------------------------------------------------------------ --------


-------- Configuration --------


-------- I would advise not to change any of this unless you know what you're doing --------


-------- ------------------------------------------------------------------------------------------------------------------ --------


-------- The interval value used by the system to update counter periodically --------


Set TIR_Interval = 0.50


-------- ------------------------------------------------------------------------------------------------------------------ --------


-------- This value will determine the time required for the items to be able --------


-------- to show their dead animation first before they get removed --------


Set TIR_Timeout = 1.50


-------- ------------------------------------------------------------------------------------------------------------------ --------


-------- The trigger used to register an instance --------


Set TIR_Register = TimedItemRemover <gen>


-------- ------------------------------------------------------------------------------------------------------------------ --------


-------- The trigger used to loop through every instance --------


Set TIR_Loop = TimedItemRemover Loop <gen>


-------- ------------------------------------------------------------------------------------------------------------------ --------


-------- - --------


Trigger - Add to TIR_Loop the event (Time - Every TIR_Interval seconds of game time)


-------- - --------


Hashtable - Create a hashtable


Set TIR_Table = (Last created hashtable)


-------- - --------


Set TIR_DebugMode = True
TimedItemRemover

Events

Conditions

Actions


Set TIR_ItemCount = (TIR_ItemCount + 1)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




TIR_ItemCount Equal to 1



Then - Actions




Trigger - Turn on TIR_Loop



Else - Actions




-------- loop is already on; do nothing --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




TIR_RecycledSize Equal to 0



Then - Actions




Set TIR_MaxIndex = (TIR_MaxIndex + 1)




Set TIR_Item_ID = TIR_MaxIndex



Else - Actions




Set TIR_RecycledSize = (TIR_RecycledSize - 1)




Set TIR_Item_ID = TIR_RecycledStack[TIR_RecycledSize]


-------- - --------


Set TIR_NodeNext[TIR_Item_ID] = 0


Set TIR_NodeNext[TIR_NodePrev[0]] = TIR_Item_ID


Set TIR_NodePrev[TIR_Item_ID] = TIR_NodePrev[0]


Set TIR_NodePrev[0] = TIR_Item_ID


-------- - --------


Set TIR_ItemArr[TIR_Item_ID] = TIR_Item


Set TIR_Counter[TIR_Item_ID] = TIR_Duration


Set TIR_CleanUp[TIR_Item_ID] = False


-------- - --------


Custom script: call SaveInteger(udg_TIR_Table, 0, GetHandleId(udg_TIR_Item), udg_TIR_Item_ID)
TimedItemRemover Loop

Events

Conditions

Actions


Set TIR_Item_ID = 0


For each (Integer TIR_LoopInt) from 1 to TIR_ItemCount, do (Actions)



Loop - Actions




Set TIR_Item_ID = TIR_NodeNext[TIR_Item_ID]




-------- - --------




-------- Check if duration is up --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






TIR_Counter[TIR_Item_ID] Less than or equal to 0.00





Then - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








TIR_CleanUp[TIR_Item_ID] Equal to False







Then - Actions








-------- It's up; kill the item first to show dead animation --------








Item - Set life of TIR_ItemArr[TIR_Item_ID] to 0.39








-------- Clean up stage --------








Set TIR_CleanUp[TIR_Item_ID] = True








-------- Restart the timer --------








Set TIR_Counter[TIR_Item_ID] = TIR_Timeout







Else - Actions








-------- It's up; kill the item first --------








Item - Set life of TIR_ItemArr[TIR_Item_ID] to 0.41








Item - Remove TIR_ItemArr[TIR_Item_ID]








-------- Remove the index saved in hashtable --------








Custom script: call RemoveSavedInteger(udg_TIR_Table, 0, GetHandleId(udg_TIR_ItemArr[udg_TIR_Item_ID]))








-------- Recycle --------








Set TIR_RecycledStack[TIR_RecycledSize] = TIR_Item_ID








Set TIR_RecycledSize = (TIR_RecycledSize + 1)








Set TIR_NodeNext[TIR_NodePrev[TIR_Item_ID]] = TIR_NodeNext[TIR_Item_ID]








Set TIR_NodePrev[TIR_NodeNext[TIR_Item_ID]] = TIR_NodePrev[TIR_Item_ID]








Set TIR_ItemCount = (TIR_ItemCount - 1)








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










TIR_ItemCount Equal to 0









Then - Actions










Trigger - Turn off TIR_Loop









Else - Actions










-------- there's still an instance running; do not turn off --------





Else - Actions






-------- Debug purpose --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








TIR_DebugMode Equal to True







Then - Actions








Set TIR_TempLoc = (Position of TIR_ItemArr[TIR_Item_ID])








Floating Text - Create floating text that reads (String(TIR_Counter[TIR_Item_ID])) at TIR_TempLoc with Z offset 7.50, using font size 8.00, color (70.00%, 70.00%, 100.00%), and 0.00% transparency








Floating Text - Change (Last created floating text): Disable permanence








Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 70.00 degrees








Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds








Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds








Custom script: call RemoveLocation(udg_TIR_TempLoc)







Else - Actions






-------- It's not up yet; decrease counter --------






Set TIR_Counter[TIR_Item_ID] = (TIR_Counter[TIR_Item_ID] - TIR_Interval)
TimedItemRemover Reset

Events


Unit - A unit Acquires an item

Conditions

Actions


Custom script: set udg_TIR_ItemHandleID = GetHandleId(GetManipulatedItem())


Custom script: set udg_TIR_Item_ID = LoadInteger(udg_TIR_Table, 0, udg_TIR_ItemHandleID)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Item being manipulated) Equal to TIR_ItemArr[TIR_Item_ID]



Then - Actions




-------- Remove the index saved in hashtable --------




Custom script: call RemoveSavedInteger(udg_TIR_Table, 0, udg_TIR_ItemHandleID)




-------- Recycle right away --------




Set TIR_RecycledStack[TIR_RecycledSize] = TIR_Item_ID




Set TIR_RecycledSize = (TIR_RecycledSize + 1)




Set TIR_NodeNext[TIR_NodePrev[TIR_Item_ID]] = TIR_NodeNext[TIR_Item_ID]




Set TIR_NodePrev[TIR_NodeNext[TIR_Item_ID]] = TIR_NodePrev[TIR_Item_ID]




Set TIR_ItemCount = (TIR_ItemCount - 1)




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






TIR_ItemCount Equal to 0





Then - Actions






Trigger - Turn off TIR_Loop





Else - Actions






-------- there's still an instance running; do not turn off --------



Else - Actions