Thread: Item_inventory "target_cant_drop" not working?

Results 1 to 16 of 16
  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    6

    Item_inventory "target_cant_drop" not working?

    Hi,

    In my map I have been trying to set up an item_inventory so that the player can't drop it manually (holder_can_drop set to "No") and set it to trigger another entity if the player attempts to drop it but can't (target_cant_drop set to the name of the entity to be triggered).

    The general idea is to create a "magic item" that allows the player to trigger an event by attempting and failing to drop it, from anywhere in the map, and any number of times after they have picked it the item up. Basically using the inventory drop function as a triggering mechanism.

    When I set this up, however, it doesn't trigger. The player is not allowed to drop the item, which is correct, but the entity that is supposed to be triggered when the player fails to drop the item isn't triggered.

    If I set the item_inventory so that it can be dropped and that an event is triggered when the item is successfully dropped, that works perfectly. But I don't want the player to have to pick the item up again every time he/she wants to use it.

    It seems like the keyvalues I am using are designed to work this way, and the entity guide indicates that it should work. Am I missing something with this function, or is it broken?

    If anybody has any other ideas to meet the same requirement (allow a player to trigger a specific entity from anywhere on the map by performing a specific action, either with a keystroke, chat command, item_inventory, or other), I'd love to know about it.

    Thanks,
    M

  2. #2
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    What is happening here is the game client's inventory window already knows in advance that an item can't be dropped by choice, so ignores your command to do so. That's why the map trigger you defined doesn't happen. Using the "dropitem" command it does happen, and in my testing the message I set does fire.

    I guess we need to make the client's inventory window a little less smart.

    --

    Actually, the command does NOT get blocked. The server is receiving my drop item command via the GUI.

    Looks like the block was happening server side when it receives the "dropitem" command. The command handler was checking if the item could be dropped and preventing a call to the item's `Drop()` function, but that `Drop()` function was meant to handle/block this including firing the "target_cant_drop_*" triggers. -- This fix will be available to you in the next update.
    Last edited by AdamR; 15-04-2019 at 11:58 AM.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  3. #3
    Registered User
    Join Date
    Apr 2019
    Posts
    6

    Re: Item_inventory "target_cant_drop" not working?

    Hey, that's great! Thanks for looking into this for me. It's the only thing I could find that approximated a "remote control" or "portable button" for the player to carry around and use to trigger events.

    I look forward to the fix.

    As an idea for future consideration: An "activate" option for item_inventory, where you can set a "target on activate" keyvalue on the entity and then a player can trigger it with an "Activate Item" button in the inventory menu. An item_inventory with no target in that keyvalue could just trigger a message reading "This item cannot be activated!", but if a target entity was present in "target on activate" it would trigger it. One could then use currently existing entities to build all kinds of interesting "usable" and "re-usable" objects and effects that players could pick up, activate when appropriate, and drop.

    Thanks again,
    -M

  4. #4
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    Quote Originally Posted by M_Syndro View Post
    As an idea for future consideration: An "activate" option for item_inventory, where you can set a "target on activate" keyvalue on the entity and then a player can trigger it with an "Activate Item" button in the inventory menu. An item_inventory with no target in that keyvalue could just trigger a message reading "This item cannot be activated!", but if a target entity was present in "target on activate" it would trigger it. One could then use currently existing entities to build all kinds of interesting "usable" and "re-usable" objects and effects that players could pick up, activate when appropriate, and drop.
    Doesn't this exist already? See "target_on_use".
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  5. #5
    Registered User
    Join Date
    Apr 2019
    Posts
    6

    Re: Item_inventory "target_cant_drop" not working?

    I saw target_on_use and was hopeful, but nothing I tried seemed to work. I may be misunderstanding it.

    I can set an entity in that keyvalue, but I when I run my test map in the game I cannot figure out what action the player could take that would actually trigger the entity. I can highlight the item in the inventory menu, but have no options other than to drop that item or drop all items. Is there a function (in the inventory menu or otherwise) I'm unaware of that would let a player trigger the entity named in target_on_use for an item_inventory he is carrying?

    Thanks,
    -M

  6. #6
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    A prime example is when you have a door locked to an item (key, etc). When you have the key and you trigger the door, because the key was required, it got "used" to the key's "target_on_use" would be fired when the door opens.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  7. #7
    Registered User
    Join Date
    Apr 2019
    Posts
    6

    Re: Item_inventory "target_cant_drop" not working?

    Okay, that seems to require an external entity in the map (like a door) to apply.

    What I am thinking of would be like a remote control for an old-school garage door opener. A little hand-held box with one button. I can pick up (collect) the remote control, put down (drop) the remote control, or I can, while carrying it, press the button (use/activate) the remote control from anywhere in my house or yard to open my garage door. That's not what I want to build in the game, but it is the best analogy I can think of to describe it.

    With an item_inventory I can create the remote control and put it in my map, and the player can pick it up and drop it in-game. But there's no way to "activate" the remote in-game while carrying it when and where the player chooses to do so. I had imagined an "Activate" button at the bottom of the inventory menu that pops up when a player hits the "I" key, and a keyvalue on item_inventory that names the entity to be triggered when the player clicks that "Activate" button after highlighting the item in the menu.

    Once the update fixes "target_cant_drop", I can use that to approximate this behavior, telling players they have to attempt to drop the item to activate it (they lose the ability to drop it, of course, but that is less important). That would suit my needs for a portable button, but actually having a way to fire an entity by "activating" the item would be much more slick.

    I appreciate your patience in looking at this. It's a great game, and has given my friends a reason to get out of the house and come over and drink beers and blow things up on our outdated computers (we play it old-time LAN party style). I'm the "level building guy", so I am often trying to come up with ways to use the entities available.

    -M

  8. #8
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    I understand your request, though that's not in the design of "item_inventory" right now. This entity was intended to be highly relatable to the "item_tfgoal" entity from Team Fortress Classic with some expansions for Sven Co-op. (In TFC this entity was used for the flag in CTF/assault/AvD maps, keys, and other game rules orientated holdable objective items.) Those items do not get used/activated by the player directly, rather by other entities the player interacts with according to various conditions.

    While your feature makes sense it may cause conflicts with the trigger inputs it has. The entity class standard `Use()` method, which is the standard input method for an entity receiving a use-type trigger, is already being used to allow the item to be remotely collected/dropped/destroyed by other entities (mainly "trigger_relay" or "multi_manager") along with collecting the item close by via a "+use" input. We'll still look into the possibility of this feature though.

    (As this is a feature request rather than a bug I can't put an ETA on this.)
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  9. #9
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    I've briefly looked into the scope of this feature and it's going to need to be more complicated than you may originally think:

    • New property: Activate limit
    • New property: Yes/no for "can self-activate"
    • New property: 3 targets for "on self-activation"
    • New property: 3 targets for "on can't self-activate"
    • New property: Effects wait until self-activation
    • Remember when the item was last self-activated
    • Remember how many times the item has been self-activated
    • What happens to the item if the activation count has been reached?
    • Should the hold time limit not start until the item has been activated?


    There is a lot of logic there to implement your request, and I've probably not thought of everything here.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  10. #10
    Registered User
    Join Date
    Apr 2019
    Posts
    6

    Re: Item_inventory "target_cant_drop" not working?

    Fair enough--I just play the game and am not the one who has to build/maintain it. Figured it couldn't hurt to ask.

    Thanks for looking into it, at least.

    -M

  11. #11
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    BTW that's not me saying "no" to it. Just that it's bigger than we expected.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  12. #12
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    Working on this has so far added the following entity properties:

    • activate_limit: How many times the item can be self-activated, no longer works when limit is reached (0 = infinite)
    • holder_time_activate_wait: Time to wait between each activation (0 = none)
    • holder_can_activate: Holder is allowed to activate this item by choice at any time
    • holder_timelimit_wait_until_activated: Maximum hold time is not started until the item is activated (ignored if "holder_can_activate" is false)
    • target_on_activate(_self): On self-activation (for holder)
    • target_on_activate_team: On self-activation (for holder's team)
    • target_on_activate_other: On self-activation (for everyone else)
    • target_on_cant_activate(_self): On failed self-activation (for holder)
    • target_on_cant_activate_team: On failed self-activation (for holder's team)
    • target_on_cant_activate_other: On failed self-activation (for everyone else)
    • effects_wait_until_activated: Holder effects do not apply until the item is activated (ignored if "holder_can_activate" is false)


    Quite complicated.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  13. #13
    Still learning wolf-3d's Avatar  
    Tester
    Join Date
    Jan 2011
    Location
    Somewhere Warm.
    Posts
    1,472

    Re: Item_inventory "target_cant_drop" not working?

    @Adam, you might want to consider range vs map wide. (OP wanted to use anywhere in house/yard area.)
    Regards
    Wolf-3D

  14. #14
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    Yeah I'm not going that far with this. If you want that then don't use self-activating items, but rather remote buttons/doors/etc as per my previous explanation.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

  15. #15
    Registered User
    Join Date
    Apr 2019
    Posts
    6

    Re: Item_inventory "target_cant_drop" not working?

    Just to confirm: I was thinking of something that could trigger an entity from anywhere in the map, as AdamR surmised. The "house/yard" analogy was meant to represent the whole map, not suggest that range could be a factor. I was trying to illustrate the portability of the thing: I hadn't even thought about range, but wouldn't have brought it up if I had because I was trying to keep it simple, even though it turns out that it's not.

  16. #16
    Administrator AdamR's Avatar  
    Manager
    Join Date
    Mar 2004
    Location
    Cardiff, South Wales [UK]
    Posts
    8,593

    Re: Item_inventory "target_cant_drop" not working?

    I'm pretty sure you could use a game_zone_player or whatever it's called to filter out usage by being in (or not) an area.
    Adam "Adambean" Reece
    Sven Co-op team

    Also on: Steam | Facebook | Twitter | YouTube | Twitch
    Released AMXX plug-ins: Bind number slots | NextMap with Sven Co-op fix | Sven Co-op administrator icons

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •