Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

don't finish mission after load game #4428

Closed
wzdev-ci opened this issue Jul 7, 2016 · 16 comments
Closed

don't finish mission after load game #4428

wzdev-ci opened this issue Jul 7, 2016 · 16 comments

Comments

@wzdev-ci
Copy link
Contributor

wzdev-ci commented Jul 7, 2016

resolution_fixed type_bug | by andrvaut


dont finish mission after save and load 2 mission camp.
broken save:
https://drive.google.com/open?id=0B4UhCQW7aFOLcWNIaWVFUS1VVHM (now attached to bug ticket)


Issue migrated from trac:4428 at 2022-04-16 11:59:38 -0700

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 8, 2016

Cyp changed blocking which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 8, 2016

Cyp changed blockedby which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 8, 2016

Cyp commented


If loading the campaign savegame and destroying the remaining scavenger bunker and tower, I get this log, not sure if it's relevant.

error   |10:30:30: [callFunction:186] 0 : <anonymous>([object Object]) at script/campaign/libcampaign.js:2229
error   |10:30:30: [callFunction:186] 1 : <global>() at -1
info    |10:30:30: [callFunction:189] Uncaught exception calling function "eventDestroyed" at line 2229: TypeError: Result of expression '__camOriginalEvents[eventname].apply' [undefined] is not a function.
info    |10:30:30: [callFunction:189] Assert in Warzone: ../../src/qtscript.cpp:189 (false), last script event: '<none>'
info    |10:30:58: [removeFromGroup:404] Bad group count in group -1 (was 0)
info    |10:30:58: [removeFromGroup:404] Assert in Warzone: ../../src/qtscriptfuncs.cpp:404 (newValue >= 0), last script event: '<none>'
info    |10:30:58: [removeFromGroup:404] Bad group count in group -1 (was 0)
info    |10:30:58: [removeFromGroup:404] Assert in Warzone: ../../src/qtscriptfuncs.cpp:404 (newValue >= 0), last script event: '<none>'
TRACE: __camCheckPlaceArtifact: Placing R-Sys-Sensor-Turret01
error   |10:30:58: [callFunction:186] 0 : <anonymous>([object Object]) at script/campaign/libcampaign.js:2229
error   |10:30:58: [callFunction:186] 1 : <global>() at -1
info    |10:30:58: [callFunction:189] Uncaught exception calling function "eventDestroyed" at line 2229: TypeError: Result of expression '__camOriginalEvents[eventname].apply' [undefined] is not a function.
info    |10:30:58: [callFunction:189] Assert in Warzone: ../../src/qtscript.cpp:189 (false), last script event: '<none>'
TRACE: __camPickupArtifact: Picked up R-Sys-Sensor-Turret01
error   |10:30:58: [callFunction:186] 0 : <anonymous>([object Object]) at script/campaign/libcampaign.js:2229
error   |10:30:58: [callFunction:186] 1 : <global>() at -1
info    |10:30:58: [callFunction:189] Uncaught exception calling function "eventDestroyed" at line 2229: TypeError: Result of expression '__camOriginalEvents[eventname].apply' [undefined] is not a function.
info    |10:30:58: [callFunction:189] Assert in Warzone: ../../src/qtscript.cpp:189 (false), last script event: '<none>'
error   |10:32:06: [callFunction:186] 0 : <anonymous>([object Object]) at script/campaign/libcampaign.js:2229
error   |10:32:06: [callFunction:186] 1 : <global>() at -1
info    |10:32:06: [callFunction:189] Uncaught exception calling function "eventDestroyed" at line 2229: TypeError: Result of expression '__camOriginalEvents[eventname].apply' [undefined] is not a function.
info    |10:32:06: [callFunction:189] Assert in Warzone: ../../src/qtscript.cpp:189 (false), last script event: '<none>'

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 8, 2016

Cyp uploaded file 2-test3 dont finish.zip (55.9 KiB)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 8, 2016

Cyp edited the issue description

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 9, 2016

rockking commented


I am also facing the same problem, Campaing is not finish even I fulfilled all objective ...Version is 3.1.5.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Jul 9, 2016

rockking uploaded file Saved Games - not ending.zip (231.9 KiB)

Saved Games - not finishing

@wzdev-ci
Copy link
Contributor Author

abid_naqvi83 uploaded file libcampaign.patch (2.0 KiB)

Patch file for data/base/script/campaign/libcampaign.js (fixes bug)

@wzdev-ci
Copy link
Contributor Author

abid_naqvi83 changed _comment0 which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

abid_naqvi83 commented


I faced the same problem in the 3.2 release. I debugged data/base/script/campaign/libcampaign.js and discovered that the cause was the victory condition not being met, in particular the function 'camAllEnemyBasesEliminated'.

In mission Alpha-1 the problem was that _camNumEnemyBases was for some reason exceeding the number of entries in the dictionary _camEnemyBases. I fixed that by replacing the equality check with >= (patch attached: libcampaign.patch).

In mission Alpha-2 the problem was that _camEnemyBases contained a fourth base with group -1 and cleanup starting with an underscore. This mission was never detected and therefore never eliminated even after every part of the map had been uncovered. I fixed that by adding a private variable and function for ignoring this fourth strange entry. (patch attached).

The patch fixes this problem completely but may have introduced a subtle but not critical error in Alpha-5. In my opinion the patch likely deals with the symptoms of a deeper bug in the code which I am not qualified to root out.

The 'Uncaught Exception' in the logs related to "eventDestroyed" is likely an unrelated problem which I resolved by simply not calling the function when 'eventname' was equal "eventDestroyed" (also in the patch attached).

@wzdev-ci
Copy link
Contributor Author

NoQ commented


Thanks for the patch!!! Will have a look as soon as possible, hope it doesn't break things on other converted levels :)

@wzdev-ci
Copy link
Contributor Author

NoQ commented


Hmm. No, i think that's not it: there should not ever exist a group with id '-1'. I'd probably suspect a problem in the save-load code (rather than in scripts), which would lead to such groups appearing.

Need to have a look at eventDestroyed. If we disable this pre-hook, then we'd never be able to place artifacts below destroyed buildings; so it must be working from time to time. The thing is, the original event exists, but it doesn't have the 'apply' method, so it's essentially not a function. Will have a closer look on that one, might be a bug in my fancy hook system.

@wzdev-ci
Copy link
Contributor Author

abid_naqvi83 commented


The bug in eventDestroyed popped up in another event (eventDroidBuilt). As you said the problem was that the object doesn't have an 'apply' method. Since on line 2228 in libcampaign.js we are already testing if '_camOriginalEvents[eventname]' exists I removed the test for eventDestroyed and replaced it with an additional test to check if the '.apply()' method for the object also exists.

The if statement on 2228 now reads (in my patch):

if (camDef(_camOriginalEvents[eventname]) && camDef(_camOriginalEvents[eventname].apply))

With this change I don't see this error any more (although I haven't played for very long afterwards). This treats the symptom.

Note: I have replaced two underscores with a single one in all code in this post otherwise it starts underlining text and I don't know how to escape it on this forum. Sorry.

@wzdev-ci
Copy link
Contributor Author

Cyp changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Cyp changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

Cyp commented


See #4587.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant