View Issue Details

IDProjectCategoryView StatusLast Update
0000399Gameplay + OpenGL[All Projects] Featurepublic2017-03-08 05:50
ReporterLud 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionno change required 
PlatformMicrosoft WindowsOSWindowsOS Version10
Summary0000399: Ability to use variables for Inventory.MaxAmount.
DescriptionEither that or a function such as A_SetMaxInventory. Can make the latter a separate report if needed, but it's basically the same thing, essentially.

I would use it so that I can customize the actor's MaxAmount from within the game and not have to tinker with the source code every time.
TagsNo tags attached.

Relationships

Activities

Graf Zahl

Graf Zahl

2017-03-07 11:35

administrator   ~0000902

You can do that with ZScript. MaxAmount is a normal interger variable in the Inventory class. But you have to be careful, if the item gets completely removed you will lose the counter!
Lud

Lud

2017-03-07 17:29

reporter   ~0000906

class BarracudaUpgradeExperience : Inventory
{
    int CustomVar;
    
    override void BeginPlay()
    {
        CustomVar = GetCVAR("v_barracuda_mod_min");
        Super.BeginPlay();
    }

    Default
    {
        Inventory.MaxAmount CustomVar;
    }
}

So where in this code am I screwing up? What I'm trying to do is to be able to set the MaxInventory property on creating the actor in the inventory so I can dynamically adjust how many items of that class the player can have. I have a feeling it might be the wrong function, but I can't seem to find the right one.

I get this error on start-up: Unable to access class member CustomVar from constant declaration
My debugging skills when it comes to ZScript aren't anywhere near great. Any help would be greatly appreciated.
Graf Zahl

Graf Zahl

2017-03-08 03:19

administrator   ~0000910

You have do set MaxAmount inside your code. (MaxAmount = GetCVar("blahblah")) You cannot set a static property to an address, it's physically impossible.
Lud

Lud

2017-03-08 05:50

reporter   ~0000913

You're a hero, Graf. It works flawlessly. Thank you for the help!

Issue History

Date Modified Username Field Change
2017-03-07 09:52 Lud New Issue
2017-03-07 11:35 Graf Zahl Note Added: 0000902
2017-03-07 11:35 Graf Zahl Status new => closed
2017-03-07 11:35 Graf Zahl Resolution open => no change required
2017-03-07 17:29 Lud Note Added: 0000906
2017-03-08 03:19 Graf Zahl Note Added: 0000910
2017-03-08 05:50 Lud Note Added: 0000913