iPherian / Bannerlord_No_Dragon_Banner_Timeout

Bannerlord mod, take as long as you want to form a kingdom: https://www.nexusmods.com/mountandblade2bannerlord/mods/370
GNU Affero General Public License v3.0
0 stars 2 forks source link

Not compatible with recent versions of the game #3

Open Fewthp opened 3 years ago

Fewthp commented 3 years ago

Dude your mod doesn't work anymore. And for me the error log doesnt make any sense. I'd like to help but I don't know how.

iPherian commented 3 years ago

I'm really sorry! Sadly I've been swamped with work lately and I don't have time to fix it.

Fewthp commented 3 years ago

Did you learn Python just for this mod? Or where you already proficient in it? I'm so completely overwhelmed with modding. Any advice for me where to begin? Thx for your great mod man! :)

Fewthp commented 3 years ago

So looking at your code you removed the weekly/hourly check to avoid the quest from timing out? Is that it?

iPherian commented 3 years ago

Thx for your great mod man! :)

You're welcome! :)

Did you learn Python just for this mod? Or where you already proficient in it? I'm so completely overwhelmed with modding. Any advice for me where to begin?

It's CSharp I think ;) I basically learned it for the mod, although I had used similar languages before. Apart from the language itself, for which you can find various tutorials, what really helped me get started was this example mod, which gives one all the basics: bannerlord_smith_forever.

Basically what it does and what most mods do is replace the base game's classes with their own e.g. this line.

Beyond that, a tool called dotPeek was extremely helpful. With it, you can open up a game/mod .dll and see exactly what code it has. This was how I found what the game did to fail the dragon banner quest.

So looking at your code you removed the weekly/hourly check to avoid the quest from timing out? Is that it?

That's it exactly. The rest of it is just to be compatible with Bannerlord Community Patch (at the time).

Basically a base game class (FirstPhaseCampaignBehavior) was listening for 10 years having passed in a WeeklyTick handler, and then it fails the dragon banner quests, so we just unregister said handler. If that's still how it works, you can see the related code in dotPeek by loading the StoryMode dll.

( Mount & Blade II Bannerlord\Modules\StoryMode\bin\Win64_Shipping_Client\StoryMode.dll )

and then viewing: StoryMode.Behaviors.FirstPhaseCampaignBehavior.WeeklyTick and possibly also RegisterEvents in same class.

If it's not there anymore, one will unfortunately have to find where the failure happens again. However, it might be possible to get it to work just removing everything except that which is mentioned above (the rest is BCP compatibility).

If you like, this is what the base game code looked like at the time:

private void WeeklyTick()
    {
      if (StoryMode.StoryModePhases.FirstPhase.Instance == null || SecondPhase.Instance != null || (double) StoryMode.StoryModePhases.FirstPhase.Instance.FirstPhaseStartTime.ElapsedYearsUntilNow <= 10.0)
        return;
      foreach (QuestBase questBase in Campaign.Current.QuestManager.Quests.ToList<QuestBase>())
      {
        if (questBase.IsSpecialQuest)
        {
          TextObject cancelLog = new TextObject("{=JTPmw3cb}You couldn't complete the quest in {YEAR} years.", (Dictionary<string, TextObject>) null);
          cancelLog.SetTextVariable("YEAR", 10);
          questBase.CompleteQuestWithFail(cancelLog);
        }
      }
    }

Note: the FirstPhase is from the beginning of the game, so what this does is fail 'special' quests (i.e. dragon banner) after 10 years have passed since game start.

Sorry for all the detail, but I thought I could at least help you with what I remember.

Fewthp commented 3 years ago

It's CSharp I think ;)

Hahaha well, you can see how much of a beginner I am :D

I think I'll be able to manage that. But if the compatibility is what is failing then that is waaay out of my league. Thanks for your extensive description. 👍