• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Drop Item problem

Status
Not open for further replies.
Level 7
Joined
Jun 19, 2017
Messages
141
Hi guys, I'm having a problem with a trigger that prevents Heroes from having more than 1 item class in their inventory. The trigger works and if conditions are matched, it drops the item on ground where it was picked from. I also have a courier type unit that can carry items for the Hero and this is where the trigger bugs.

So the problem is that whenever the courier carries an item to the hero and directly gives it to him, but the hero already has an item of that class, the item goes back to the point where the courier picked it from. My question is: Is there a way to derive if the item has been picked from the ground or given to the hero from another unit?
Here is the trigger:
  • Drop Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer LoopDuplicateItem) from 1 to (Size of inventory for (Triggering unit)), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is A Hero) Equal to True
              • (Item-class of (Item being manipulated)) Not equal to Unknown
              • (Item carried by (Triggering unit) in slot LoopDuplicateItem) Not equal to (Item being manipulated)
              • (Item-class of (Item carried by (Triggering unit) in slot LoopDuplicateItem)) Equal to (Item-class of (Item being manipulated))
            • Then - Actions
              • Set Point[0] = (Position of (Item being manipulated))
              • Hero - Drop (Item being manipulated) from (Triggering unit)
              • Item - Move (Item being manipulated) to Point[0]
              • Set PlayerGroup[0] = (Player group((Triggering player)))
              • Quest - Display to PlayerGroup[0] the Warning message: |c00FF0000Only one ...
              • Custom script: call RemoveLocation(udg_Point[0])
              • Custom script: call DestroyForce(udg_PlayerGroup[0])
            • Else - Actions
 
Status
Not open for further replies.
Top