A Weapon Limit System

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
The Philosopher
Posts: 212
Joined: Thu Sep 20, 2018 1:00 pm
Preferred Pronouns: She/Her
Operating System Version (Optional): W10
Location: Santiago, Chile

A Weapon Limit System

Post by The Philosopher »

So i recently been playing STALKER and i wanted to emulate how the Weapons Equipment System from the game, Example: you can only have 1 Weapon of a class in your inventory (Pistol, SMG) but i dont know how, can anyone help me?
User avatar
SanyaWaffles
Posts: 843
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: A Weapon Limit System

Post by SanyaWaffles »

You can do it with ZScript. I implemented a ROTT-like weapon system for Scoot Hard DX in which you can only carry one type of missile weapon. Main difference is you must press +use when over a weapon if you have one all ready, to prevent spamming of picking up weapons. I then derive all missile weapons from this class.

https://github.com/SanyaWaffles/ScootHa ... on.zsc#L15

It's also doable via DECORATE/ACS as that's how the prototype back in 2013 did this... but it's such an awful way of doing it, I recommend going the ZScript route.

Not being familiar with the STALKER games, you'll probably need to adapt this more to your liking for what you're going for, but it's most likely possible.
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: A Weapon Limit System

Post by Dan_The_Noob »

there's probably some hacky way to do it using the SisterWeapon system, but zscript seems the obvious choice.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: A Weapon Limit System

Post by wildweasel »

I had previously done this with (almost) pure Decorate, for my ancient proof-of-concept mod, Magnum Opus. I would not recommend looking it up, though, as while it certainly _functions_, the code concepts behind it are certainly out of date by now.
Post Reply

Return to “Scripting”