Official Codex Discord Server

  1. Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.
    Dismiss Notice

Pathfinder: Kingmaker Modding Thread

Discussion in 'Codex Workshop' started by Pink Eye, May 10, 2020.

Tags:
  1. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    you still got errors?

    john it wasnt a question.. i was just curious why he still has error marks if he solved it :D
     
    Last edited: May 13, 2020
    • it is a mystery it is a mystery x 1
    ^ Top  
  2. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    I know, t'was a sarcastic mystery
     
    • When words are not enough When words are not enough x 1
    ^ Top  
  3. Pink Eye Monk Patron

    Pink Eye
    Joined:
    Oct 10, 2019
    Messages:
    3,120
    Location:
    The Stolen Lands
    Pathfinder: Kingmaker
  4. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    what did you learn pink. walk me through
    lets combine what you got so far with whitenons new sleek menu look
     
    Last edited: May 13, 2020
    ^ Top  
  5. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    Read some entry lvl c#/java crash course imo, or do a bunch of Unity tutorial

    Rob code isnt even that accessible iirc
     
    ^ Top  
  6. Pink Eye Monk Patron

    Pink Eye
    Joined:
    Oct 10, 2019
    Messages:
    3,120
    Location:
    The Stolen Lands
    Pathfinder: Kingmaker
    Brah. I've been obsessively reading this shit since yesterday. I haven't slept at all, and can't think straight. Discord trannies turned out to be zero help.
     
    • WTF am I reading WTF am I reading x 1
    ^ Top  
  7. Pink Eye Monk Patron

    Pink Eye
    Joined:
    Oct 10, 2019
    Messages:
    3,120
    Location:
    The Stolen Lands
    Pathfinder: Kingmaker
    Efe Could you take a look and tell me if you understand how to create an item and spawn it?
     
    ^ Top  
  8. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    ill look into it but i was hoping you would yield some results i can continue..
     
    ^ Top  
  9. Pink Eye Monk Patron

    Pink Eye
    Joined:
    Oct 10, 2019
    Messages:
    3,120
    Location:
    The Stolen Lands
    Pathfinder: Kingmaker
    Sorry, I couldn't figure out on my own. I really tried. I am going to sleep.
     
    • Friendly Friendly x 1
    ^ Top  
  10. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    [​IMG]
     
    • Funny Funny x 1
    ^ Top  
  11. razvedchiki Liturgist

    razvedchiki
    Joined:
    May 25, 2015
    Messages:
    2,793
    Location:
    on the back of a T34.
    make a sword coast stratagems type of mod.
     
    • Fabulously Optimistic Fabulously Optimistic x 1
    ^ Top  
  12. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    wish i could...
    i'd probably make a small fortune out of donations
     
    ^ Top  
  13. razvedchiki Liturgist

    razvedchiki
    Joined:
    May 25, 2015
    Messages:
    2,793
    Location:
    on the back of a T34.
    by the way what does the gold mod do?
     
    ^ Top  
  14. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    gives gold.
    its "hello world" of mods.
     
    • Informative Informative x 2
    ^ Top  
  15. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    @SCS

    It's a fucking big endeavor

    I kinda tried to implement some of its concept but mostly failed..

    IIRC, the AI is so complex to tweak or modify at the time I totally gave up on it

    As for tweaking each encounters/mobs, it's definetely doable but it's an herculean task
     
    ^ Top  
  16. razvedchiki Liturgist

    razvedchiki
    Joined:
    May 25, 2015
    Messages:
    2,793
    Location:
    on the back of a T34.
    well you can start by adding to some mobs the dispel spell, 2-3 casts per battle.
     
    ^ Top  
  17. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    You can add whatever spell you want, if the AI isn't using it it's useless
     
    ^ Top  
  18. WhiteScreenAnon Novice

    WhiteScreenAnon
    Joined:
    May 10, 2020
    Messages:
    56
    I understand how to make a tabbed menu now but I only understand it from a unity engine perspective
    https://imgur.com/a/DKe1lVL
    could you give me some insight on where I should be looking in bag of tricks?
     
    ^ Top  
  19. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    Why are you guys focusing your learning efforts on UMM menu again ?
     
    ^ Top  
  20. WhiteScreenAnon Novice

    WhiteScreenAnon
    Joined:
    May 10, 2020
    Messages:
    56
    well I'm just trying to build my knowledge right now i'm postponing the feat making
     
    ^ Top  
  21. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    Working on the UI is somewhat helpful to understand basic programming, sure

    But it has 'nothing' to do with PFKM modding.

    If your end goal is to make a mod, UI is the last of your worries.

    Not a lot of transferable knowledge here, and it isnt specially rewarding either on completion
     
    ^ Top  
  22. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    I was hoping pink and him would combine forces but alas it was not meant to be.

    Bag of tricks has menu.cs, which draws all of it. menutext.cs holds every string so its easily localized. menutools.cs has functions he implemented for ease of use.
    check menutools to see how he formats text with colors, bigger font, etc.

    You dont need to do everything bag of tricks does though. if you are done with basic menu making. Make a neat menu for gold mod that has collapsable menus. 3 categories for 1-time commands (give gold-xp-bp), item spawning and adding feats.

    try to see if you can add a toggle for every character in party which will be used when choosing who gets the feat chosen.

    john he can use this imgui knowledge on any unity game or unity project. As you say, its to grow him into programming logic
     
    ^ Top  
  23. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    Yeah sure, but they'd achieve the same (or better) by forgoing the UI.

    Programming ain't easy, so motivation is key.

    It's probably better to do 10 small barebone project, with simple and specific usecases than one trying to englobe 10 skillset
     
    ^ Top  
  24. John Keel Learned

    John Keel
    Joined:
    Aug 10, 2017
    Messages:
    349
    Random stuff I recovered:

    Code:
    class JakuHelpers
        {
            public static void AddToVendorTable(BlueprintItemWeapon blueprintItemWeapon, String sharedVendorTable, int count)
            {
                BlueprintItemWeapon Weapon = blueprintItemWeapon;
                int quantityToAdd = count;
                var LootItemPackFixed = Helpers.Create<Kingmaker.Blueprints.Loot.LootItemsPackFixed>();
                var lootItem = new Kingmaker.Blueprints.Loot.LootItem();
                Traverse.Create(lootItem).Field("m_Item").SetValue(Weapon);
                Traverse.Create(lootItem).Field("m_Type").SetValue(Kingmaker.Blueprints.Loot.LootItemType.Item);
                Traverse.Create(LootItemPackFixed).Field("m_Item").SetValue(lootItem);
                Traverse.Create(LootItemPackFixed).Field("m_Count").SetValue(quantityToAdd);
    
                var libraryLoot = ResourcesLibrary.TryGetBlueprint<BlueprintSharedVendorTable>(sharedVendorTable);
                libraryLoot.AddComponent(LootItemPackFixed);
    
            }
    
            public static void AddWandToVendorTable(String guidWand, String sharedVendorTable, int count)
            {
                BlueprintItemEquipmentUsable item = ResourcesLibrary.TryGetBlueprint<BlueprintItemEquipmentUsable>(guidWand);
                int quantityToAdd = count;
                var LootItemPackFixed = Helpers.Create<Kingmaker.Blueprints.Loot.LootItemsPackFixed>();
                var lootItem = new Kingmaker.Blueprints.Loot.LootItem();
                Traverse.Create(lootItem).Field("m_Item").SetValue(item);
                Traverse.Create(lootItem).Field("m_Type").SetValue(Kingmaker.Blueprints.Loot.LootItemType.Item);
                Traverse.Create(LootItemPackFixed).Field("m_Item").SetValue(lootItem);
                Traverse.Create(LootItemPackFixed).Field("m_Count").SetValue(quantityToAdd);
    
                var libraryLoot = ResourcesLibrary.TryGetBlueprint<BlueprintSharedVendorTable>(sharedVendorTable);
                libraryLoot.AddComponent(LootItemPackFixed);
    
            }
    
            public static BlueprintItemWeapon CopyAndAddRename(String ogGUID, String newName, String newDisplayName, String newGUID)
            {
                var v = Main.library.CopyAndAdd<BlueprintItemWeapon>(ogGUID, newName, newGUID);
                Helpers.SetLocalizedStringField(v, "m_DisplayNameText", newDisplayName);
                return v;
            }
    
            public static void AddEnchantToWeapon(String guidTargetWpn, String guidWeaponEnchant)
            {
                var wpn = ResourcesLibrary.TryGetBlueprint<BlueprintItemWeapon>(guidTargetWpn);
                var enchant = ResourcesLibrary.TryGetBlueprint<BlueprintWeaponEnchantment>(guidWeaponEnchant);
                wpn.Enchantments.Add(enchant);
            }
    
    
            public static void AddUseInDungeonToUnit(BlueprintUnit unit)
            {
                var targcompo = Helpers.Create<Kingmaker.UnitLogic.FactLogic.AddTags>(t =>
                {
                    t.UseInDungeon = true;
                });
                unit.AddComponent(targcompo);
            }
    
            public static void AddCreatureToArmy(String guidCrea, int iArmy, int iCr)
            {
                var bpDungeonRoot = ResourcesLibrary.TryGetBlueprint<Kingmaker.Dungeon.Blueprints.BlueprintDungeonRoot>("d5ac7a99563987948b653b03b341167b");
                BlueprintUnit unit = ResourcesLibrary.TryGetBlueprint<BlueprintUnit>(guidCrea);
    
                AddUseInDungeonToUnit(unit);
    
                bpDungeonRoot.Armies[iArmy].UnitsByCR[iCr].Units = bpDungeonRoot.Armies[iArmy].UnitsByCR[iCr].Units.AddToArray(unit);
    
            }
    
            public static void disableTrashloot()
            {
                //test loot cleanup trash
                var libtrash = ResourcesLibrary.TryGetBlueprint<TrashLootSettings>("77fe4de4c707e51439971ee480e94efc");
    
    
                for (int count = 0; count < 5; count++)
                {
                    libtrash.Table[count].Types[0].Weight = 20;
                    libtrash.Table[count].Types[3].Weight = 55;
                    libtrash.Table[count].Types[4].Weight = 0;
                    libtrash.Table[count].Types[5].Weight = 0;
                    libtrash.Table[count].Types[6].Weight = 0;
                    libtrash.Table[count].Types[7].Weight = 0;
                    libtrash.Table[count].Types[8].Weight = 0;
                }
    
    
            }
    
            public static SharedStringAsset CreateSharedStringAsset(string uniqueString, string localizedname){
    
                var sharedString = ScriptableObject.CreateInstance<SharedStringAsset>();
                sharedString.String = Helpers.CreateString(uniqueString, localizedname);           
                return sharedString;         
               
            }
    
            public static void CreateBardInstrument(String objectName, String newGUID, String spellToAdd, String itemName, String flavorText, int charges = 1)
            {
                BlueprintItemEquipmentUsable customBardInstrument = Main.library.CopyAndAdd<BlueprintItemEquipmentUsable>("c426180be627cf84284bc9abcada55af", objectName, newGUID);
                BlueprintAbility customSpell = Main.library.TryGet<BlueprintAbility>(spellToAdd);
                customBardInstrument.Ability = customSpell;
                customBardInstrument.Charges = charges;
                Sprite customBardInstrumentIcon = LoadIcons.Image2Sprite.Create(@"Mods\zQOLEndless\itemicons\" + objectName+".png");
                customBardInstrument.SetItemIcon(customBardInstrumentIcon);
    
    
                Helpers.SetLocalizedStringField(customBardInstrument, "m_DisplayNameText", itemName);
                Helpers.SetLocalizedStringField(customBardInstrument, "m_FlavorText", flavorText);
            }
    
            public static void DungeonAddItemToItemList(String objectGUID, int iItemCategory)
            {
                var bpdungeonroot = ResourcesLibrary.TryGetBlueprint<Kingmaker.Dungeon.Blueprints.BlueprintDungeonRoot>("d5ac7a99563987948b653b03b341167b");
                bpdungeonroot.Items[iItemCategory].Items = bpdungeonroot.Items[iItemCategory].Items.AddToArray(ResourcesLibrary.TryGetBlueprint<BlueprintItemEquipment>(objectGUID));
            }
    
            public static void DungeonAddScrollToItemList(String objectGUID)
            {
                var lib = ResourcesLibrary.TryGetBlueprint<TrashLootSettings>("77fe4de4c707e51439971ee480e94efc");
                lib.Types[4].Items.Add(ResourcesLibrary.TryGetBlueprint<BlueprintItemEquipmentUsable>(objectGUID));
    
            }
        }
    
    
     
    ^ Top  
  25. Efe Arbiter

    Efe
    Joined:
    Dec 27, 2015
    Messages:
    1,600
    Didnt get to check your code yet but i think we might get somewhere with it
    https://www.mediafire.com/file/vn0h4eosapf2qkb/MagicSmith.v001.7z/file
    so with this i get a list of items player has and create an extra copy with createentity
    to get something new i should duplicate blueprint, modify it and then create it. right?

    on a side note: i think i spent an hour looking at what craft magic items did and made 0 progress... then just winged it with goldmod from when intellisense showed methods and variables under Game.Instance.Player
     
    Last edited: May 15, 2020
    ^ Top