Only pickup item if it doesn't waste
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Only pickup item if it doesn't waste
I hate picking up medikits when I have 99 health, wasting 24 health potential from the medikit. Sometimes by accident. Sometimes by no choice due to narrow hallways. Same deal with ammo and armor.
Does such a mode exist that only allows you to pick up items if no waste occurs in the process? Perhaps easily toggle-able in case you prefer a full top off even if it does waste, such as when you're about to exit a level.
(Taking just a portion of a box doesn't seem like a good alternative, as when you take the remaining portion later, the disappointment of not getting a full box would probably suck!)
EDIT: that's per item waste, the concept of map waste explained on the Oct15 2017 reply.
Does such a mode exist that only allows you to pick up items if no waste occurs in the process? Perhaps easily toggle-able in case you prefer a full top off even if it does waste, such as when you're about to exit a level.
(Taking just a portion of a box doesn't seem like a good alternative, as when you take the remaining portion later, the disappointment of not getting a full box would probably suck!)
EDIT: that's per item waste, the concept of map waste explained on the Oct15 2017 reply.
Last edited by Hypersonic on Sun Oct 15, 2017 1:08 pm, edited 1 time in total.
Re: Only pickup item if it doesn't waste
Well, it should certainly be possible via DECORATE using JumpIfInInventory, A_JumpIfHealthLower etc., but it would have to be done for every single item that gives more than one.
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Re: Only pickup item if it doesn't waste
Is decorate a server side scripting language like QuakeC? I actually did this for Quake1, would be nice to do with GZDoom.
I know you can drop weapons in GZDoom, can you drop ammo as well?
I know you can drop weapons in GZDoom, can you drop ammo as well?
Re: Only pickup item if it doesn't waste
I recommend reading the page on DECORATE on the zDoom wiki, it should help explain the concept. It is used to create and modify actors, so it's not really a programming language but it still is very flexible.
Basically, in your case, in the Pickup state, you would check if the player has at least as much health or as many of the items, minus the amount he would get, and if that's the case, ignore stop the pickup state.
Basically, in your case, in the Pickup state, you would check if the player has at least as much health or as many of the items, minus the amount he would get, and if that's the case, ignore stop the pickup state.
Re: Only pickup item if it doesn't waste
ZScript allows you to do this much easier than DECORATE. Probably what's needed is to override one of the pickup methods of the Inventory class. Since the OP has experience with QuakeC, they should feel right at home with ZScript.
-
- Posts: 4949
- Joined: Sun Nov 14, 2010 12:59 am
Re: Only pickup item if it doesn't waste
Looks like what you want is Smart Scavenger.
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Re: Only pickup item if it doesn't waste
Neat mod. Would be nice if it went a step further. Skill 3: if you have 399 bullets it'll split a 100 ammo clipbox into 5 20 ammo clips. However, it'll still waste 19 bullets when you pick up a 20 ammo clip when you have 399 bullets in inventory. It should just not let you pick it up until your inventory is 380 or below.
Re: Only pickup item if it doesn't waste
Well, it is not exactly what you want, but 'Mindfuck' is a DECORATE based mod in wich itens most be "used" (with the use key) and you'll only get the amount of suplies that you are able to carry. Here is an example of the shell box:
Well, maybe even easier with Zscript, but I'd already done that before Zscript arrive, so...anyway.
Spoiler:I seems a bit complicated because I have different sprites for each event of the box (closed, opened, empty, destroyed), and have animations for them. But it could be done easy with DECORATE.
Well, maybe even easier with Zscript, but I'd already done that before Zscript arrive, so...anyway.
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Re: Only pickup item if it doesn't waste
Seems like having to use items to pick them up could get annoying after awhile. Perhaps press use to not pick up items for narrow corridors? The code looks a little bit like GTA mod code with what appear to be goto logic. WIth QuakeC all I did was alter the pickup threshold. For example instead of 100 health, I'd change it to 80 health threshold for health items that granted 20 health pts.
Re: Only pickup item if it doesn't waste
ZScript it is then, man. Also, it possible to inject monster code into items, so that when you come into pickup range of an item, it would try to target you, and it's where it gives you stuff, and self-destructs if it has none anymore.
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Re: Only pickup item if it doesn't waste
Has the game logic been converted to Zscript? In the original Doom/Heretic the game logic was written in C and compiled into the executable. With Quake much of the game logic was in QuakeC, with physics remaining in the engine.
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Re: Only pickup item if it doesn't waste
A step further would be to also not to leave extra ammo behind on a map. Consider the following example situation:
You can hold 400 dragonclaw ammo, you currently have 100 dragonclaw ammo, and there are only 300 dragonclaw ammo left on the current map.
You can hold 400 rune ammo, you currently have 300 rune ammo, and there 300 rune ammo left on the current map.
You already have enough space to hold all the dragonclaw ammo, but not enough to hold the remaining rune ammo. So it would be best to fire the hellstaff until you have only 100 rune ammo so you can also hold all the remaining rune ammo.
Basically prevent level waste, as opposed to per item waste.
You can hold 400 dragonclaw ammo, you currently have 100 dragonclaw ammo, and there are only 300 dragonclaw ammo left on the current map.
You can hold 400 rune ammo, you currently have 300 rune ammo, and there 300 rune ammo left on the current map.
You already have enough space to hold all the dragonclaw ammo, but not enough to hold the remaining rune ammo. So it would be best to fire the hellstaff until you have only 100 rune ammo so you can also hold all the remaining rune ammo.
Basically prevent level waste, as opposed to per item waste.
-
- Posts: 134
- Joined: Mon Aug 14, 2017 3:04 pm
Re: Only pickup item if it doesn't waste
I think I found where in the code it handles ammo pickup
https://github.com/coelckers/gzdoom/blo ... y/ammo.txt
override bool HandlePickup (Inventory item)
It clued me in to the variable sv_unlimited_pickup which I'm trying out now. I'm going to try playing entire episodes (2nd hardest skill) keeping ammo amounts roughly even (percentage wise) and see how much ammo I'm left with at the end of the episode. Absolutely no "level ammo waste" nor "per item waste" while being careful to grab it all.
To prevent "per item waste" this line would probably have to be expanded on (I assume Amount refers to how much the player has)
if (Amount < MaxAmount || sv_unlimited_pickup)
To something like
if (Amount + item.Amount < MaxAmount || sv_unlimited_pickup)
To give the player a choice to topoff their ammo before leaving a level going on a scavenger hunt, perhaps introduce a topoff variable
if ((Amount + item.Amount < MaxAmount) || sv_unlimited_pickup || (topoff && Amount < MaxAmount))
Similarly with health
https://github.com/coelckers/gzdoom/blo ... health.txt
override bool TryPickup (in out Actor other)
And with armor
https://github.com/coelckers/gzdoom/blo ... /armor.txt
override bool HandlePickup (Inventory item)
https://github.com/coelckers/gzdoom/blo ... y/ammo.txt
override bool HandlePickup (Inventory item)
It clued me in to the variable sv_unlimited_pickup which I'm trying out now. I'm going to try playing entire episodes (2nd hardest skill) keeping ammo amounts roughly even (percentage wise) and see how much ammo I'm left with at the end of the episode. Absolutely no "level ammo waste" nor "per item waste" while being careful to grab it all.
To prevent "per item waste" this line would probably have to be expanded on (I assume Amount refers to how much the player has)
if (Amount < MaxAmount || sv_unlimited_pickup)
To something like
if (Amount + item.Amount < MaxAmount || sv_unlimited_pickup)
To give the player a choice to topoff their ammo before leaving a level going on a scavenger hunt, perhaps introduce a topoff variable
if ((Amount + item.Amount < MaxAmount) || sv_unlimited_pickup || (topoff && Amount < MaxAmount))
Similarly with health
https://github.com/coelckers/gzdoom/blo ... health.txt
override bool TryPickup (in out Actor other)
And with armor
https://github.com/coelckers/gzdoom/blo ... /armor.txt
override bool HandlePickup (Inventory item)