Decane / SRP

Sky Reclamation Project for S.T.A.L.K.E.R.: Clear Sky
http://www.moddb.com/mods/srp
126 stars 21 forks source link

'Help' quests get cancelled sometimes with no obvious reason #4

Closed SurDno closed 4 years ago

Decane commented 6 years ago

Can you describe the problem in a bit more detail? CS has 2 types of defense task - one is a 'help' task where the enemy is already 'at the gates' when the task is received, and the player has 5 game-minutes to get to the target camp before the enemy opens fire. The other is a 'defend the camp' task where a count-down starts as soon as the player receives the task, and when it reaches zero, the enemy departs to attack the target camp.

Which of these 2 did you encounter the issue with? And did you one-shot kill the mutants before they reached their target? I can envision the bug that caused #3 also causing this issue in the event of one-shot kills. And now that that's fixed, I'm left wondering whether this is, too. Do you have a savegame from which to reproduce this?

SurDno commented 6 years ago

Sorry, since I use localized game (or, to be more clear, you use localized game), I don't know what's the proper name of this quest type in English. I had problems with "Прийти на помощь", where the best translation is "Come to the aid". But since there's 'Defend the camp' too, I guess I've encountered the issue with 'Help' task. Sorry, I don't have the savefile, but I am sure that were not one-shot kills. Closing the issue myself (so I can reopen it) until I encounter this bug again.

Decane commented 6 years ago

I'm speculatively labeling this one a duplicate of #3 because my fix for that also fixes another, closely related bug that I believe may have been responsible for the issue you have described here, provided that the mutants you killed were one-shot kills. (You insist they weren't, but I can't see any other way the described issue could have happened.)

In #3, I noticed that in both of your savegames, the death callback from the killed creature's object binder systematically fired before the hit callback. And this 'client entity' death callback is set to deactivate the hit callback. Hence, in your saves, the client entity's hit callback was blocked from firing on the entity's death. And before my fix, the only code path that would have credited the player with contributing to a 'capture', 'eliminate', 'help', or 'defend the camp' task was through the client entity's hit callback.

With commit 1924610 however, there are now 2 paths through the code that credit the player with contributing to an active random faction war task - one through the client entity's hit callback (as before), and the other through the server entity's death callback. Usually, both will fire on the creature's death. But even where the client entity's death callback fires before its hit callback—as in your saves—and hence blocks the hit callback from firing at all, the server entity's death callback should still fire, yielding the desired result.

SurDno commented 5 years ago

That's one of my proudest I told you so'es in past few years. I said that were not one-shot kills!

I've managed to reproduce this bug after six months with October branch of SRP 1.13. Here's the save!

As far as I remeber, in April I got this bug when some Fleshes were attacking Encampment near Bridge at Escape. I got to the point being attacked and then killed them from distance, using something like AK or MP5, so I assume I could not kill them from just one shot.

This time, I got a 'Help' task on protecting Freedom squad at Barricades from some boars. I did not rush to my faction squad, instead, I rushed to boars and killed them before they got near freedomers. The quest counted as completed (so not getting to the point being attacked is not the matter of this bug).

After that, I almost immediately got a new 'Help' task on protecting the same Freedom squad, but this time that were blind dogs. Again, I did not go to Barricades and killed all of those dogs when they were going near Depot. This time, the quest got cancelled, just like it did in April.

I'm reopening this issue and ask you to remove the duplicate label, since this bug has not been fixed by 1924610.

SurDno commented 5 years ago

@Decane, remove the duplicate label, please.

Decane commented 5 years ago

@SurDno I can't reproduce the issue you're describing from that savegame - each time I kill the dogs, I get "Task complete". I've tried killing them with the G36 (multi-shot kills) and the SPAS-12 (one-shot kills). I've reloaded about 8 times now. Do you consistently get "Task cancelled" when you kill the dogs after reloading? If so, there might be a race condition in the scripts that plays out one way on your hardware and another way on mine.

SurDno commented 5 years ago
  1. I rush to the pipes and kill all the dogs with shotgun within ==> Task cancelled.

  2. I rush to the pipes and kill all the dogs with shotgun ==> Task completed.

  3. I rush to the pipes and kill all the dogs with G36 (non one-shot) ==> Task cancelled.

  4. I rush to the pipes, kill 3 out of 4 dogs with shotgun, then let the last one get to the Barricades, NPC kills it ==> Task cancelled.

  5. I rush to the pipes, kill 3 out of 4 dogs, then rush to Barricades, NPC kills the last one ==> Task completes.

I reproduced 1 and 2 about 10 times each and usually when I kill dogs immediately (in first 10 secs after save load), the quest gets cancelled in 90% or cases. When it takes 20-30 secs, the task is always completed.

SurDno commented 5 years ago

I figured this out!

Usually, when I load a save, these dogs are dark red (not heading to Barricades), but after 15 secs they become light red (heading to Barricades).

This means the quest gets cancelled if dogs were killed before timer reaches zero and blind dogs start heading to the point being attacked.

SurDno commented 4 years ago

I am pretty sure you got this figured out with the last commit.

Decane commented 4 years ago

Fixed in https://github.com/Decane/SRP/commit/3243acf52360d354b8ed35dd37cc4b14c8d87c9d.