LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
286 stars 159 forks source link

Vassalage Overview broken in MP Modpack when having human vassals #8366

Closed unconnected4444 closed 2 years ago

unconnected4444 commented 2 years ago

1. Mod version (X.Y.Z, e.g. 1.2.0): Vox Populi (5-20-2018): (1) Community Patch Project (v88) (2) Community Balance Overhaul (v13) (3) CSD for CBP (4) Civ IV Diplomatic Features (v11) (5) More Luxuries (v155) (6a) Community Balance Overhaul - Compatibility Files (EUI) (v1)

Then I turned all these mods into a modpack.

2. Mod list (if using Vox Populi only, leave blank): Same as above

3. Error description: Me and friend played in Multiplayer with the modpack listed above. When we reached the Medieval Era and Vassalage was enabled, I made a trade deal with my friend and asked him to be my voluntary vassal. He accepted it and became my vassal.

However, when I clicked on the Vassalage Overview tab at the top right, the entire tab was broken. In the section that is supposed to show your vassals, it just shows the civ icon for George Washington, with "Leader name" and "Civilization name" written next to him.

The same thing happened from my friend's perspective, who was my vassal, where the Vassalage overview was just broken.

The Vassal Details section was just blank, so I couldn't raise his taxes, liberate him, or use any feature that the Vassalage mechanic offers.

This became problematic because my friend would not be able to request independence from me, and I couldn't release him from vassalage through normal means.

I will upload what it looks like below, and the log files from the vassal's perspective and the master's perspective, and the modpack I am using.

When I looked at the log files from the master's perspective, everything seemed fine except this line at bottom:

"[581454.406] Runtime Error: Assets\DLC\Z_MP_MODSPACK_v5-20-2018\Mods(4) C4DF - CBP (v 11)\LUA\VassalageOverview.lua:211: attempt to call global 'TruncateString' (a nil value)"

I am 99% sure that this the cause of this problem, but I don't know how to fix it because I don't know LUA.

A similar error occurred in the log file from the Vassal's perspective:

"[1194052.312] Runtime Error: Assets\DLC\Z_MP_MODSPACK_v5-20-2018\Mods(4) C4DF - CBP (v 11)\LUA\VassalageOverview.lua:145: attempt to call global 'TruncateString' (a nil value)"

My guess is that the "TruncrateString" method is undefined and needs to be defined somewhere. But I don't know how the code works in that file.

4. Steps to reproduce (optional):

  1. Download my modpack
  2. Create Multiplayer lobby
  3. Enable Human Vassalage
  4. Invite a human player who has the same modpack as you do
  5. (Optional): Set start era to Medieval Era and Map size to "Duel" and "Pangaea" (This makes finding each other and making a vassalage trade deal much quicker"
  6. Make a trade deal with the other human player, offer Vassal state
  7. Have them become your vassal
  8. Click the Vassal Overview tab at the top right
  9. Then, you should see that it is broken

Supporting information: Please note that you can attach .zip files by dragging-and-dropping them. If possible, zip up all supporting data and post that way.

Modpack folder: https://drive.google.com/file/d/1OWMRIjKhM0qNXggAdFi9xQbxy1KqD93u/view?usp=sharing

  1. Log files (always attach your Logs folder, located at My Documents/My Games/Sid Meier's Civilization 5. For instructions, go to the repository's main page, under "To enable logging for bug reports"):

VPMP_v5-20-2018_VassalPerspective_Log_Lua.zip

VPMP_v5-20-2018_MasterPerspective_Log_Lua.zip

  1. Save game (always attach a save that was made a turn before the error; located at My Documents/My Games/Sid Meier's Civilization 5/ModdedSaves; you can change autosave frequency in the game's Options menu):

  2. CvMiniDump.dmp file (attach if experiencing a game crash. Located at Program Files/Steam/steamapps/common/Sid Meier's Civilization V):

  3. Screenshots (optional):

Master perspective: 20211030111253_1

Vassal perspective: image

Game settings: 20211030110822_1

RecursiveVision commented 2 years ago

Thank you for providing logs, I would have asked for them if you didn't. I'll take a look.

RecursiveVision commented 2 years ago

I fixed, but only because the bug is still present 3 years later. Otherwise I'd have closed since it's a really old version.

If a player's Steam username is too long it might overlap the UI box, but it's the best I can do with my limited familiarity with LUA.

Anyone better at this than I am is welcome to fix the issue themselves.

unconnected4444 commented 2 years ago

How did you fix it?

RecursiveVision commented 2 years ago

@unconnected4444 Replaced the TruncateString lines with "set text = player nickname".

unconnected4444 commented 2 years ago

I see. I also found another way to solve it, which is to just comment out/delete the TruncateString lines.

unconnected4444 commented 2 years ago

The vassal overview screen is displaying the correct information now, however I think some of the mechanics don't work properly, such as liberating the vassal. Should I open another issue about these bugs?

RecursiveVision commented 2 years ago

@unconnected4444 Liberation is broken in old versions. I fixed it in one of the recent versions.

To save you some effort, the bug was in the DLL, you can't fix it by changing the UI.

unconnected4444 commented 2 years ago

@RecursiveVision Do you remember how exactly you fixed it? Or can you tell me the version that you fixed it in?

RecursiveVision commented 2 years ago

@unconnected4444 https://github.com/LoneGazebo/Community-Patch-DLL/commit/038ae6ba455241a97a46f298d438dba7ce982a03#diff-162d70a6803db24e44ad3cb87097c2e36154d8da3370f1f62628a8b94a2be7dd

You need to remove this code from CvDiplomacyAI::DoWeEndedVassalageWithSomeone():

    // Only do this if we are a vassal
    if (!GET_TEAM(GetTeam()).IsVassal(eTeam))
        return;
unconnected4444 commented 2 years ago

@unconnected4444 Liberation is broken in old versions. I fixed it in one of the recent versions.

To save you some effort, the bug was in the DLL, you can't fix it by changing the UI.

@RecursiveVision Is the bug you're talking about the same one where if a master liberates their vassal, the game from the vassal's perspective still thinks that they're a vassal?

RecursiveVision commented 2 years ago

@unconnected4444 No.

The bug was: Vassal is liberated -> Diplomacy code is run -> It checks to see if currently a vassal -> Always returns no -> No bonus is applied.

If you're thinking of a different bug then it's probably already been fixed but I have no idea when or how.