Picking up weapons by pressing a button
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Picking up weapons by pressing a button
Hi!!
Well in my mod there are TONS of guns, this becomes rly annoying when you dont want a weapon anymore and maybe monsters drop them (like shotgunguy's shotgun) so occasionally you will be picking up it accidentally... what i wanted is something to make weapons unable to be picked up unless you press a button.
I don't have any idea of how to make this... any help would be REALLY appreciated.
Well in my mod there are TONS of guns, this becomes rly annoying when you dont want a weapon anymore and maybe monsters drop them (like shotgunguy's shotgun) so occasionally you will be picking up it accidentally... what i wanted is something to make weapons unable to be picked up unless you press a button.
I don't have any idea of how to make this... any help would be REALLY appreciated.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Picking up weapons by pressing a button
The simplest way to do it is to have a constantly looping ACS script that calls [wiki]GetPlayerInput[/wiki], checks to see if the player is pressing Use, and if they are, give them a custominventory item that sets them to be able to pick up items, and if they're not hitting Use, do the opposite:With this, you have to be holding down the use key while running over something in order to pick it up.
The other option is to replace every pickup with a switchable decoration, which lets you literally use something to pick it up in the style of a modern FPS, but it is extremely tedious and a bit complicated to set up, and will break compatibility with virtually every other gameplay/weapon mod.
Code: Select all
//ACS
if (GetPlayerInput(-1,MODINPUT_BUTTONS) & BT_USE){
GiveInventory("CanPickUpItems",1);
}else{
GiveInventory("CantPickUpItems",1);
}
//DECORATE
actor CanPickUpItems : CustomInventory
{
states
{
pickup:
TNT1 A 0 A_ChangeFlag("pickup",1)
fail
}
}
actor CantPickUpItems : CustomInventory
{
states
{
pickup:
TNT1 A 0 A_ChangeFlag("pickup",0)
fail
}
}
The other option is to replace every pickup with a switchable decoration, which lets you literally use something to pick it up in the style of a modern FPS, but it is extremely tedious and a bit complicated to set up, and will break compatibility with virtually every other gameplay/weapon mod.
Re: Picking up weapons by pressing a button
I dont know what am i doing wrong but the ACS is not working (sorry i almost dont know anything about ACS)
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Picking up weapons by pressing a button
Here's the beginner's guide to get you started. Setting up DoomBuilder/ACC/etc. is something perhaps best left to someone who isn't me to explain since I have a bit of a bad history of trying to get things working.
A full ACS file to do this would be something more like this:Then you'd need a LOADACS lump that is a text file with YOURPROJECTNAME (i.e., whatever you're calling this ACS thing) written in it. That will tell ZDoom to load that ACS script on every level.
A full ACS file to do this would be something more like this:
Code: Select all
#library "YOURPROJECTNAME"
#include "zcommon.acs"
script "watchforspace" ENTER{
if (GetPlayerInput(-1,MODINPUT_BUTTONS) & BT_USE){
GiveInventory("CanPickUpItems",1);
}else{
GiveInventory("CantPickUpItems",1);
}
delay(1);
restart;
}
Re: Picking up weapons by pressing a button
If you have your own weapons set and don't want the doom weapons then shouldn't you replace them?
Re: Picking up weapons by pressing a button
@Vae's code: Isn't the code supposed to be this:
Doesn't make much sense in its current form.
EDIT: Goddamnit, missed the T in CantPickupItems. My mistake.
Code: Select all
else { TAKEinventory("CanPickUpItems", 1) }
EDIT: Goddamnit, missed the T in CantPickupItems. My mistake.
Re: Picking up weapons by pressing a button
Wooooooooo.... right this looks like it's going to be fun to learn. Trial and error here I come.
- LastManonEarth
- Posts: 44
- Joined: Mon Apr 25, 2016 4:25 pm
Re: Picking up weapons by pressing a button
This is related with intention I always had: limited arsenal. Limited weight to pick wepons. i.e You can pick 4 light weapons, or 2 heavy ones, 3 mid-sized etc.
Drop and pick buttons will be needed.
Drop and pick buttons will be needed.
- The Zombie Killer
- Posts: 1528
- Joined: Thu Jul 14, 2011 12:06 am
- Location: Gold Coast, Queensland, Australia
Re: Picking up weapons by pressing a button
Note that A_CheckProximity is in ACS now, although there isn't a wiki page yet. So you can use that instead of decorate item hacks now
bool CheckProximity(int tid, str class, double distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT)
bool CheckProximity(int tid, str class, double distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT)