Forum begins after the advertisement:

[Part 15/16] New weapon system

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #13327

    So I’ve been playing around with the new weapon system and I came across some bugs. I don’t know it’s just me or everyone but:
    -New Player Inventory system:
    Player can have up to 6 weapons and if the number of available weapons (weapon data) are 7 or more, new weapon will show up when player already have 6 weapons in the inventory and it’s unclickable (because i already have 6 wps)

    -Random growth is stacking up stats. For example I have knife(max lv8) 1-5 is linear and 5a, 5b, 5c is random growth. Stats from them will stack if upgrades pop up as 5c (stats in 5c will become 5a+5b+5c instead)


    Hi Kai, thanks for the heads up. Let me look into this and get back to you.


    My bad on the first one, I set the weapon slots and passive slots to 6 (i don’t remember how), but still, new weapons show up when the weapon slots are full


    Hi Kai, below is a quick temporary fix. I will be addressing this issue in Part 18 of the series.

        // Finds an empty slot and adds a weapon of a certain type, returns
        // the slot number that the item was put in.
        public int Add(WeaponData data)
            int slotNum = -1;
            // Try to find an empty slot.
            for(int i = 0; i < weaponSlots.Capacity; i++)
                if (weaponSlots[i].IsEmpty())
                    slotNum = i;
            // If there is no empty slot, exit.
            if (slotNum < 0) return slotNum;
            else if(slotNum > 5) return -1;
            // Otherwise create the weapon in the slot.
            // Get the type of the weapon we want to spawn.
            Type weaponType = Type.GetType(data.behaviour);
            if (weaponType != null)
                // Spawn the weapon GameObject.
                GameObject go = new GameObject( + " Controller");
                Weapon spawnedWeapon = (Weapon)go.AddComponent(weaponType);
                spawnedWeapon.transform.SetParent(transform); //Set the weapon to be a child of the player
                spawnedWeapon.transform.localPosition =;
                // Assign the weapon to the slot.
                // Close the level up UI if it is on.
                if (GameManager.instance != null && GameManager.instance.choosingUpgrade)
                return slotNum;
                    "Invalid weapon type specified for {0}.",
            return -1;
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Go to Login Page →

Advertisement below: