Community

SCI Programming => SCI Community How To's & Tutorials => Topic started by: lwc on September 25, 2023, 03:43:12 PM

Title: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on September 25, 2023, 03:43:12 PM
It always bothered me Quest for Glory 3 skips to Manu the monkey's second encounter if there wasn't a first encounter before the conference. There were 4 SCI games in that series and I don't remember any similar avoidable skip, especially as the character acts like it already met you. I mean, all the game had to do was patiently wait until the user went to the Lost City's overhead map and meet Manu for the first time. In fact, the game does exactly that in another event (Thieves have to randomly go there in order for a prisoner to appear in the Simbai village).

In fact I've even tried to fix it myself by taking the original conditions of:
And adding to them:
3. Having Flag 109 (Manu Released) set.

But this of course means you'll have to meet Manu at room 180 (Lost City panorama) and then go back to room 170 (Jungle panorama), which the game never anticipated. This means you'll re-meet Johari (treated like her final encounter) while browsing the Jungle itself (170 will make you enter random Jungle room 700).

Is there any way to avoid this?

A SCI diff file of what I've tried + a ScummVM savegame (before meeting Manu for the second time without the first time) are available at https://bugs.scummvm.org/ticket/11432

If you manage to make it work, please consider also converting it to ScummVM (https://sciprogramming.com/community/index.php?topic=9162.0) so all future players will enjoy it.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on December 03, 2023, 03:13:49 PM
Will it help if I give you a savegame from the original interpreter instead of ScummVM? Just load it and head right and you'll meet Manu who will know you even though you didn't release it yet.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: Collector on December 04, 2023, 10:42:04 AM
What game version are these from? Remember that savegames are version specific and will usually fail to load for other versions. You can check the VERSION file to see.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on December 04, 2023, 11:18:28 AM
1.1
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: doomlazer on December 04, 2023, 12:37:10 PM
Reading your ScummVM bug report, it seems you've already produced working patch files for this except it introduces an issue with Johari. Sounds like you just need to find Johari's appearance code and add a check against Manu. Is this where you're stuck?

You've already solved 80% of the problem, so it's confusing as to why you're having trouble with the Johari check. Or is the problem converting your patch fix into a SVM fix?
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on December 04, 2023, 01:33:32 PM
It's like the "80% of all outcomes are derived from 20% of causes" rule was made for this case.
Everything I've tried with Johari didn't work, I just keep re-meeting her while she's supposed to be long gone.

Once this is solved, then the conversion will need to be dealt with...maybe if I put a working SCI code in the bug report someone there will be kind enough to convert it.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: doomlazer on December 04, 2023, 03:07:06 PM
I see that QfG3 v1.1 comes with an existing patch for 700.scr and 700.hep. Is it possible you weren't overwriting these patches when testing your changes to script 700? That's happened to me, where I wasn't seeing changes to a recompiled script because it's still using the old patch files in the game folder.

After a quick 'find in files' search, it looks like script 700 line 619 (https://github.com/EricOakford/SCI-Decompilation-Archive/blob/8b0b5c0edd2a8c57bafca3ae5446a27c597633d6/qfg3/src/rm700.sc#L619C4-L619C4) is where a lot of the Johari encounter stuff get's kicked off.

Code: [Select]
(self setScript: (ScriptID 702 1))
Was that near were you were looking? I could be way off though as I've never played QfG3 and the code is a mess to sift through blind.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on December 04, 2023, 04:50:00 PM
I've rephrased my OP - 700 is just where 170 takes you. It's 170 that I must assume needs handling. If 170 is handled, 700 shouldn't even take place. 170 should know you already met Johari and thus not redirect you to her again at 700.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: doomlazer on December 04, 2023, 06:17:25 PM
170 should know you already met Johari and thus not redirect you to her again at 700.

This is mostly a guess, but maybe changing script 170 line 514 (https://github.com/EricOakford/SCI-Decompilation-Archive/blob/8b0b5c0edd2a8c57bafca3ae5446a27c597633d6/qfg3/src/rm170.sc#L514) to:

Code: [Select]
(if
      (and
            (Btst fAfterConference)
            (not (Btst fMetJohariInJungle))
      )
      ...
)

edit: hmm... that might get set too early (https://github.com/EricOakford/SCI-Decompilation-Archive/blob/8b0b5c0edd2a8c57bafca3ae5446a27c597633d6/qfg3/src/startUp.sc#L216). If so, consider setting your own flag when you know Johari shouldn't be seen again. fBeatGargoyle ;342 is the last flag listed in game.sh, so (Bset 343) should be unused. Then test for it in script 170 line 514.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: Collector on December 05, 2023, 10:56:44 AM
If there was an existing official patch and you have a PATCHES subdirectory then you could have two copies in the game, your patch and the official patch. The game will only recognize patch files in PATCHES if it is specified in the RESOURCE.CFG. I believe that what is in the base directory of the game  might be used first.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on December 05, 2023, 11:17:11 AM
v1.1 has no PATCHES subfolder and there are no 170 files. It's 170 that needs changing to stop taking the hero to 700.
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: Daventry on December 06, 2023, 05:00:15 PM
https://github.com/AshLancer/QFG3-Fan-Patch
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: lwc on December 06, 2023, 05:40:19 PM
What about it?
Title: Re: Can you cancel a nonsensical skip in QFG3?
Post by: Collector on December 07, 2023, 11:32:42 AM
v1.1 has no PATCHES subfolder and there are no 170 files. It's 170 that needs changing to stop taking the hero to 700.

Doesn't matter. Any given copy of the same version may have the PATCHES directory or not. The interpreter recognizes the patchDir token and will look in a directory for any patches if specified in the RESOURCE.CFG. This can be done by the installer or after the fact by the user. It was just something to check for in your installed copy to make sure the game was not dealing with multiple copies of the patch file. If yours does not have any subdirectories or if your RESOURCE.CFG does not have that token set, nor any copy of it is in the base directory then it will use the one in the RESOURCE.000 file. If so you can ignore this possibility.