I'm having problems keeping this from going into an infinite loop. It works fine if the target has an item although if he doesn't, then it goes into the loop. I made a condition I thought checked for this but apparently I'm mistaken. The reason I have it run the trigger again so that if the trigger randoms a slot without an item it will run again. Any help on this issue is appreciated.
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Ability being cast) Equal to Band of Thieves (Slywolf)) and (((Target unit of ability being cast) has No item) Equal to False)
Then - Actions
Set BandofThievesTarget = (Target unit of ability being cast)
Set BandofThievesTargetPoint = (Position of (Target unit of ability being cast))
Set Random = (Random integer number between 1 and 6)
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Unit - Create 1 Warden for Neutral Passive at (BandofThievesTargetPoint offset by 100.00 towards (72.00 x (Real((Integer A)))) degrees) facing BandofThievesTargetPoint
Special Effect - Create a special effect at ThiefPosition using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
Special Effect - Destroy (Last created special effect)
Set ThiefPosition = (Position of (Last created unit))
Unit - Add a 2.00 second Animate Dead expiration timer to (Last created unit)
Unit - Add Invulnerable (Neutral) to (Last created unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item carried by BandofThievesTarget in slot Random) Not equal to No item
Then - Actions
Set RandomItem = (Item carried by (Target unit of ability being cast) in slot Random)
Hero - Give (Item carried by BandofThievesTarget in slot Random) to (Triggering unit)
Item - Make RandomItem Undroppable
Game Cache - Create a game cache from AgeOfWar.w3v
Game Cache - Store (30.00 x (Real((Level of Band of Thieves (Slywolf) for (Triggering unit))))) as Item Time of Category in (Last created game cache)
Wait (Load Item Time of Category from (Last created game cache)) seconds
Item - Make RandomItem Droppable
Hero - Give RandomItem to BandofThievesTarget
Custom script: call RemoveLocation (udg_BandofThievesTargetPoint)
Custom script: call RemoveLocation (udg_ThiefPosition)
Else - Actions
Trigger - Run (This trigger) (checking conditions)
Else - Actions
Do nothing