- Joined
- Mar 24, 2013
- Messages
- 1,105
Well, I'm trying to make a courier type ability, where the unit will look around in the area where the spell is cast for items, then it will go grab the closest items and bring them back to its starting place. << This Part works fine. I can't however figure a way to catch an order so I can deindex the courier, because its constantly being ordered something and by the time it checks to see current order its no longer what it "needs to be." I've tried checking the current order first without ordering prior in the trigger and I've also tried to check to not order it to do something else if the unit's order is something. Both of these were unsuccessful... Both spells are based on channel, the one to "cancel/deindex"'s base order id is Charm.
SORRY for the wall of text. The line I need assistance with is starred!
****
SORRY for the wall of text. The line I need assistance with is starred!
-
Grab Item Cast
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to (==) Gather Items
-
Actions
- Set GrabItem_MaxIndex = (GrabItem_MaxIndex + 1)
- Set GrabItem_Caster[GrabItem_MaxIndex] = (Triggering unit)
- Set ItemDrop_Loc[GrabItem_MaxIndex] = (Position of (Triggering unit))
- Set Item_Rect[GrabItem_MaxIndex] = (Region centered at ItemDrop_Loc[GrabItem_MaxIndex] with size (1800.00, 1800.00))
- Set Item_Rect2[GrabItem_MaxIndex] = (Region centered at ItemDrop_Loc[GrabItem_MaxIndex] with size (300.00, 300.00))
- Unit - Remove Gather Items from GrabItem_Caster[GrabItem_MaxIndex]
-
Unit - Add Stop Gather Items to GrabItem_Caster[GrabItem_MaxIndex]
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- GrabItem_MaxIndex Equal to (==) 1
-
Then - Actions
- Trigger - Turn on Grab Item Loop <gen>
- Else - Actions
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
-
Grab Item Loop
-
Events
- Time - Every 0.10 seconds of game time
- Conditions
-
Actions
-
Do Multiple ActionsFor each (Integer GrabItem_CurrentIndex) from 1 to GrabItem_MaxIndex, do (Actions)
-
Loop - Actions
-
Set TempLoc = (Position of GrabItem_Caster[GrabItem_CurrentIndex])
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of items carried by GrabItem_Caster[GrabItem_CurrentIndex]) Greater than (>) 0
-
Then - Actions
- Set HasItem = True
-
Else - Actions
- Set HasItem = False
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- HasItem Equal to (==) False
-
Then - Actions
- Set TempReal = 10000.00
-
Item - Pick every item in Item_Rect[GrabItem_CurrentIndex] and do (Actions)
-
Loop - Actions
-
Set TempItem = No item
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked item) is in Item_Rect2[GrabItem_CurrentIndex]) Not equal to (!=) True
-
Then - Actions
- Set TempLoc2 = (Position of (Picked item))
-
Set TempReal2 = (Distance between TempLoc and TempLoc2)
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- TempReal2 Less than (<) TempReal
-
Then - Actions
- Set TempItem = (Picked item)
- Unit - Order GrabItem_Caster[GrabItem_CurrentIndex] to Right-Click TempItem
- Set TempReal = TempReal2
- Else - Actions
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Custom script: call RemoveLocation(udg_TempLoc2)
-
Set TempItem = No item
-
Loop - Actions
-
Else - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between TempLoc and ItemDrop_Loc[GrabItem_CurrentIndex]) Greater than (>) ItemDropOffRange
-
Then - Actions
- Unit - Order GrabItem_Caster[GrabItem_CurrentIndex] to Move To ItemDrop_Loc[GrabItem_CurrentIndex]
-
Else - Actions
- Hero - Drop (Item carried by GrabItem_Caster[GrabItem_CurrentIndex] in slot 1) from GrabItem_Caster[GrabItem_CurrentIndex]
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ****** (Current order of GrabItem_Caster[GrabItem_CurrentIndex]) Equal to (==) (Order(charm)) ******
-
Then - Actions
- Unit - Remove Stop Gather Items from GrabItem_Caster[GrabItem_CurrentIndex]
- Unit - Add Gather Items to GrabItem_Caster[GrabItem_CurrentIndex]
- Custom script: call RemoveLocation(udg_ItemDrop_Loc[udg_GrabItem_CurrentIndex])
- Custom script: call RemoveRect(udg_Item_Rect[udg_GrabItem_CurrentIndex])
- Custom script: call RemoveRect(udg_Item_Rect2[udg_GrabItem_CurrentIndex])
- Set ItemDrop_Loc[GrabItem_CurrentIndex] = ItemDrop_Loc[GrabItem_MaxIndex]
- Set Item_Rect[GrabItem_CurrentIndex] = Item_Rect[GrabItem_MaxIndex]
- Set Item_Rect2[GrabItem_CurrentIndex] = Item_Rect[GrabItem_MaxIndex]
- Set GrabItem_Caster[GrabItem_CurrentIndex] = GrabItem_Caster[GrabItem_MaxIndex]
- Set GrabItem_CurrentIndex = (GrabItem_CurrentIndex - 1)
- Set GrabItem_MaxIndex = (GrabItem_MaxIndex - 1)
- Else - Actions
- ***Debug msg of the units current order is returning "charm" which it just supposedly failed in the IF*****
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Custom script: call RemoveLocation(udg_TempLoc)
-
Set TempLoc = (Position of GrabItem_Caster[GrabItem_CurrentIndex])
-
Loop - Actions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- GrabItem_MaxIndex Equal to (==) 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Do Multiple ActionsFor each (Integer GrabItem_CurrentIndex) from 1 to GrabItem_MaxIndex, do (Actions)
-
Events
Last edited: