We have created a system where when items are picked up, they are placed in the hero inventory. I have recently added into the trigger a function to despawn an item that is dropped after 30 seconds. However, when the item is despawned, it will remove itself whether it is in the hero's inventory or not. I have tried a couple different tactics, and attempted to search for answers to no avail. Here is the trigger I am using:
Unit - Create 1 Cloth Feet for player 0 at (Position of Dead Unit) facing 270.0 degrees (No Options)
Variable - Set Item to Remove = (Last created unit)
General - Wait 30.0 Game Time seconds
Unit - Kill Item to Remove
Obviously, I am triggering the loot tables manually. We have been having problems trying to use the implemented loot tables. Also, I'm aware there may be a way to do this with either behaviors or actors, but I am unaware as to how to go about this. Does anyone have any suggestions on how to make this work properly?
You may want to wait 30 seconds from the time on when the item is dropped, not when it is created. Use the Event "Unit manipulates Inventory" for this and refer to the item with "Triggering inventory item". Also you need to check wether the item is picked up in the meantime (like, item picked up after 10 seconds and then dropped again after 10 seconds, then the item has to wait 30 seconds again before disappearing). So when an item is dropped, you have to check repeatedly whether the item is still on the ground.
There's probably a data solution aswell where the item gets a behavior lasting 30 seconds when dropped with maybe a validator to remove that behavior when picked up, but not sure if something like this exists.
ok cool. Thank you. This helps me. The only problem is that like I have stated, I've been triggering loot tables manually, so the item isn't actually dropped, it's created. And I've been trying to use this function as a cleanup for any items that are created on the ground, not just for heroes. I think I may be able to work something with this, I do have another question that relates to this problem, though. Is there any possible way to pass a local variable from one trigger to another and run that trigger without creating a global variable? (Basically I'm trying to figure out how to do an object oriented method call in )the editor triggers
Well, the whole purpose of using local variables is so they DON'T carry over past the scope of a function, but there are a couple of options you can pursue. The first and most obvious is to use global variables, but otherwise you can pass local variables into an action definition via a parameter (which technically remains within the scope of your trigger) or you can modify some unit property (custom value, hp/mp, etc.)
As far as what you're trying to achieve with dropped items... I suppose you could put a timed life behavior on the item when it is dropped and just remove that behavior when the item is picked up (via the Unit Manipulates Inventory event.) Items are a type of unit, after all. You could even declare the timed life behavior on the item in the Data Editor, if you want. That seems to me to be the simplest solution.
We have created a system where when items are picked up, they are placed in the hero inventory. I have recently added into the trigger a function to despawn an item that is dropped after 30 seconds. However, when the item is despawned, it will remove itself whether it is in the hero's inventory or not. I have tried a couple different tactics, and attempted to search for answers to no avail. Here is the trigger I am using:
Unit - Create 1 Cloth Feet for player 0 at (Position of Dead Unit) facing 270.0 degrees (No Options) Variable - Set Item to Remove = (Last created unit) General - Wait 30.0 Game Time seconds Unit - Kill Item to Remove
Obviously, I am triggering the loot tables manually. We have been having problems trying to use the implemented loot tables. Also, I'm aware there may be a way to do this with either behaviors or actors, but I am unaware as to how to go about this. Does anyone have any suggestions on how to make this work properly?
You may want to wait 30 seconds from the time on when the item is dropped, not when it is created. Use the Event "Unit manipulates Inventory" for this and refer to the item with "Triggering inventory item". Also you need to check wether the item is picked up in the meantime (like, item picked up after 10 seconds and then dropped again after 10 seconds, then the item has to wait 30 seconds again before disappearing). So when an item is dropped, you have to check repeatedly whether the item is still on the ground.
Trigger could look like this:
There's probably a data solution aswell where the item gets a behavior lasting 30 seconds when dropped with maybe a validator to remove that behavior when picked up, but not sure if something like this exists.
@Talon0815: Go
ok cool. Thank you. This helps me. The only problem is that like I have stated, I've been triggering loot tables manually, so the item isn't actually dropped, it's created. And I've been trying to use this function as a cleanup for any items that are created on the ground, not just for heroes. I think I may be able to work something with this, I do have another question that relates to this problem, though. Is there any possible way to pass a local variable from one trigger to another and run that trigger without creating a global variable? (Basically I'm trying to figure out how to do an object oriented method call in )the editor triggers
@Shaldares: Go
Well, the whole purpose of using local variables is so they DON'T carry over past the scope of a function, but there are a couple of options you can pursue. The first and most obvious is to use global variables, but otherwise you can pass local variables into an action definition via a parameter (which technically remains within the scope of your trigger) or you can modify some unit property (custom value, hp/mp, etc.)
As far as what you're trying to achieve with dropped items... I suppose you could put a timed life behavior on the item when it is dropped and just remove that behavior when the item is picked up (via the Unit Manipulates Inventory event.) Items are a type of unit, after all. You could even declare the timed life behavior on the item in the Data Editor, if you want. That seems to me to be the simplest solution.