Page 1 of 2

When two units are destroyed the game crashes

Posted: Sat Aug 25, 2018 10:46 pm
by Kossatx
I'm playing Potzblitz mod with some "home modifications", this is the reason why I don't post this thread in the Potzblitz forum thread. The game runs without any problem... but when two combating units are destroyed at the same time, the game crashes. Anyone knows why this could happen?

Re: When two units are destroyed the game crashes

Posted: Sat Aug 25, 2018 10:50 pm
by Robotron
Copypaste the content of the ctgw.log logfile just after the crash and post it, the last few lines are enough.

However, I might not be able to fix it since I don't know what you have changed in your mod.

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 1:36 pm
by Kossatx
Robotron wrote:
Sat Aug 25, 2018 10:50 pm
Copypaste the content of the ctgw.log logfile just after the crash and post it, the last few lines are enough.

However, I might not be able to fix it since I don't know what you have changed in your mod.
These are the last lines of the file I guess you say:

Code: Select all

[00:32:35][6188]======================DIPLO SEQUENCE END: ALL DIPLO DONE!=================================
[00:32:35][6188]CHECKAI1
[00:32:35][6188]AiMakeTurn() for entente
[00:32:35][6188]*** Starting naval AI ***
[00:32:35][6188]NavalAI1
[00:32:42][6188]NavalAI2
[00:32:42][6188]NavalAI3
[00:32:42][6188]NavalAI3
[00:32:43][6188]NavalAI4
[00:32:43][6188]NavalAI5
[00:32:43][6188]NavalAI6
[00:32:43][6188]NavalAI7
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:46][6188]----------russia reacting in caucasus!----------------
[00:32:47][6188]----------russia reacting in caucasus!----------------
[00:32:47][6188]----------russia reacting in caucasus!----------------
[00:32:47][6188]----------russia reacting in caucasus!----------------
[00:32:47][6188]----------russia reacting in caucasus!----------------
[00:32:47][6188]----------russia reacting in caucasus!----------------
[00:32:55][6188]COMMANDER WOUND ROUTINE
[00:32:55][6188]RANGE:1
[00:32:55][6188]NAME:VON PFLANZER-BALTIN
[00:32:55][6188]KILL ROLL WAS: 5
[00:32:55][6188]REMOVED:VON PFLANZER-BALTIN
[00:32:55][6188]COMMANDER WOUND ROUTINE FINISHED!
[00:33:19][6188]COMMANDER WOUND ROUTINE
[00:33:19][6188]RANGE:3
[00:33:19][6188]NAME:VON FALKENHAYN
[00:33:19][6188]KILL ROLL WAS: 3
[00:33:19][6188]COMMANDER WOUND ROUTINE FINISHED!
[00:33:43][6188]Resume: false, ai/unit_movement.lua:1144: attempt to index field 'hex' (a nil value)
[00:33:43][6188][C]:-1(global error) ai/ai.lua:0: ai/unit_movement.lua:1144: attempt to index field 'hex' (a nil value)
It seems the problem is about AI files, but I haven't mod any AI file :?

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 2:29 pm
by Robotron
1. Where does that "both units destroyed" take place?
2. What side are you playing?
3. What turn is it?

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 3:40 pm
by Kossatx
Robotron wrote:
Sun Aug 26, 2018 2:29 pm
1. Where does that "both units destroyed" take place?
2. What side are you playing?
3. What turn is it?
1. In the first example I think the russian attacking unit was in 115, 25 hex, and the austrian defending unit was in 114, 26 hex. I remember this place, but I'm not 100% sure.
2. CP
3. Turn 34

I have replayed to be sure where other combat with both units destroyed tooks place when the game crashes:

1. British attacking unit was in 127, 69 hex, and the beduine defending unit was in 126, 70 hex.
2. CP
3. Turn 34

I upload the new log:

Code: Select all

[17:36:51][8748]======================DIPLO SEQUENCE END: ALL DIPLO DONE!=================================
[17:36:51][8748]CHECKAI1
[17:36:51][8748]AiMakeTurn() for entente
[17:36:51][8748]*** Starting naval AI ***
[17:36:51][8748]NavalAI1
[17:36:58][8748]NavalAI2
[17:36:58][8748]NavalAI3
[17:36:58][8748]NavalAI3
[17:36:59][8748]NavalAI4
[17:36:59][8748]NavalAI5
[17:36:59][8748]NavalAI6
[17:36:59][8748]NavalAI7
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:02][8748]----------russia reacting in caucasus!----------------
[17:37:10][8748]COMMANDER WOUND ROUTINE
[17:37:10][8748]RANGE:1
[17:37:10][8748]NAME:VON PFLANZER-BALTIN
[17:37:10][8748]KILL ROLL WAS: 2
[17:37:10][8748]COMMANDER WOUND ROUTINE FINISHED!
[17:37:34][8748]COMMANDER WOUND ROUTINE
[17:37:34][8748]RANGE:3
[17:37:34][8748]NAME:VON FALKENHAYN
[17:37:34][8748]KILL ROLL WAS: 1
[17:37:34][8748]COMMANDER WOUND ROUTINE FINISHED!
[17:37:57][8748]Resume: false, ai/unit_movement.lua:1144: attempt to index field 'hex' (a nil value)
[17:37:57][8748][C]:-1(global error) ai/ai.lua:0: ai/unit_movement.lua:1144: attempt to index field 'hex' (a nil value)

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 4:11 pm
by Robotron
Okay, try this:

open unit.movement.lua in folder data/scripts/ai

go to line 1144 where it reads:

Code: Select all

