Forum begins after the advertisement:


[Part 12] Empty Level Up Screen Causing Hard Lock + Some other trouble spots!

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [Part 12] Empty Level Up Screen Causing Hard Lock + Some other trouble spots!

Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • #11887
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    That’s great to hear Stefano :) I’ve sent you an email as well.

    #12115
    Sed
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    Hey! if you still didn’t resolve the empty level up screen or for anyone else interested here is a temp fix (no clue if its ideal or w/e.. it just works – Todd howard) Go in the “InventoryManager” script Define a new variable int maxUpgrades = 6; modify the 6 if your upgrades go to a higher/lower level

    Then scroll down to void ApplyUpgradeOptions() and then replace the first few lines to this

    <code>        List<WeaponUpgrade> availableWeaponUpgrades = weaponUpgradeOptions
                .Where(weaponUpgrade => weaponUpgrade.weaponData.Level < maxUpgrades)
                .ToList();
    
            List<PassiveItemUpgrade> availablePassiveItemUpgrades = passiveItemUpgradeOptions
                .Where(passiveItemUpgrade => passiveItemUpgrade.passiveItemData.Level < maxUpgrades)
            .ToList();
    
            if (availableWeaponUpgrades.Count == 0 && availablePassiveItemUpgrades.Count == 0)
            {
                GameManager.instance.EndLevelUp();
            }
    //REST OF THE CODE
            foreach (var upgradeOption in upgradeUIOptions)</code>

    Additionally I added a do…while loop inside each upgradeType which rerolls the chosenWeaponUpgrade && chosenPassiveItemUpgrade IF their level is maxUpgrades(6). Here for weapon (find the if upgrade type = 1):

    <code>            if (upgradeType == 1)
                {
                    WeaponUpgrade chosenWeaponUpgrade;
    
                    do
                    {
                        chosenWeaponUpgrade = availableWeaponUpgrades[Random.Range(0, availableWeaponUpgrades.Count)];
                        availableWeaponUpgrades.Remove(chosenWeaponUpgrade);
                    } while (chosenWeaponUpgrade.weaponData.Level == maxUpgrades);
    
                    //REST OF THE CODE
                    if (chosenWeaponUpgrade != null)</code>

    And here for passive (find the if upgradetype = 2):

    <code>            else if (upgradeType == 2)
                {
                    PassiveItemUpgrade chosenPassiveItemUpgrade;
    
                    do
                    {
                        chosenPassiveItemUpgrade = availablePassiveItemUpgrades[Random.Range(0, availablePassiveItemUpgrades.Count)];
                        availablePassiveItemUpgrades.Remove(chosenPassiveItemUpgrade);
                    } while (chosenPassiveItemUpgrade.passiveItemData.Level == maxUpgrades);
    
                    //REST OF THE CODE
                    if (chosenPassiveItemUpgrade != null)</code>

    sorry for the wall of text hope it helps

    also not sure if the code tags worked lol

Viewing 2 posts - 16 through 17 (of 17 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: