header general

WIP - Gun racks

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Wicked
  • Wicked
More
3 months 3 weeks ago - 3 months 3 weeks ago #1 by DeVloek
WIP - Gun racks 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.



Name: Gun Rack
Connection: none
Palette: Doom
Summon: GunrackS1, GunrackS2, GunrackS3, GunrackS4, GunrackL1, GunrackL2, GunrackL3, GunrackL4, Ammoshelf
Ambient Sound: No
De-/Activatable: No
Destroyable: No
Special Effects: No
Brightmaps: No
Actor modification: No
ACS: No

Description:
A simple gun rack wallsprite, comes in several variants. Usage:
  1. Open a map editor and create a wall.
  2. Place a rack against the wall, at least 1 mp away to avoid clipping. Also make sure the angle faces 90° away from the wall.
  3. Place some weapons close to the rack (within 64 mp).
This is how the screenshot above looks like in UDB:

The weapons will be automatically attached to the gun rack. Supports custom weapons as long as they inherit from the base weapon class.
Small racks can hold up to 3, large racks up to 6 weapons. You can pick up and use the weapons as normal.


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

edit: added ammoshelf. Same concept, its a wallsprite that auto-attaches nearby ammo items
another edit: now supports dropped/summoned items
Last edit: 3 months 3 weeks ago by DeVloek. Reason: updated file

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

  • CaptainToenail
  • CaptainToenail's Avatar
  • Wicked
  • Wicked
More
3 months 3 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
  • Wicked
  • Wicked
More
3 months 3 weeks ago - 3 months 3 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: 3 months 3 weeks ago by DeVloek.

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

  • DeVloek
  • DeVloek's Avatar Topic Author
  • Wicked
  • Wicked
More
3 months 3 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.