1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

One player item pickup

Discussion in 'Triggers & Scripts' started by Ragnar9, Feb 6, 2019.

  1. Ragnar9

    Ragnar9

    Joined:
    Jan 15, 2018
    Messages:
    86
    Resources:
    0
    Resources:
    0
    The goal is for only player "turquoise" to be able to pick up an item. However testing it out and other players could pick it up. Any ideas on what im doing wrong?

    • item
      • Events
        • Unit - A unit Acquires an item
      • Conditions
        • (Item-type of (Picked item)) Equal to Mech Suit Plans Part I
        • (Owner of (Triggering unit)) Not equal to Player 15 (Turquoise)
      • Actions
        • Set TempPoint1 = (Center of Mechsuit1 <gen>)
        • Unit - Order (Triggering unit) to drop Mech Suit Plans Part I 0748 <gen> at TempPoint1
     
  2. Clanzion

    Clanzion

    Joined:
    Jul 4, 2016
    Messages:
    397
    Resources:
    0
    Resources:
    0
    It might be possible that the order happens before the unit actually has the item in his inventory. Try putting a turn off and a turn on.
     
  3. Ragnar9

    Ragnar9

    Joined:
    Jan 15, 2018
    Messages:
    86
    Resources:
    0
    Resources:
    0
    I used a consumable as an item, becasue i dont want it in the Hero's inventory.
     
  4. BloodSoul

    BloodSoul

    Joined:
    May 10, 2009
    Messages:
    755
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Picked Item should only be used within item enumeration:
    • Item - Pick every item in (Playable map area) and do (Actions)
      • Loop - Actions
        • Item - Hide (Picked item)
    • -------- Or --------
    • Item - Pick every item in (Playable map area) and do (Item - Set life of (Picked item) to 75.00)

    Instead, use (Item being manipulated).

    Also, you are ordering the unit to drop a specific pre-placed item, which might not be what you want. I'm assuming you want to make everyone, but player 15, drop any item of that type. Additionally, that action will make the unit walk towards a specific point, and then drop the item, which might have a negative impact because players could issue orders to the unit before the item be dropped.
     
  5. Ragnar9

    Ragnar9

    Joined:
    Jan 15, 2018
    Messages:
    86
    Resources:
    0
    Resources:
    0
    So i switched it to item being manipulated and it it still doesn't work, so i switched to an item instead of a consumable and it seemed to work at first, but then like you said the item can be picked up and then walked away. How can i make it so it is dropped instantly, not even entering the heroes inventory? What would you recommend?
     
    Last edited: Feb 7, 2019
  6. BloodSoul

    BloodSoul

    Joined:
    May 10, 2009
    Messages:
    755
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Use the GUI function "Item - Move (Instantly)" to its own position. Though, this will inevitably make the item be in a unit's inventory, and be dropped afterwards, which will fire some events (pick item up / drop it).

    EDIT: In order to avoid that behavior, you'll probably have to use "unit - issue order targeting objects" event, and detect if the order is smart, and the target is that specific item type. Then, order the unit to stop. If it doesn't work right away, then pause the unit, stop it, and unpause it.
     
    Last edited: Feb 7, 2019
  7. GuineapigRoast

    GuineapigRoast

    Joined:
    Jan 31, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    You have to use the gui equivalent of UnitRemoveItem(unit, itm). This removes it from the units inventory and drops it under them. Either that, or detect the order and issue an immediate stop.
     
  8. Ragnar9

    Ragnar9

    Joined:
    Jan 15, 2018
    Messages:
    86
    Resources:
    0
    Resources:
    0
    its still not working. Why is this so difficult? it seems like a simple trigger
     
  9. GuineapigRoast

    GuineapigRoast

    Joined:
    Jan 31, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    Post what your current trigger is now.
     
  10. Ragnar9

    Ragnar9

    Joined:
    Jan 15, 2018
    Messages:
    86
    Resources:
    0
    Resources:
    0
    • itemtry2
      • Events
        • Unit - A unit Acquires an item
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to Mech Suit Part 1
        • (Owner of (Triggering unit)) Not equal to Player 15 (Turquoise)
      • Actions
        • Item - Move Mech Suit Part 1 0940 <gen> to (Position of (Last created item))
     
  11. ZiBitheWand3r3r

    ZiBitheWand3r3r

    Joined:
    Nov 21, 2012
    Messages:
    899
    Resources:
    15
    Maps:
    7
    Spells:
    8
    Resources:
    15
    hey, there's solution for you
    • ord
      • Events
        • Unit - A unit Is issued an order targeting an object
      • Conditions
        • (Item-type of (Target item of issued order)) Equal to Ghost Key
        • (Issued order) Equal to (Order(smart))
        • (Owner of (Ordered unit)) Not equal to Player 2 (Blue)
      • Actions
        • Game - Display to (All players) the text: Only Player2 can pi...
        • Unit Group - Add (Ordered unit) to temp_group
        • Countdown Timer - Start temp_timer as a One-shot timer that will expire in 0.00 seconds


    • timer
      • Events
        • Time - temp_timer expires
      • Conditions
      • Actions
        • Unit Group - Pick every unit in temp_group and do (Actions)
          • Loop - Actions
            • Unit - Order (Picked unit) to Stop
     

    Attached Files:

  12. GuineapigRoast

    GuineapigRoast

    Joined:
    Jan 31, 2019
    Messages:
    27
    Resources:
    0
    Resources:
    0
    Just interested, did that actually require the timer trick? Im pretty sure I've overridden orders without it
     
  13. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,124
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    This is so simple yet you overcomplicate it unnecessarily...
    First of all, here's an action to set an item's owner, use it.
    Should be Position of (Triggering unit) not last created item...
    The solution of ZiBitheWand3r3r fails if the unit is really close to the item.
     
  14. ZiBitheWand3r3r

    ZiBitheWand3r3r

    Joined:
    Nov 21, 2012
    Messages:
    899
    Resources:
    15
    Maps:
    7
    Spells:
    8
    Resources:
    15
    Code (vJASS):

    function Trig_esc_Actions takes nothing returns nothing
        local unit u=gg_unit_Hgam_0001
        local item itm=gg_item_kygh_0004
       
        call SetUnitX(u, GetWidgetX(itm))
        call SetUnitY(u, GetWidgetY(itm))
        call TriggerSleepAction(1.00)
        call IssueTargetOrder(u, "smart", itm)
       
    endfunction
    //============================================
    function InitTrig_esc takes nothing returns nothing
        set gg_trg_esc = CreateTrigger(  )
        call TriggerRegisterPlayerEventEndCinematic( gg_trg_esc, Player(0) )
        call TriggerAddAction( gg_trg_esc, function Trig_esc_Actions )
    endfunction
     

    @Wrda , unit cannot be closed then in above example and it still cannot pick up an item, test it yourself.
     
  15. Ragnar9

    Ragnar9

    Joined:
    Jan 15, 2018
    Messages:
    86
    Resources:
    0
    Resources:
    0
    Ok so i got it to work, but it leaks. any idea how i can stop or delete the trigger once the item is picked up?

    • itemtry2
      • Events
        • Unit - A unit Acquires an item
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to Mech Suit Part 1
        • (Owner of (Triggering unit)) Not equal to Player 15 (Turquoise)
      • Actions
        • Set TempPoint1 = (Center of Mechsuit1 <gen>)
        • Item - Move Mech Suit Part 1 0940 <gen> to TempPoint1