Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How was the inventory system in Swordburst II done?

Asked by 6 years ago

I want to to try coding it myself as I am building a RPG from scratch, but I can't seem to pinpoint the algorithm on how it is done, like how it saves how the weapon equips how the trade works, is it done in a database? etc2.

0
I think i know how to do it? WedWhackerIX -4 — 6y
0
Try adding a toolbox sword is that what your looking for? WedWhackerIX -4 — 6y
0
Here are the ingredients, looping, tables, boolvalue, and data stores. Check each boxes in the inventory system, and loop them which then sets images to each box. You of course do this by loading the data, and firing a event to client to then be stored in a parameter as a table is there. Once done, set up the loop for the boxes and check for boolvalue named 'Empty'. Do the loop, and include end. liteImpulse 47 — 6y
0
The images are set by creating a table full of asset Id's of the items, I can keep going on with my system but there is similar ways. liteImpulse 47 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Here's an example of it loading from a Halloween project of mines:

local itemImages = {BatBag = 1100717940, SpookyBag = 1100713485, Assassin = 1101322675, CyborgRobot = 1100642982,
    Dino = 1100627791, DragonClaw = 1109312454, GoldenSuit = 1106505688, Korblox = 1100636628, Mummy = 1100627970,
    Robot = 1109286574, Skeleton = 1100628054, Vampire = 1109291534, Werewolf = 1109298324, Witch = 1100634227,
    Zombie = 1101322890, Balloon = 1124173755, Alligator = 1100538890, Doge = 1100495144, Duck = 1100540326,
    IceDragon = 1100534252, Penguin = 1099554010, Pony = 1100536636, Pumpkin = 1100542892, RedDragon = 1100498452,
    Bicycle = 1107566033, EvilRoped = 1100782059, GoldenRoped = 1100782148, HyperBike = 1106485232, Motorcycle = 1100781914,
    Superbike = 1107523068, MidnightMotorcycle = 1128283829, GhostDragon = 1128283587, HalloweenFireworks = 1128284020, Tarantula = 1128283703, PumpkinBag = 1100713612,
    PumpkinTrickorTreater = 1139816580, TheLondoner = 1139805489, SkeletonDog = 1139826749,
}

local loadInventory = spawn(function()
    AssignData.OnClientEvent:Connect(function(allData)
        local dataTable = {Vehicles = allData.Vehicles, Gears = allData.Gears, Costumes = allData.Costumes,
            Pet = allData.Pet, Bags = allData.Bags, EquippedGear = allData.gearEquipped, EquippedPet = allData.petEquipped,
            EquippedBag = allData.bagEquipped, EquippedCostume = allData.costumeEquipped, EquippedVehicle = allData.vehicleEquipped,
        }

        local loadBags = spawn(function()
         local frame = InventoryFrame.Frames.Bags:GetChildren()
        for i = 1,#frame do
            if frame[i]:IsA("ImageButton") and frame[i].item.Value == "Empty" then
                local costumeTable = dataTable.Bags
                for i = 1,#costumeTable do
                    frame[i].item.Value = costumeTable[i]
                    frame[i].Visible = true
                    frame[i].ItemImage.Image = "rbxassetid://".. tostring(itemImages[costumeTable[i]])
                    frame[i].BorderColor3 = Color3.new(27/255,42/255,53/255)
                    if dataTable.EquippedBag == costumeTable[i] then
                    frame[i].BorderColor3 = Color3.new(0,170/255,0)
                    end
                    if mainFrame.Parent.ShopFrame.TabConnection.Bags:FindFirstChild(costumeTable[i]) then
                    mainFrame.Parent.ShopFrame.TabConnection.Bags[costumeTable[i]].TextButton.Text = "Own"
                    end
                    frame[i].Parent.PopUp.Visible = false
                end
            end
        end
        end)
end)
0
That is for inventory, trade is something similar to this but just more logic into it. liteImpulse 47 — 6y
Ad

Answer this question