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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest. The contest is optionally paired. Best of luck, people!
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. 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.

Over Time Item Removal

Discussion in 'Requests' started by Lee_Go, Apr 9, 2010.

  1. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    Request: Add on to current trigger to make it so if the item is picked back up before the expiration timer runs out the timer stops and the trigger starts over once the meat is dropped again.

    I've had problems before with this trigger and now I'm seeing if you drop the item "Meat" and pick it up again, the item will still disappear after the generic timer runs out.

    The idea behind this trigger is 'meat becoming moldy'... if you set it down for over, in this case, 30 seconds it disappears as in becomes moldy and inedible. So if you pick the meat back up before 30 seconds it does not get removed.

    Trigger
    • ID Init
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Hashtable - Create a hashtable
        • Set IDhashtable = (Last created hashtable)

    • ID A
      • Events
        • Unit - A unit Loses an item
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to Meat
      • Actions
        • Set IDpoint1 = (Position of (Item being manipulated))
        • Unit - Create 1 Dummy for Neutral Passive at IDpoint1 facing Default building facing degrees
        • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
        • Hashtable - Save Handle Of(Item being manipulated) as (Key item) of (Key (Last created unit)) in IDhashtable
        • Hashtable - Save Handle Of(Last created unit) as (Key unit) of (Key (Item being manipulated)) in IDhashtable
        • Custom script: call RemoveLocation (udg_IDpoint1)

    • ID B
      • Events
        • Unit - A unit Dies
      • Conditions
        • (Unit-type of (Triggering unit)) Equal to Dummy
        • ((Key item) is stored as a Handle of (Key (Triggering unit)) in IDhashtable) Equal to True
      • Actions
        • Hashtable - Clear all child hashtables of child (Key (Load (Key item) of (Key (Triggering unit)) in IDhashtable)) in IDhashtable
        • Item - Remove (Load (Key item) of (Key (Triggering unit)) in IDhashtable)
        • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in IDhashtable
     
  2. krisserz

    krisserz

    Joined:
    Feb 28, 2009
    Messages:
    1,945
    Resources:
    2
    Spells:
    2
    Resources:
    2
    When unit picks up the item then pause expiration timer and remove the dummy unit from game. It should work again when dropped.
     
  3. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    But its not just for one single item, there are multiple items, "Meat" that are dropped and picked up that must be accounted for.
     
  4. krisserz

    krisserz

    Joined:
    Feb 28, 2009
    Messages:
    1,945
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Then sorry but I don`t get what do you mean...
     
  5. AlienAtSystem

    AlienAtSystem

    Joined:
    Dec 26, 2009
    Messages:
    604
    Resources:
    38
    Models:
    7
    Icons:
    28
    Packs:
    1
    Skins:
    1
    Spells:
    1
    Resources:
    38
    Looks like you simply forgot a trigger that fires when the item is picked up. There you would just have to clear the hashtable entries.
     
  6. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Yes, AlienAtSystem made his point. You need this:
    • Trigger
    • Events
      • Unit - A unit acquires an item
    • Conditions
      • (Load Key(unit) is stored as a Handle of (Key(Item being manipulated)) from IDHashtable) Equal to True
    • Actions
      • Unit - Remove (Load (Key(unit)) of (Key(Item being manipulated)) from IDHashtable)


    DO NOT use Unit - Kill unit, because the timer is based on that unit's death, so, if you kill the unit, the item will eventually disappear, by the time you pick it up back. Unit - Remove unit will help you avoid this issue.
     
  7. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    Thank you all three, I would like to try your trigger Pharaoh but I don't use hashtables, I can't imitate your condition. Also, '(load (Key(unit)'... is it a string 'Unit' or something else? I just don't see why it's a string if it is.
     
  8. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Those triggers on your post are made by me, if you remember. Then, go to see how those conditions are done. Use the same way or just copy that condition of your third trigger and instead of "item" type "unit" and instead of "Triggering unit" scroll to "Item being manipulated" in that long list.
     
  9. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    Ok Pharaoh you get helper of the year for requests, since I have you here and since you made every part of this trigger what's wrong with this added part that is supposed to remove the item "Meat" after the item is created at the position of the dying unit of the animals you're hunting.

    Trigg
    • ID Ab Implementing
      • Events
        • Unit - A unit Dies
      • Conditions
        • (Owner of (Dying unit)) Equal to Neutral Passive
      • Actions
        • Set IDpoint2 = (Position of (Last created item))
        • Unit - Create 1 Dummy for Neutral Passive at IDpoint2 facing Default building facing degrees
        • Unit - Add a 30.00 second Generic expiration timer to (Last created unit)
        • Hashtable - Save Handle Of(Item being manipulated) as (Key item) of (Key (Last created unit)) in IDhashtable
        • Hashtable - Save Handle Of(Last created unit) as (Key unit) of (Key (Item being manipulated)) in IDhashtable
        • Custom script: call RemoveLocation (udg_IDpoint2)
     
  10. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    • Set IDpoint2 = (Position of (Last created item))


    That line should be in a trigger that has the action Item - Create Item or Hero - Create Item and give it to Hero. Did you mean (Position of (Triggering unit))?

    • Hashtable - Save Handle Of(Item being manipulated) as (Key item) of (Key (Last created unit)) in IDhashtable


    That line should be in a trigger with an event "Unit - A unit uses/acquires/loses an item". Since you have no event like this, the reference will return null. What do you need this trigger for? I thought this part was done.
     
  11. Lee_Go

    Lee_Go

    Joined:
    May 1, 2009
    Messages:
    156
    Resources:
    0
    Resources:
    0
    I told you when i brought this up earlier it did funky things, if you read 'the idea' behind this trigger in the first post you see what I'm trying to do. Basically meat rots on the ground after 60 seconds so it doesn't matter if you drop it and its on the ground for 60 seconds or if it's on the ground after being created from a dead animal.

    Remove meat if its dropped and on ground after 60 seconds... done.

    Remove meat created at spot of dying animal on ground after 60 seconds... problem.