Page 1 of 3

Use To Pickup

PostPosted: Sat Jul 21, 2018 1:28 am
by argv
Like the name suggests, this mod changes how players pick up items. Instead of picking them up by touching them, one must aim at the item and press the Use button to pick it up. Now you won't accidentally pick up that blue armor when yours is only down to 198%!

Also, this mod shows neat-looking brackets around the item, and its name.

Check it out on GitHub and download the latest pk3. (GitHub zips are directly loadable by GZDoom.)

Re: Use To Pickup

PostPosted: Sat Jul 21, 2018 1:55 am
by StroggVorbis
Just a minor cosmetic bug: dropping a weapon and looking at it will not fully display the "Pick Up" prompt, only "Pick" or "Pick U".

Instantly put this in my autoload and bound a key to "toggle usetopickup_enabled" :p

I'd like to suggest the option to mark/flag the item you're currently looking at for picking it up always or not, basically a selective usetopickup, for example in Golden Souls if you don't wanna waste ammo but also don't want to pick up all the coins one at a time :)

Edit: Also the option to "remove/activate" the thing you're looking at, for example in maps where a script is tied to an item, but you can't pick it up because you already have the maximum amount or you're not the corresponding class.

And an option to display how much health/armor/ammo this item grants or if like in the above examples any scripts or specials are tied to it.

Re: Use To Pickup

PostPosted: Sun Jul 22, 2018 2:15 am
by argv
DabbingSquidward wrote:Just a minor cosmetic bug: dropping a weapon and looking at it will not fully display the "Pick Up" prompt, only "Pick" or "Pick U".

Fixed.

Instantly put this in my autoload and bound a key to "toggle usetopickup_enabled" :p

Added that to the menus.

I'd like to suggest the option to mark/flag the item you're currently looking at for picking it up always or not, basically a selective usetopickup, for example in Golden Souls if you don't wanna waste ammo but also don't want to pick up all the coins one at a time :)

Done. You can now place that information into a file “UseToPickup.ini”, load it into the engine (by loading the folder it's in, or wrapping it in a pk3), and U2P will use it. See documentation.

Edit: Also the option to "remove/activate" the thing you're looking at, for example in maps where a script is tied to an item, but you can't pick it up because you already have the maximum amount or you're not the corresponding class.

Fixing bugs in other people's maps is kind of out of scope for this mod. :P

And an option to display how much health/armor/ammo this item grants

Hmm… That can be done for simple cases, but it'll be wrong if the item has any sort of special behavior, such as health items that give you full health no matter what your max health is, or ammo items that only give you as much ammo as you can carry and leave the rest on the floor.

or if like in the above examples any scripts or specials are tied to it.

I guess I could have it show that there is a map special attached, but there's no way to tell if any event listeners will react to picking it up, what exactly will happen, etc.

Re: Use To Pickup

PostPosted: Sun Jul 22, 2018 4:52 am
by StroggVorbis
Just tried the latest version with AlwaysTouchPickup, had to rename Coin to Coin_Pickup though. While it does work, the pick up distance is shorter than with the mod disabled, e.g. less distance between you and the item in question is required to grab it. In fact, if I run fast enough, I can move over it without getting it.

Edit: Don't know if it's because I played on an older savegame which had the previous version, but some ammo pickups now give double the amounts :-?

Re: Use To Pickup

PostPosted: Sun Jul 22, 2018 5:03 pm
by argv
You don't have to change the original INI! Make a new folder, put a file in it named “UseToPickup.ini”, and write this into it:
Code: Select allExpand view
[Coin_Pickup+]
AlwaysTouchPickup=yes

Then load that folder into GZDoom, along with the rest of the mods.

If you want that to not apply to subclasses of Coin_Pickup, write this instead:
Code: Select allExpand view
[Coin_Pickup]
AlwaysTouchPickup=yes

Notice no + after the class name. You can also put a - after the class name to make settings apply to all superclasses.

Re: Use To Pickup

PostPosted: Sun Jul 22, 2018 5:06 pm
by argv
I don't touch the items' amounts. I just activate their on-touch behavior when you pick them up. Not my fault! :D

Re: Use To Pickup

PostPosted: Sun Jul 22, 2018 5:44 pm
by Ghost Prototype
This is amazing! May I include this in my mod? Credits and special thanks would be given to you 100%

Re: Use To Pickup

PostPosted: Sun Jul 22, 2018 10:51 pm
by argv
Yes, yes you may!

Re: Use To Pickup

PostPosted: Fri Jul 27, 2018 3:21 pm
by StroggVorbis
I haven't found a way to reliably trigger it, seems to happen at random, but as mentioned earlier sometimes pickups are worth double. Probably the item in question isn't always removed after getting its contents so they are given again.

Re: Use To Pickup

PostPosted: Fri Jul 27, 2018 7:56 pm
by argv
Well, one possibility came to mind: the on-touch behavior isn't supposed to trigger if the item is not marked as being pick-up-able (the SPECIAL flag), and my code wasn't always checking that before calling the touch routine again.

I just pushed out a change such that the code will check that flag first. This may or may not fix the double ammo issue. Give it a try, and let me know if it happens again. :)

In other news: you can now customize the color and opacity of the brackets and labels.

Re: Use To Pickup

PostPosted: Sun Jul 29, 2018 12:16 am
by StroggVorbis
When traveling between levels in a hub I get the error "multiple u2p_playerstate instances for player number 0! Deleting one of them."

Re: Use To Pickup

PostPosted: Mon Jul 30, 2018 1:49 pm
by argv
DabbingSquidward wrote:When traveling between levels in a hub I get the error "multiple u2p_playerstate instances for player number 0! Deleting one of them."

Fixed!

Re: Use To Pickup

PostPosted: Tue Jul 31, 2018 6:53 am
by ramon.dexter
Hi, it still ignores one-sided lindefs. I can still pick up items through wall.

Re: Use To Pickup

PostPosted: Tue Jul 31, 2018 8:00 am
by StroggVorbis
Could you remove the "on-touch pickup" delay for items with AlwaysTouchPickup?

Re: Use To Pickup

PostPosted: Wed Aug 01, 2018 1:12 am
by argv
ramon.dexter wrote:Hi, it still ignores one-sided lindefs. I can still pick up items through wall.

I forgot to check if a line in the way is one-sided! Whoops. Pushed out a fix.

DabbingSquidward wrote:Could you remove the "on-touch pickup" delay for items with AlwaysTouchPickup?

The pickup delay doesn't apply to AlwaysTouchPickup items. The delay, rather, was the result of the mod only scanning for items to pick up (by touch or otherwise) once every 4 tics.

I've changed this to be configurable. By default, it now scans (and picks up AlwaysTouchPickup items) on every tic, rather than every 4 tics. This imposes a performance hit, though, especially in multiplayer, so there is now an option in the menu to change that.