self:printLog("Advance hexes are valid hexes: "..gameplay.advanceUnit.hex.x..","..gameplay.advanceUnit.hex.y.." "..gameplay.advanceHex.x..","..gameplay.advanceHex.y)
and put -- in front of the line so it reads

Code: Select all

--     self:printLog("Advance hexes are valid hexes: "..gameplay.advanceUnit.hex.x..","..gameplay.advanceUnit.hex.y.." "..gameplay.advanceHex.x..","..gameplay.advanceHex.y)
Hope that helps.

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 4:51 pm
by Kossatx
Robotron wrote:
Sun Aug 26, 2018 4:11 pm
Okay, try this:

open unit.movement.lua in folder data/scripts/ai

go to line 1144 where it reads:

Code: Select all

self:printLog("Advance hexes are valid hexes: "..gameplay.advanceUnit.hex.x..","..gameplay.advanceUnit.hex.y.." "..gameplay.advanceHex.x..","..gameplay.advanceHex.y)
and put -- in front of the line so it reads

Code: Select all

--     self:printLog("Advance hexes are valid hexes: "..gameplay.advanceUnit.hex.x..","..gameplay.advanceUnit.hex.y.." "..gameplay.advanceHex.x..","..gameplay.advanceHex.y)
Hope that helps.
Well done Robotron, now the game goes on and there are no crashes :D Bravo!

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 5:02 pm
by Robotron
By the way: I have almost never seen any occasion where both attacker and defender were destroyed.
Did you mod any unit stats and if so, which?

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 6:45 pm
by Kossatx
I have modified a little some units, but that's not the cause. In the middle 1916 some countries have problems to reinforce all their units, so there are some battles between exhausted units with few HP and, sometimes, both are destroyed :wink:

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 7:02 pm
by Robotron
Okay then. It would be great if you could play your game until the end so we can see whether the bug appears again.

Re: When two units are destroyed the game crashes

Posted: Sun Aug 26, 2018 7:08 pm
by Kossatx
Ok, I'll play it. But at the moment, I have repeated the turn that crashed and it already works ok when two units are destroyed in a battle.

Re: When two units are destroyed the game crashes

Posted: Thu Aug 30, 2018 4:37 pm
by Kossatx
The game has crashed again in turn 43, this time probably because I've modded technologies:

Code: Select all

[18:25:53][7540]======================DIPLO SEQUENCE END: ALL DIPLO DONE!=================================
[18:25:53][7540]CHECKAI1
[18:25:53][7540]AiMakeTurn() for entente
[18:25:53][7540]*** Starting naval AI ***
[18:25:53][7540]NavalAI1
[18:25:54][7540]ESCAPE-2
[18:26:02][7540]NavalAI2
[18:26:02][7540]NavalAI3
[18:26:02][7540]NavalAI3
[18:26:03][7540]NavalAI4
[18:26:03][7540]NavalAI5
[18:26:07][7540]MINES START
[18:26:07][7540]LIGHT CRUISER COVER!
[18:26:07][7540]LIGHT CRUISER COVER!
[18:26:07][7540]LIGHT CRUISER COVER!
[18:26:07][7540]ENT CHANCE/ROLL:36/278
[18:26:07][7540]MINES END
[18:26:15][7540]MINES START
[18:26:15][7540]LIGHT CRUISER COVER!
[18:26:15][7540]LIGHT CRUISER COVER!
[18:26:15][7540]LIGHT CRUISER COVER!
[18:26:15][7540]ENT CHANCE/ROLL:30/869
[18:26:15][7540]MINES END
[18:26:24][7540]NavalAI6
[18:26:24][7540]NavalAI7
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:28][7540]----------russia reacting in caucasus!----------------
[18:26:30][7540]Resume: false, game/game_combat.lua:2287: attempt to perform arithmetic on local 'value' (a nil value)
[18:26:30][7540][C]:-1(global error) ai/ai.lua:0: game/game_combat.lua:2287: attempt to perform arithmetic on local 'value' (a nil value)

Re: When two units are destroyed the game crashes

Posted: Thu Aug 30, 2018 4:56 pm
by Robotron
Yep, you're right. So, what did you change? I hope you DO remember, else we're out of luck here. :P

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 11:00 am
by Kossatx
Well, I changed many things in technologies: bonuses, benefited units, cost of upgrades, necessary investigation points, also starting technologies for a few countries... many things without including new technologies or deleting none. Since now (turn 43) I haven't suffered any crash with technologies :|

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 11:43 am
by Robotron
This is from V.5.35, right?

Did you include any new units or modified existing ones? The game is trying to assess a missing value for a prototype stat that is not defined, maybe you deleted or mistyped a stat by accident?

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 12:41 pm
by Kossatx
Yes, my mod is from Potzblitz 5.35 version. I didn't include any new unit, but I modified the existing ones. I'll restore the original units.lua file of your mod, and then I'll check unit by unit until I find the error.

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 5:07 pm
by Kossatx
I have tested all the technologies.lua file and for any reason I can't understand, the error is in these lines:

Code: Select all

  specialised_shell_types =
  {
		stats =
		{
		groundattack = 1,
		bombard = 2,
		navalattack = 1,
		},
		unitTypes = {"artillery"},
		cost = 3,
		time = 150,
		level = true,
  },

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 7:30 pm
by Robotron
Land units, in this case artillery, are not supposed to attack naval forces, so assigning navalattack stats to them will lead to problems.

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 8:34 pm
by Kossatx
You are right, I have deleted the navalattack bonus and now it runs. Thanks again Robotron :D

Re: When two units are destroyed the game crashes

Posted: Fri Aug 31, 2018 9:13 pm
by Robotron
Please for further problems start a new thread as this here is getting quite off-topic from the thread-title. ;)