Page 1 of 1

Inventory items as DECORATE variables

Posted: Mon Nov 22, 2010 5:02 pm
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?

Re: Inventory items as DECORATE variables

Posted: Mon Nov 22, 2010 7:09 pm
by jpalomo
Would it be possible with a user variable?

Re: Inventory items as DECORATE variables

Posted: Mon Nov 22, 2010 7:25 pm
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.)

Re: Inventory items as DECORATE variables

Posted: Tue Nov 23, 2010 1:25 am
by Gez
This is not possible as a variable. The best you can hope for is a function (like sin() and cos()).

Re: Inventory items as DECORATE variables

Posted: Tue Nov 23, 2010 1:55 am
by Graf Zahl
This one's a clear WFDS proposition.

Re: Inventory items as DECORATE variables

Posted: Tue Nov 23, 2010 3:01 pm
by wildweasel
Well shit. Looks like it's time for cheap hacks and brute force (or just canceling my project!)

Re: Inventory items as DECORATE variables

Posted: Tue Nov 23, 2010 5:05 pm
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.

Re: Inventory items as DECORATE variables

Posted: Tue Nov 23, 2010 7:00 pm
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

Re: Inventory items as DECORATE variables

Posted: Sat Dec 04, 2010 11:10 am
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.

Re: Inventory items as DECORATE variables

Posted: Sat Dec 04, 2010 11:36 am
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.