[WFDS] Inventory items as DECORATE variables

Moderator: GZDoom Developers

Inventory items as DECORATE variables

Postby wildweasel » Mon Nov 22, 2010 6:02 pm

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
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: Inventory items as DECORATE variables

Postby jpalomo » Mon Nov 22, 2010 8:09 pm

Would it be possible with a user variable?
User avatar
jpalomo
 
Joined: 17 May 2010

Re: Inventory items as DECORATE variables

Postby DavidPH » Mon Nov 22, 2010 8:25 pm

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.)
User avatar
DavidPH
Crazy Compiler Man
 
Joined: 28 Aug 2009

Re: Inventory items as DECORATE variables

Postby Gez » Tue Nov 23, 2010 2:25 am

This is not possible as a variable. The best you can hope for is a function (like sin() and cos()).
Gez
 
 
 
Joined: 06 Jul 2007

Re: Inventory items as DECORATE variables

Postby Graf Zahl » Tue Nov 23, 2010 2:55 am

This one's a clear WFDS proposition.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Inventory items as DECORATE variables

Postby wildweasel » Tue Nov 23, 2010 4:01 pm

Well shit. Looks like it's time for cheap hacks and brute force (or just canceling my project!)
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: Inventory items as DECORATE variables

Postby Kate » Tue Nov 23, 2010 6:05 pm

for reference, you can do it like this:

Make an ACS Library and make a script that looks like this:

Code: Select allExpand view
#library "LUMPNAME"
#include "zcommon.acs"

Script 256 (void)
{
    SetResultValue (CheckInventory ("InventoryItem"));
}

Make sure it's loaded using LOADACS by listing it on a line in the lump.

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

Code: Select allExpand view
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
Kate
... in loving memory ...
 
Joined: 15 Jul 2003

Re: Inventory items as DECORATE variables

Postby Ethril » Tue Nov 23, 2010 8:00 pm

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
Ethril
F1
 
Joined: 16 Nov 2008
Location: Guidance Gate

Re: Inventory items as DECORATE variables

Postby Major Cooke » Sat Dec 04, 2010 12:10 pm

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
Major Cooke
Do unto others as you would have unto you. Judge yourself first.
 
Joined: 28 Jan 2007

Re: Inventory items as DECORATE variables

Postby Mikk- » Sat Dec 04, 2010 12:36 pm

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.
User avatar
Mikk-
yooooooooooo
 
Joined: 30 Jun 2009
Location: Somewhere off Kanagawa
Discord: Mikk0451#3922


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests