1. Hello! I am currently trying to unlock all of the items for a player. I have been able to give a player XP, but I just want to be able to unlock all items for a player.

    I noticed that players still have PlayerBlueprints which contains the function Unlock(ItemDefinition).

    Do anyone know where how I can find or create the list of ItemDefinitions that players can unlock? If this will even work :p
    [DOUBLEPOST=1467933484][/DOUBLEPOST]Nevermind! I figured it out! My old code still works :)

    For anyone wondering:
    Code:
    foreach(ItemDefinition i in ItemManager.itemList)
                {
                    player.blueprints.Unlock(i);
                }
     
  2. how did u unlock it for every one ?
     
  3. Hi are you sure this is working? It loops through all the items, but in testing just now it doesn't appear to unlock anything for me in game.
     
  4. You must either loop through all players, or include this function in OnPlayerInit().

    You also have to give experience in order to level up the player in order to craft items. Just because it is "unlocked" doesn't mean you are high enough level to do it.
     
  5. Code:
            void Regalos(BasePlayer player)
            {
                if (!player.IsAdmin()) return;
                foreach (BasePlayer jugador in BasePlayer.activePlayerList)
                {
                    AddLevel(jugador, 50);
                }
            }
            void AddLevel(BasePlayer player, int level)
            {
                float currentlevel = player.xp.CurrentLevel;
                float leveltoxp = Rust.Xp.Config.LevelToXp((int)currentlevel + level);
                player.xp.Reset();
                player.xp.Add(Rust.Xp.Definitions.Cheat, leveltoxp);
            }
     
  6. Yeah I understand, I was using the code properly, had it run for my test player and spit out the text version of each item, I mean It didn't appear to add anything to the "locked" list in the game UI indicating it was unlocked. Are you using this with latest version of rust server and oxide? Just so I know it's still working for you.
     
  7. @Caffeine Yes, It is still working. However @Reynostrum posted a very good solution for giving a specfic level. If you would like you can PM me and I can help you out :)
     
  8. So
    Code:
    foreach(ItemDefinition i in ItemManager.itemList)
                {
                    player.blueprints.Unlock(i);
                }
    Unlocks all the items with the XP system?
     
  9. Yes it works also I posted code here on how to lock everything Request - XP unlock all content on connect | Oxide
     
  10. Also I posted here some wrapper functions to utilize the Xp system New Xp Functions | Oxide
     
  11. Wulf

    Wulf Community Admin

  12. Thanks, seems like you know a fair bit about the XP system, check out the latest post in Rust Dev.