Inventory items as DECORATE variables
Moderator: GZDoom Developers
- 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
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?
Could it be made so that I can use the value of an inventory item as a variable for a Decorate expression?
Re: Inventory items as DECORATE variables
Would it be possible with a user variable?
Re: Inventory items as DECORATE variables
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.)
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.)
Re: Inventory items as DECORATE variables
This is not possible as a variable. The best you can hope for is a function (like sin() and cos()).
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49056
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Inventory items as DECORATE variables
This one's a clear WFDS proposition.
- 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
Well shit. Looks like it's time for cheap hacks and brute force (or just canceling my project!)
Re: Inventory items as DECORATE variables
for reference, you can do it like this:
Make an [wiki=Libraries]ACS Library[/wiki] and make a script that looks like this:
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:
Hopefully it should be simple enough.
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"));
}
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)
Re: Inventory items as DECORATE variables
Bah, it wouldn't be a proper Doom mod without any cheap hacks anyway.wildweasel wrote:Well shit. Looks like it's time for cheap hacks and brute force (or just canceling my project!)
- 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
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.
Re: Inventory items as DECORATE variables
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.