header general

WIP - Item Holders

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Arachnotron
  • Arachnotron
More
10 months 2 weeks ago - 6 months 1 day ago #1 by DeVloek
WIP - Item Holders was created by DeVloek
I just had this idea of a gun rack system, and quickly made this proof of concept, so the sprites and code aren't the best. But if there is some interest in this, I'd be willing to work on improving it and turn it into a proper submission (probably for the Props category, seems most fitting). Of course any help will be appreciated too. If it's possible, I'd like to make actual gun cabinets that you can open and close. edit actually scratch that idea, I just need some good sprites of racks, shelves, cabinets, etc.




updated info 21 july 2024:

Name: Item Holders
Connection: none
Palette: Doom
Summon: See MAPINFO lump
Ambient Sound: No
De-/Activatable: No
Destroyable: No
Special Effects: No
Brightmaps: No
Actor modification: Yes
ACS: No

Description:
Several gunwalls, racks, shelves and pedestals which can hold inventory items such as weapons, ammo, medikits etc.

Usage:
  1. Put an itemholder in your map
  2. Place some items within the itemholder's scan radius, doesn't matter if placed via editor or dropped in-game

Items must be based on the Inventory class. Valid items will automatically attach to the itemholder, everything else will be ignored.
You can pick up the items and use them as normal, to put them back on the itemholder use the drop command.

Configurable features:
- Scan radius
- Allowed items
- Item position offsets
- Item display (flat sprite, scale, roll, rotation, weave)


Known issues:
  • Some large weapons such as the BFG9000 may overlap with other weapons.
  • A weapon that was picked up from a rack retains its flags and properties even when dropped, which may look wrong.

download:
https://drive.google.com/file/d/1AfEYz6KeSwoPR6UTMuQTNY2g3Op5eEeV/view?usp=sharinghttps://drive.google.com/file/d/1AfEYz6KeSwoPR6UTMuQTNY2g3Op5eEeV/view?usp=sharing
Last edit: 6 months 1 day ago by DeVloek.

Please Log in or Create an account to join the conversation.

  • CaptainToenail
  • CaptainToenail's Avatar
  • Wicked
  • Wicked
More
10 months 2 weeks ago #2 by CaptainToenail
Replied by CaptainToenail on topic WIP - Gun racks
Impressive. You are always surprising me with what is possible with zscript! :D

If you want those 3D opening cabinets, you could make them with map geometry then export them as wavefront 3D models using Ultimate DoomBuilder. That's how I create tables, cabinets crates etc.

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Arachnotron
  • Arachnotron
More
10 months 2 weeks ago - 10 months 2 weeks ago #3 by DeVloek
Replied by DeVloek on topic WIP - Gun racks
thanks, I didn't know that was possible. Tbh I never worked with models, they seem kinda out of place in Doom. But I'll look into it.

updated the shelf to be able to hold more than just ammo.

I added pretty much every common inventory subclass to the list except powerups which don't really fit the shelf. There are still some items with weird offsets that won't fit either (like armor/health bonus), but it would be up to the mapmaker which items to put on the shelf.

edit:
Improved code, now dropped/summoned items can be put on the rack/shelf as long as there is some space available.
However I noticed a bug where sometimes if you take an item from a rack and drop it again, it won't re-attach. I wasn't really able to repro it though, most of the time it works fine. Need to investigate...
Last edit: 10 months 2 weeks ago by DeVloek.

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Arachnotron
  • Arachnotron
More
10 months 2 weeks ago #4 by DeVloek
Replied by DeVloek on topic WIP - Gun racks
I somehow managed to fix the bug where sometimes the dropped/summoned item wouldn't attach to the rack, but introduced a new one where all the items already on the rack sometimes re-arrange themselves when a new one is attached...
And tbh I'm at the end of my zscripting knowledge here. I know it is possible to fix this with some proper scripting for the dynamic arrays that handle everything, but figuring out the logic behind this is beyond my current capabilities so I'll leave it at that, for now. Maybe I'll ask around the Zdoom discord for help if there is still some interest in this functionality.

The intended core function of the mod is working fine though, which is attaching editor-placed items to the rack/shelf. I don't know if there are many uses for attaching player-dropped items anyway, maybe in some kind of RPG-ish mod that has a base hub where the player can store the items they collected in the regular maps.

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Arachnotron
  • Arachnotron
More
6 months 2 days ago #5 by DeVloek
Replied by DeVloek on topic WIP - Gun racks
Update:

Rewrote most of the code. All known issues are gone.
- fixed overlapping sprites by adding an offset to some slots
- items now go back to their default flags and properties when picked up from the rack
- fixed slots array, no more switching places

Now all relevant code is in the BaseRack class. The individual rack and shelf classes are mostly for configuration which should be much easier now.
You can specify which items are allowed on the rack, the amount of rack slots, item roll, and the offsets of each slot (where the item is placed on the rack).

Also added 2 more shelf variants with 3 and 12 slots.
 

I renamed the file to Racks.pk3 since other rack types will be added.
https://drive.google.com/file/d/1AfEYz6KeSwoPR6UTMuQTNY2g3Op5eEeV/view?usp=sharing

Todo:
- find out in which order the items near the rack are iterated
- better sprites
- more rack types, eg. medic station, rocket shelf

Any help with sprites will be appreciated :)

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Arachnotron
  • Arachnotron
More
6 months 1 day ago - 6 months 1 day ago #6 by DeVloek
Replied by DeVloek on topic WIP - Gun racks
Update:

Added pedestals which can hold 1 item. Sprites are from id, Captain Toenail and Gothic.
Items can now rotate and weave and you can toggle wether items are displayed as wallsprites (which they should when they are rotating).
 
 
Renamed the file to ItemHolder.pk3 since this evolved into more than just racks and shelves now.
https://drive.google.com/file/d/1AfEYz6KeSwoPR6UTMuQTNY2g3Op5eEeV/view?usp=sharing
Last edit: 6 months 1 day ago by DeVloek.

Please Log in or Create an account to join the conversation.

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Arachnotron
  • Arachnotron
More
6 months 1 day ago #7 by DeVloek
Replied by DeVloek on topic WIP - Gun racks
Update:

added shelves for big items

   
 

Please Log in or Create an account to join the conversation.