[DECORATE+ACS] Passing args via CustomInventory

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Ravick
Posts: 2056
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil

[DECORATE+ACS] Passing args via CustomInventory

Post by Ravick »

Hi there.

I'm making an item for a mod which team asked me not to use ZScript. It should be an CustomInventory that, when picked up, would pass two arguments to a global script.
The idea is that the mappers could simple set the args in the item on their maps and the item would execute the script871 with proper vars when picked up.

However, it seems to always pass zero values. My guess is that, as the item gets excluded from the game when a player gets it, the player is the activator of the script and it is his arguments, and not the CustomInventory's, that are being passed.

The CustomInventory actually uses 3 args: the args[2] define its skin and is not related to the problem. Args[0] and args[1] are the ones that really matter, as follows:

Code: Select all


actor CODEXPAGE : CustomInventory 12045
{
  //$Category Unbroken Stuff//Artifacts
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  +INVENTORY.QUIET
  Inventory.PickupMessage "New Codex entry."
    States
    {
    Spawn:
        FLOP Y 0
		
		//this part simply uses args[2] to choose a skin, and is not important now
		(...)
		
		
    Pickup:
		TNT1 A 0 ACS_ExecuteAlways(871, 0, Args[0], Args[1])
        Stop
    }
}

I've already tried to pass the values both as user_vars:

Code: Select all

    Spawn:
        FLOP Y 0	
	TNT1 A 0 A_SetUserVar("user_categoria", Args[0]
        TNT1 A 0 A_SetUserVar("user_pagina", Args[1])
        
        (...)
        
        
    Pickup:
        TNT1 A 0 ACS_ExecuteAlways(871, 0, "user_categoria", "user_pagina")
        Stop
...and as dummy items:

Code: Select all

    Pickup:
	TNT1 A 0 A_GiveInventory("CodexChapterDummy", Args[0])
        TNT1 A 0 A_GiveInventory("CodexIndexDummy", Args[1])
        Stop
    }
}

actor CodexChapterDummy : Inventory { Inventory.MaxAmount 99 -INVBAR }
actor CodexIndexDummy   : Inventory { Inventory.MaxAmount 99 -INVBAR }
But the script 871 always execute the actions from when it gets zero for both vars. How can I make it work just in Decorate and ACS?

Thanks in advanced. :)

Return to “Scripting”