Super Power Modpack - Total Conversion

This change didn't work for me, still getting the CTD :(



He has replied, he said he is has been busy and will get round to fixing the issues.

I commented out all the lines in that function and that problem didn't happen.
 
I commented out all the lines in that function and that problem didn't happen.

So all of the following:

Code:
function UnitGainScience(iPlayer, iCity, iUnit, bGold, bFaith)
   local player = Players[iPlayer]
   local pUnit = player:GetUnitByID(iUnit)
   local policyID = GameInfoTypes["POLICY_MILITARY_CASTE"]

	if (player:HasPolicy(policyID) and pUnit:IsCombatUnit()) then
--		print("New unit built!")
		local team = Teams[player:GetTeam()]
		local teamTechs = team:GetTeamTechs()
		local currentTech = player:GetCurrentResearch()
		local researchProgress = teamTechs:GetResearchProgress(currentTech)
		local pUnitStrength = pUnit:GetBaseCombatStrength()
		local adjustedBonus = pUnitStrength*1
		-- Give the Science
		if teamTechs ~= nil then
   teamTechs:SetResearchProgress(currentTech, researchProgress + adjustedBonus)
end

		-- Send a notification to the player
--		if player:IsHuman()then
--			local text = Locale.ConvertTextKey("TXT_KEY_SP_POLICY_SCIENCE_FROM_UNIT", tostring(adjustedBonus), pUnit:GetName())
--			player:AddNotification(NotificationTypes.NOTIFICATION_GENERIC, text, text)
--		end
	end
end
GameEvents.CityTrained.Add(UnitGainScience)
 
can you please give us an exact replace of what lines you commented and what comment structure is needed so I can test it? It's been a while since I've coded and I don't know what comment symbol civ5 lua files use.

I have about 5 games with this mod 1 turn from crashing and I'll test them all once I have this fix.

edit: I deleted that code and it seems to have fixed the problem in all of my saved games, thank you eryu and byrne86 and thank you lincoln this mod is even better when you get to the modern era.
 
so I also tried commenting out the whole function UnitGainScience, and it worked fine! My game has now progressed to the next turn, and I shall be able to play to late game :D

Possibly I have slightly hurt a civilization who's now not getting their science boost, but ah well. I can still play :D
Thanks to eryu and byrne86 for the solution
 
Unfortunately I don't think that's the issue. I changed the script, but I still got a CTD.
I'm also pretty sure that the crashes are caused by unit casualties trying to be applied to cities with only 1 population, I tested this by doing a fast 1v1 duel map, built 4 cities, set them all to avoid growth, built a ton of units and sent them to suicide against the enemy civ. My capital was the only city at the start to have more than one pop, and when casualties did occur, they were taken from my capital. Eventually even it had only 1 population, and the next time (I assume) casualties happened, boom, CTD.

Hope this helps.

In addition, the Military Caste policy works fine even without the modified LUA.

EDIT: Alright, I guess there might still be some other reason causing crashes, as when I tried to recreate the last result after I deleted the New Population Rule LUA, I still got a crash.
 
Update, tried the code change fix mentioned earlier but didn't work on my save. Will try it with a new game when I get the time :)

edit: deleting the code section as suggested by others above has fixed the problem! :D
 
It was eryu's solution, not mine, I was asking if that was the right function to comment out lol. Glad it works though, I'm looking forward to a long game with this mod.
 
It was eryu's solution, not mine, I was asking if that was the right function to comment out lol. Glad it works though, I'm looking forward to a long game with this mod.

I'm glad it worked. Thanks for pointing out the policy problem.

As you know, commenting out the body of those functions does not solve the problem - it's a hack to get around the CTD that happens for an unknown reason. Consequently, the corresponding policies will no longer work.

I also looked at war casualty code and it looks fine to me (at least by logic). It looks like lincoln was aware of the 0 population problem. But if it gives you CTD, you might as well comment out those functions to disable casualties. I commented those out because I didn't want it.
 
This looks like a null pointer exception. It's trying to reference a "defending unit" to get it's X coordinate and complains because it couldn't find that object. Assuming your error log reads from top to bottom, I'm just wondering if that may have something to do with adding another war casualty to a city with 0 (or 1) population?

It looks like you attacked a French army and caused a citizen death in Lyon. If Lyon has 1 citizen and you kill a military unit, does the city disappear or is this edge case taken care of in the code?

Looking into the release note, the casualties are supposed to happen at random. If one of the cities is randomly chosen upon a unit death to subtract a citizen from, that's an easy place to forget excluding those cities with only 1 population.

But it's likely that Firaxis added some protection to the subtractCitizen operation, for starving cities with 1 population. If lincoln is using his own scripts for casualties, it might be a good idea to double-check if it's protected (e.g. numCitizens = max(numCitizen--, 1)).

I got some time to take a deeper look into my crash. My first post showing the runtime error from the New Unit Effects lua script ain't the reason. They happened before the French AI turn. I debugged the crash and the main chain of events happened like this:

- It is the French turn (AI)
- The city of "Rheims" is processed
- The AI decides to build the Rifleman as a defensive unit
- The hook "CityTrained" executes, which ends up in the lua scripting engine. This hook is the addition in the DLL - Various Mod Compoenents (v53)
- The next several call stacks are uprecise since they are in the lua51 dll and I don't have the pdb file for it
- Some Lua script calls the CvLuaTeamTech::lSetResearchProgress with the parameters: (1) TechTypes eIndex = NO_TECH, (2) int iNewValue = 40, (3) PlayerTypes ePlayer = 0 = NO_PLAYER
- The first and most likely the third parameter are bad. They should be the valid numbers greater than 0
- This call ends up in the function SetResearchProgressTimes100(), modified in the DLL - Various Mod Compoenents (v53) for the purpose of fixing the research overflow bug
- It finally couldn't find the valid object for NO_TECH and crashes while trying to execute GetResearchCost() function on invalid object
 
I think I found a solution to the CTDs that are happening around turn 200. It seems to happen when an AI civ with the "military caste" policy builds a unit and is awarded bonus science. With this work-around, I'm unsure if it will fix everyone's CTDs or if the policy will still work as intended. But, it did fix my game and the world now cowers under the mighty heel of the Songhai empire. Hope it works for you guys, too.

To fix your game:
  1. Use a text editor like notepad to open Documents\my games\Sid Meier's Civilization 5\MODS\Super Power Balance (v 4)\Lua\New Trait and Policies.lua
  2. Replace line 222 with the three lines of code below
    Replace
    Code:
    [s]teamTechs:SetResearchProgress(currentTech, researchProgress + adjustedBonus)[/s]
    with
    Code:
    if teamTechs ~= nil then
       teamTechs:SetResearchProgress(currentTech, researchProgress + adjustedBonus)
    end

@op - great job on this mod, man. lots of fun.

This solution worked for me as well. No more crashes. Dominating the world right now. Loving this mod.
 
I think I found a solution to the CTDs that are happening around turn 200. It seems to happen when an AI civ with the "military caste" policy builds a unit and is awarded bonus science. With this work-around, I'm unsure if it will fix everyone's CTDs or if the policy will still work as intended. But, it did fix my game and the world now cowers under the mighty heel of the Songhai empire. Hope it works for you guys, too.

To fix your game:
  1. Use a text editor like notepad to open Documents\my games\Sid Meier's Civilization 5\MODS\Super Power Balance (v 4)\Lua\New Trait and Policies.lua
  2. Replace line 222 with the three lines of code below
    Replace
    Code:
    [s]teamTechs:SetResearchProgress(currentTech, researchProgress + adjustedBonus)[/s]
    with
    Code:
    if teamTechs ~= nil then
       teamTechs:SetResearchProgress(currentTech, researchProgress + adjustedBonus)
    end

@op - great job on this mod, man. lots of fun.

This looks like the same or similar issue with the CTD I'm having. Although the proposed fix doesn't work for me, the slightly modified solution does work. The problem is in the currentTech which isn't set to anything (value -1, which isn't nil). If the solution above doesn't help you, try this one

Download link for the modified "New Trait and Policies.lua"
https://drive.google.com/file/d/0B68LIxT9-qMuT05yOFplZ0hrSzA/edit?usp=sharing

Modification:
- The "Military Caste" policy science adjustment when the new unit is created
- The "Third Alternative" policy science adjustment when the unit is killed
- Lua console in FireTuner now prints the logs when these functions are called

Find the file "Documents\my games\Sid Meier's Civilization 5\MODS\Super Power Balance (v 4)\Lua\New Trait and Policies.lua" and replace it with the modified one. This is the quick fix for the version 4.0. Hopefully the official fix will come soon.

Cheers, now going to dominate them :D
 
I d/l the workaround in the post above (#131) .It did fix my hard crash. Thanks
 
I also downloaded the patch you made. Replaced the LUA as you said, I made it 3 more turns then a hard crash. I rebooted and cleared the cache just in case still a
NO-GO. I love the new mod but I am about to uninstall it too frustrating.
 
Good News guys. I'm finishing up the Mod 4.1 version which focusing on reducing crash problems and killing lots of Bugs. If lucky I could release it on this Saturday.

Thanks all for report and sorry for the Bugs. I'll reply you all when I have time.
 
I also downloaded the patch you made. Replaced the LUA as you said, I made it 3 more turns then a hard crash. I rebooted and cleared the cache just in case still a
NO-GO. I love the new mod but I am about to uninstall it too frustrating.

Don't give up - just wait for the official version 4.1 :).
Changes in the 'new policies traits' worked well for me as for now - made it to turn 150 (usually crashed near 120).
 
Good News guys. I'm finishing up the Mod 4.1 version which focusing on reducing crash problems and killing lots of Bugs. If lucky I could release it on this Saturday.

Thanks all for report and sorry for the Bugs. I'll reply you all when I have time.

Awesome news, the Military Caste policy is definitely the cause of my crashes, commenting it out has allowed to play on longer than I have before.

Is there a way for me to change the city tile work range back to 3? 5 seems to big.
 
As a general critique on the mod, I think Alhambra is quite overpowered given how early you can build it in the game.
 
I like the 5 tile range, it allows you to use those resources that are kinda off by themselves. It also works well with the 4 tile between cities change which is great for a ton of reasons.

I may be having a problem with trade routes breaking from new games after I've taken out the military caste code, doing some more play throughs today to see if I can see a pattern.
 
Hello,

I am trying to run the Superpowers Mod. I downloaded the DLL - Various Mod Components. When I try to check the mods in order it wont let me check Super Power - Balance it tells me this mod is blocked by another mod...
 
The 4.1 version has been updated and hope it could solve some CTD problems.

------------------------------------------------------------------
V4.1 Update Notes
------------------------------------------------------------------

Bugs Fixed:
Now working fine with IGE (Ingame Editor) : No longer "Error" message shown when opening IGE with this MOD on and you are able to use IGE to edit new resources added in this Mod.
Fixed a bug that AI settlers won’t found cities if starting in non-Ancient eras.
Fixed a building description text problem in tradition Chinese language. (Thanks MarbleGargoyle)
Fixed a problem in Civilopedia that may cause CORRUPTED saved file on some computers.
Fixed a Bug that culture cost for next Policy threshold may increase abnormally for some civilizations. (Thanks MarbleGargoyle and Maximus)
The “blocking science overflow” function proves to be defective, which may uncontrollable SCIENCE OVERFLOW. Now it is disabled.
The new specialist rule has been considered to cause CRASH in AI turns, now it is disabled for the AI, but still functional for human players (AI will receive a +1 science bonus for all specialists after the human player entering post-industrial eras for a temporary compensation).
The ranged units attacking city to kill population rule has been considered to cause CRASH in AI turns, now it is only functional in battles between human players and AI, temporarily.
The strategic bombers attacking city to kill population rule has been considered to cause CRASH in AI turns, now it is only functional in battles between human players and AI, temporarily.
The Mod background image loading function has been changed to reduce loading time and lower the risk of CRASH.(Thanks the author of Enhanced User Interface MOD: bc1)
Fixed some problematic Lua events in New Attack Effects.lua and New Combat Rules.lua which may cause “runtime error” or CRASH.
Replaced some Lua events for some Policies and traits that may cause CRASH in AI turns. (Thanks eryu)


UI Improvement:
You must use a button called “Move into the City” to order settlers to join the city. (Thanks far_away_land for the Lua code)
As a result, there will be no “missing settlers” when they end their turns in a city.


Balanced Tweaks:
Modern Workboat is considered to be useless and cannot be automated, so it is removed.
Instead, normal workboat will not be consumed after building naval improvements Fast Minor Turns if researched certain Tech or unlocked certain policies. However, its cost is doubled and you can only own up to 3 workboats.
Special Forces Unit cannot capture the city if earned the “Special Ops - Assassinate” Promotion. Now it is replaced by “Field Combat Survival” which provides +33% Combat Strength in ROUGH terrain (Hills, Forest, or Jungle)


Super Power Misc Updates:
Unit Automation: when you press the “enter” key, the units who have scheduled path will no longer be affected to set to “sleep”.
Fast Minor Turns: City States CAN build combat units to protect them from early barbarian attacks, but up to 6 units only for every CS.
 
Top Bottom