• The forum has been updated. For an explanation of some of the changes, head over here.

Recent content by mylittletantan

  1. [Poll-Debate] Blood needs to be spilled in the Arena?

    Perhaps in the future we will see other types of tournaments beyond pure fighting competition. There is a scene in the archives of the game called Hippodrome; these are my suppositions without any foundation but maybe we will have horse racing tournaments. Maybe this can be extrapolated to archery competitions, jousts, melee games...etc...
    Still present in 1.5.5 dlls (have been present since release I think) are the JoustingTournamentGame, HorseRaceTournamentGame, FightTournamentGame (this the one that's used currently) and ArcheryTournamentGame classes. There are a bunch of other classes related to these ones but it seems the other tournament types have either been dropped or are simply not finished yet. Using the mod tools or messing with some code it appears the arena scenes (at least some) still have assets for archery and jousting.

    My guess is they will be implemented in a future update, of course modders could implement them or other types now that scenes are easily edited but so far tournament mods mostly change minor stuff.

    I believe most of the suggestions here are possible with mods but modding shouldn't be required for immersion.
  2. Who's the captain in an army fight? What companions perks perk who up?

    Why speculate when we have code (1.5.5 dlls).

    If the order of battle screen is shown:
    All the party leaders are added to a list if they are heroes.
    They are sorted based on sergeant score, clan tier * 20 (or 100 if the hero is a clan leader) + 2000 if the hero is the leader of a kingdom + parties in army * 200 if the hero is the leader of the army + the number of non wounded characters in its party.
    C#:
    public override int GetCharacterSergeantScore(Hero hero)
    {
        int num = 0;
        num += hero.Clan.Tier * ((hero == hero.Clan.Leader) ? 100 : 20);
        if (hero.Clan.Kingdom != null && hero.Clan.Kingdom.Leader == hero)
        {
            num += 2000;
        }
        if (hero.PartyBelongedTo != null)
        {
            if (hero.PartyBelongedTo.Army != null && hero.PartyBelongedTo.Army.LeaderParty == hero.PartyBelongedTo)
            {
                num += hero.PartyBelongedTo.Army.Parties.Count * 200;
            }
            num += hero.PartyBelongedTo.MemberRoster.TotalManCount - hero.PartyBelongedTo.MemberRoster.TotalWounded;
        }
        return num;
    }
    The list is then iterated over until either every party leader has been considered or all formations have a captain. Depending on the heroes equipment they may not lead certain formations.
    C#:
    private Formation ChooseFormationToLead(IEnumerable<Formation> formationsToChooseFrom, Agent agent)
            {
                bool hasMount = agent.HasMount;
                bool hasRangedWeapon = agent.GetHasRangedWeapon(false);
                List<Formation> list = formationsToChooseFrom.ToList<Formation>();
                while (list.Any<Formation>())
                {
                    Formation formation = list.MaxBy((Formation ftcf) => ftcf.QuerySystem.FormationPower);
                    list.Remove(formation);
                    if ((hasRangedWeapon || (!formation.QuerySystem.IsRangedFormation && !formation.QuerySystem.IsRangedCavalryFormation)) 
                    && (hasMount || (!formation.QuerySystem.IsCavalryFormation && !formation.QuerySystem.IsRangedCavalryFormation)))
                    {
                        return formation;
                    }
                }
                return null;
            }
    So you can influence it somewhat with their equipment.

    Then the normal captain assignment takes place.
    If a formation does not have a captain the formation is searched for the first active (not dead/unconscious/panicked) hero and assigns it as captain. The same happens whenever a captain panics or is killed/knocked out.

    So the captains on the order of battle screen will get chosen until they are replaced with another hero from the formation. If no captain was selected on the order of battle screen the formation should be searched for a hero in the formation to be assigned.

    Which party the captain or unit belong to does not matter, the captains perks apply to the whole formation.

    You could either kill/knock the captains until the correct ones are chosen or hope someone makes a captain assignment mod (shouldn't be that hard to make).
  3. Learning rate diminishes way too much!

    I think the system really should be that it is harder to get level ups (more XP per) as time goes on, but your actual learning rate to earn XP for level ups does not change. Eventually there will be a "max level" where you are maxed in all your skills/abilities and cannot gain more XP, that way you have a character with strengths and weaknesses still, but you don't require hundreds of hours to get your skills levelled.
    Character level is based on the raw xp gained, it is in no way affected by learning rates.
  4. BL Coding Help finding party information an respective GUI

    The encounter menu isn't really stored anywhere, it is generated when the game starts in EncounterGameMenuBehavior.AddGameMenus (TaleWorlds.CampaignSystem.dll).

    Party information is stored in the MobileParty class, the player party can be accessed with MobileParty.MainParty, it has a property MemberRoster of the type TroopRoster which is where the troop information is stored.

    Essentially anytime you are in a scene except the world map you are in a Mission. When you enter a settlement or a conversation it's also a Mission so it's not limited to battles.
  5. BL Coding [Help Needed] Adding and implementing custom PartyWageModel

    If you want to replace the PartyWageModel you will not need to use harmony.

    The way you added that model should work, if not you can use Reflection to set the property after the game has started and loaded all models:
    C#:
    public override void OnGameInitializationFinished(Game game)
    {
        typeof(GameModels).GetProperty("PartyWageModel").SetValue(Campaign.Current.Models, new CustomPartyWageModel());
    }
    Instead of patching CharacterObject.TroopWage you can simply replace that part with a call to the function you would have replaced it with. As an example with the normal wages:
    C#:
            public int TroopWageFunction(CharacterObject co)
            {
                    if (co.IsHero)
                    {
                        return 2 + co.Level * 2;
                    }
                    int result = 26;
                    if (co.Tier == 0)
                    {
                        result = 1;
                    }
                    else if (co.Tier == 1)
                    {
                        result = 2;
                    }
                    else if (co.Tier == 2)
                    {
                        result = 3;
                    }
                    else if (co.Tier == 3)
                    {
                        result = 5;
                    }
                    else if (co.Tier == 4)
                    {
                        result = 8;
                    }
                    else if (co.Tier == 5)
                    {
                        result = 12;
                    }
                    else if (co.Tier == 6)
                    {
                        result = 18;
                    }
                    return result;
               
            }

    If you insist on patching it would be:
    C#:
    public class TSubModule : MBSubModuleBase
        {
    
            public static void TroopWageFunction(ref CharacterObject __instance, ref int __result)
            {
                __result = 10000;
            }
    
            protected override void OnSubModuleLoad()
            {
                base.OnSubModuleLoad();
                Harmony h = new Harmony("mod.Testing");
                MethodInfo original = typeof(CharacterObject).GetProperty("TroopWage").GetGetMethod();
                MethodInfo postfix = typeof(TSubModule).GetMethod("TroopWageFunction");
                h.Patch(original, postfix: new HarmonyMethod(postfix));
            }
    
        }
  6. Is there an actual feasible way to allow >1000 battle sizes with modding?

    I tested using my tournament mod, battle size in options is set to 200 but since I ignore the setting (and other mods increasing it beyond 1024 get the same issue) it doesn't change anything. Spawning exactly 2047 agents (the crowd isn't agents) works with playable performance at max graphics 4k. spawning the 2048th agent causes a crash. I would suspect the tournament master is spawned taking up 1 agent slot so the true number is 2048 works, 2049 crashes.

    I if I were to guess I would assume the engine has allocated resources (probably an array) for 2048 agents, the options unless modded limit the game to never try spawning more than 2000 agents so there is no need to check if the game is trying to spawn too many and then allocate more resources. Why a dynamic array cannot be used allowing modders/users to be limited purely by performance I do not know.
    Screenshot-181.png
  7. Is there an actual feasible way to allow >1000 battle sizes with modding?

    I dont think its hard coded though
    While I have not tested myself, from what I've seen every one that increases battle size report reduced performance pretty much linearly until the combined agent count (human + horse) reaches 2000 (most likely 2048 due to programming conventions) at which point the game immediately crashes. Some have very playable performance close to the limit but then crash as soon as the agent count goes over the limit.
  8. Is there an actual feasible way to allow >1000 battle sizes with modding?

    Yes AI, balance and performance would probably be horrible at huge battle sizes. But they could still have the normal limit be 1000, balance and develop with that size in mind, and then let people use mods to go above it. Cpu and gpu are always improving, in a couple years we might have computers that could handle 2000 (4096 limit to account for horse) no problem. I can't see a reason why they would need to hard code a limit.
  9. Is there an actual feasible way to allow >1000 battle sizes with modding?

    The 2048 agent limit is in the engine, not in the dlls so nothing modders can do about it.

    Why they have this specific limit is unknown, I see no reason why it couldn't be 4096 or even dynamic letting the users performance be the main limiter. Afaik the developers have been asked this question many times and not answered.
  10. [1.5.2 beta] Garrison and troops don't disband when no money is paid (no money on MC)....ever?

    Looks like they haven't actually added the effect to any issues yet, just prepared everything for it to happen. In future updates they may change or add new issues with this effect but until then over size limit and starvation are the only causes for garrison desertion.
  11. [1.5.2 beta] Garrison and troops don't disband when no money is paid (no money on MC)....ever?

    1.5.2 dlls
    Checked DesertionCampaignBehavior.DailyTick and Town.CheckDesertionInGarrison (castles are also towns).
    The only time a garrison could have troops desert would be if it was over size limit, the settlement is starving or due to issues (quests). It does not use morale and so is unaffected by your money problems. (Unless garrisons are considered lord parties but I believe they are not.)

    For a lord party and caravans morale has to be lower than 10 for desertion to happen, you have probably compensated the negative morale of unpaid wages with food/skills etc. so it's above 10, that's why they don't desert.
  12. please help me understand how attributes and focus points work

    10.) If you really can't figure it out, go to the patch notes posts and ask there.
    20.) Post a question on the official TW forum.
    Why bloat patch note threads with questions about game mechanics unless it was specifically changed in that patch? 10) should be: search for a thread related to the question and ask there.

    42.) Decompile the dlls and analyze the code. Then answer the thread you started in case someone else is interested.
  13. Simulating Sea Travel?

    Since the teleport cheat exists it should be possible to teleport at least the main party (probably any party) through scripts, last resort just trigger the cheat.
    There is code for calculating distances in taleworlds dlls and triggering something after a certain time is possible.
    Unsure how to properly make the AI use it but probably possible.

    So making a mod that adds this feature to certain settlements (or adding harbors to the map) should definitely be possible, making the AI use it would probably be a nightmare but possible.
  14. BL Coding Custom Culture Crashing Game

    lorkingdoms.xml, you set the kingdom relationship with itself causing the crash.
    Remove the line <relationship kingdom="Kingdom.ryhnorian" value="-1" isAtWar="true" />
Top Bottom