Inventory items as DECORATE variables

Moderator: GZDoom Developers

Post Reply
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:

Inventory items as DECORATE variables

Post by wildweasel »

What I want to do is make Strife's assault gun produce recoil when fired using A_SetPitch, but have the recoil amount be proportional to the value of Strife's UpgradeAccuracy inventory item. There doesn't seem to be a way to do this outside of either mass brute-forcing using A_JumpIfInventory, or an ACS script which I would much rather avoid.

Could it be made so that I can use the value of an inventory item as a variable for a Decorate expression?
User avatar
jpalomo
Posts: 771
Joined: Mon May 17, 2010 9:45 am

Re: Inventory items as DECORATE variables

Post by jpalomo »

Would it be possible with a user variable?
User avatar
DavidPH
Posts: 382
Joined: Fri Aug 28, 2009 1:46 pm

Re: Inventory items as DECORATE variables

Post by DavidPH »

Except that user vars don't work with weapons. And even if they did, that doesn't solve the fundamental problem of being unable to acquire inventory counts without a long series of conditional jumps.

The one thing I can think of would be a new DECORATE function. But I don't know how functions are handled in DECORATE to know what that would entail. (Being able to directly access inventory counts, though, would be a generally useful feature itself, though.)
Gez
 
 
Posts: 17833
Joined: Fri Jul 06, 2007 3:22 pm

Re: Inventory items as DECORATE variables

Post by Gez »

This is not possible as a variable. The best you can hope for is a function (like sin() and cos()).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Inventory items as DECORATE variables

Post by Graf Zahl »

This one's a clear WFDS proposition.
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: Inventory items as DECORATE variables

Post by wildweasel »

Well shit. Looks like it's time for cheap hacks and brute force (or just canceling my project!)
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: Inventory items as DECORATE variables

Post by Kate »

for reference, you can do it like this:

Make an [wiki=Libraries]ACS Library[/wiki] and make a script that looks like this:

Code: Select all

#library "LUMPNAME"
#include "zcommon.acs"

Script 256 (void)
{
    SetResultValue (CheckInventory ("InventoryItem"));
}
Make sure it's loaded using [wiki]LOADACS[/wiki] by listing it on a line in the lump.

Then in your decorate code, use [wiki]ACS_ExecuteWithResult[/wiki] to call the script you made as part of the expression:

Code: Select all

Spawn:
    TNT1 AA 0 A_SpawnItemEx ("SomeObject", 0, 0, 32.0, 20.0 + (2.0 * ACS_ExecuteWithResult (256)), 0, 0, 0)
Hopefully it should be simple enough.
User avatar
Ethril
Posts: 2677
Joined: Sun Nov 16, 2008 2:59 am
Location: with you in the dark

Re: Inventory items as DECORATE variables

Post by Ethril »

wildweasel wrote:Well shit. Looks like it's time for cheap hacks and brute force (or just canceling my project!)
Bah, it wouldn't be a proper Doom mod without any cheap hacks anyway. :P
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Inventory items as DECORATE variables

Post by Major Cooke »

Pink: That's exactly what he wants to avoid doing. I think he doesn't want to put up with any ACS stuff at all.
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Re: Inventory items as DECORATE variables

Post by Mikk- »

Pink: That wouldn't work, because of the way UpgradeAccuracy and UpgradeStamina are coded, they don't carry in the inventory like any other item, so CheckInventory and any other inventory check code-pointers.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”