No announcement yet.

Help with Inventory Demo Implementation

  • Filter
  • Time
  • Show
Clear All
new posts

    Help with Inventory Demo Implementation

    Yet another person trying to make sense of the inventory demo :P.

    I have read many of the posts and am trying to just take the InventoryDemo.fla file and populate it with my own data from UDK. Basically I want to start by populating the "itemData" object that you can see under the demoComponents layer.


    function SetUpInventory()
        local byte i;
        local GFxObject DataProvider;
        local GFxObject TempObj;
        local GFxObject RootMC, DemoMC;
        local RHPlayerController RPC;
        RPC = RHPlayerController(GetPC());
        DemoMC = GetVariableObject("_root.demoComponents");
        DataProvider = CreateArray();
        for (i = 0; i < RPC.Inventory.Length; i++)
            TempObj = CreateObject("Object");
            TempObj.SetString("type", RPC.Inventory[i].theName);
            TempObj.SetFloat("asset", RPC.Inventory[i].asset); 
            TempObj.SetFloat("quantity", RPC.Inventory[i].quantity);
            DataProvider.SetElementObject(i, TempObj);
        DemoMC.SetObject("itemData", DataProvider);
    Because the "itemData" object lives on the "demoComponents" layer, I am setting the DemoMC variable to that. Right now, my inventory items in UDK only have a name, asset #, and quantity because I wanted to try and keep it as similar as possible to the demo.

    I actually was logging the actionscript variable within UDK to make sure the values were being populated and they were so I am not sure what the issue is.

    For the ShowInventory() function within Flash, I have the following function on the iconpanel layer:


    function ShowInventory():Void
    for (var i:Number = 0; i<12; i++)
        this["slot"+i].data = _parent.itemData[i];
    Any help would be greatly appreciated!!!!!!! Thanks guys!

    bump, please I need to understand it too

    How to customize itemdata and icons within the inventory demo?


      ok, sorry for that previous noob question, but I've just found the solution studying by myself flash.