[Trigger] Question about inventory

Level 10
Joined
Dec 21, 2010
Messages
471
is there a call function that orders a unit to move the item in a specific inventory slot without interrupting the unit's last issued order?

ex: I ordered the unit to move at a certain point... then I used an action via trigger unit order to put this item in slot 4


I want the unit to continue walking without being interrupted when ordered to put his item in slot 4.
 
Level 4
Joined
Jan 17, 2014
Messages
131
is there a call function that orders a unit to move the item in a specific inventory slot without interrupting the unit's last issued order?

ex: I ordered the unit to move at a certain point... then I used an action via trigger unit order to put this item in slot 4


I want the unit to continue walking without being interrupted when ordered to put his item in slot 4.

I believe it can be done. Just store the order and the point in variables and after moving the item in the desired slot, re-order the unit to do the stored order at the stored point.
 
Level 35
Joined
Mar 6, 2006
Messages
9,244

  • Untitled Trigger 003
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Paladin 0006 <gen>
      • Set i1 = 1
      • Set i2 = 2
      • Trigger - Run MoveItemToSlot <gen> (ignoring conditions)
  • MoveItemToSlot
    • Events
    • Conditions
    • Actions
      • Set it1 = (Item carried by u in slot i1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • it1 Not equal to No item
        • Then - Actions
          • Custom script: set udg_i = GetHandleId(udg_u)
          • Set ityp1 = (Item-type of it1)
          • Set i3 = (Charges remaining in it1)
          • Custom script: call SaveInteger(udg_hash, udg_i, 0, udg_ityp1)
          • Custom script: call SaveInteger(udg_hash, udg_i, 1, udg_i3)
          • Custom script: call SaveInteger(udg_hash, udg_i, 2, udg_i2 - 1)
          • Item - Remove (Item carried by u in slot i1)
          • Set it1 = (Item carried by u in slot i2)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • it1 Not equal to No item
            • Then - Actions
              • Set ityp1 = (Item-type of it1)
              • Set i3 = (Charges remaining in it1)
              • Custom script: call SaveInteger(udg_hash, udg_i, 3, udg_ityp1)
              • Custom script: call SaveInteger(udg_hash, udg_i, 4, udg_i3)
              • Custom script: call SaveInteger(udg_hash, udg_i, 5, udg_i1 - 1)
              • Item - Remove (Item carried by u in slot i2)
            • Else - Actions
          • Unit Group - Add u to group
          • Trigger - Turn on Untitled Trigger 041 <gen>
        • Else - Actions
  • Untitled Trigger 041
    • Events
      • Time - Every 0.00 seconds of game time
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • Custom script: set udg_i = GetHandleId(udg_u)
          • Set i1 = (Load 2 of i from hash)
          • Set i2 = (Load 5 of i from hash)
          • Custom script: call UnitAddItemToSlotById(udg_u, LoadInteger(udg_hash, udg_i, 0), udg_i1)
          • Custom script: call UnitAddItemToSlotById(udg_u, LoadInteger(udg_hash, udg_i, 3), udg_i2)
          • Item - Set charges remaining in (Item carried by u in slot i1) to (Load 4 of i from hash)
          • Item - Set charges remaining in (Item carried by u in slot i2) to (Load 1 of i from hash)
          • Hashtable - Clear all child hashtables of child i in hash
          • Unit Group - Remove u from group

Remember to also initialize the hashtable.
 
Top