Bug - Fixed [patch] Mafia doesn’t correctly handle non-contiguous choice adventure options

Aankhen

Member
Came across this while I was putting together a patch to add spoilers for the new Spooky Forest NC*: Mafia can handle skipping any number of options at the beginning of a choice adventure, but if options are missing from the middle, the spoilers are misplaced. For example, Tree's Last Stand has four options; the first one is conditional upon you having at least one bar skin, the second is conditional upon you having at least two, and the last two options are unconditional. If both the first and second options are missing, Mafia will correctly skip those spoilers. However, if only the second is missing (say you have exactly one bar skin in your inventory), Mafia will show the first spoiler for the first option, then the second spoiler for the third option, and the fourth spoiler for the fourth option. To put it more simply, instead of A1 C3 D4 you’ll see A1 C2 D3.

The attached patch fixes the bug by skipping spoilers for absent options, and is shorter than my long-winded explanation to boot**.

* Naturally, I arrived at the existing bug thread after I finished it only to find there was a second page I’d missed where Bale had ninja’d me by two days. :p
** In terms of characters anyway.
 

Attachments

  • handle-non-contiguous-choiceadv-options.patch
    2 KB · Views: 36

Veracity

Developer
Staff member
This patch is not specific to the Spooky Forest, Theraze. It fixes generic code.

I'll look at it and fold it in. I was the one who added support for missing options at the start. It should have occured to me that there could be missing options in the middle, too.
 

Veracity

Developer
Staff member
Bale's patch - which I also looked at and adapted - does not handle this problem.
I adapted this patch and included in revision 8596.
 

tgetgel

Member
Tree's Last Stand falls into infinite loop.

[117015] Spooky Forest
Encounter: Arboreal Respite
choice.php?whichchoice=502&option=1&pwd
Encounter: The Road Less Traveled
choice.php?whichchoice=503&option=3&pwd
Encounter: Tree's Last Stand
choice.php?whichchoice=504&option=2&pwd
Encounter: Tree's Last Stand
choice.php?whichchoice=504&option=2&pwd
Encounter: Tree's Last Stand
choice.php?whichchoice=504&option=2&pwd
Encounter: Tree's Last Stand
choice.php?whichchoice=504&option=2&pwd
Encounter: Tree's Last Stand
choice.php?whichchoice=504&option=2&pwd

and stays there. This is running r8777 from a script in a command window. The Mafia settings for Choice Adv by zone are:
Spooky Forest 1: Vampire Heart
Spooky Forest 2: Skip adventure and keep vampire hearts
Spooky Forest 3: Meet the vampire hunter, and trade bar skins or gain a spooky sapling
Spooky Forest 4: Gain a spooky sapling or trade bar skins
Spooky Forest 5: Bar skins
Spooky Forest 6: gain mosquito larva then spooky mushrooms
Spooky Forest 7: Gain spooky-grow fertilizer
Spooky Forest 8: Skip adventure

If I read the Wiki right:
Arboreal Respite choice 1 is Follow the Old Road.
The Road Less Traveled choice 3 is to Talk to the Hunter.
Tree's Last Stand choice 2 is Take Your Leave.

newLife.ash does not address the choices in the 500 range.
 

Theraze

Active member
Choice 4 is take your leave. Choice 2 is sell all bar skins. Choice 1 is sell 1, and choice 3 is buy a spooky sapling.

It's a known issue that Tree's Last Stand isn't properly handled yet. Whether it's a bug or a feature request depends who you ask. :) Either way, it's not directly related to this patch.
 

tgetgel

Member
Choice 4 is take your leave. Choice 2 is sell all bar skins. Choice 1 is sell 1, and choice 3 is buy a spooky sapling.

Where do I find the documentation that relates the choiceadventure number (504) to Spooky Forest #X (choice adv by zone tab) in Mafia? I have searched but have not yet found it. I guess I am looking for a flowchart or state map for the Arboreal Respite as it relates to the choice adventure zone selections tab.
 

tgetgel

Member
I'd suggest you check the KoLwiki for that information.
The table view at http://kol.coldfront.net/thekolwiki/index.php/Spooky_forest_table. Thanks for pointing this out, Bale. I am still working through and wondering about how each of these choices relate to the choice adv tab with say Spooky Forest 3.
I will verify the table that Bale pointed out against the Wiki, then map the Mafia choice adv by zone to the table. I will post results of my findings here.
 
Last edited:

Bale

Minion
That's great. I'd just like to point out before you begin that the problem is purchasing a spooky sapling can be done endlessly until you run out of meat. :(
 

Theraze

Active member
Yeah... I'm currently using a choiceadventure override to unlock the temple, completely ignoring mafia's handling for Arboreal Respite. :) Worked great.
 

tgetgel

Member
Spooky Forest Choices mapping to Choice Adv by Zone

I mapped out the choices in the attached PDF document. The numbering of the Spooky Forest (SF) Adventure # is not optimal. The top level choice is SF 3, followed by SF 4, 6, and 7 at the next level of the table. SF 4, 6, and 7 (color key at bottom of document) have some final end of adventure settings. SF 4 has sub choices of SF 2 and 5. SF 6 has a sub choice of SF 1. SF 7 has a sub choice of SF 8.

I am making the assumption that the coding in Mafia is correct, specifically that the choice of a particular SF adventure # will get you to where it says you will go. I make this assumption since I have not looked at the code. If someone would point me to the code, I can take a look.

In regards to Bale pointing out of the buy saplings until you are broke loop, the only way you should buy a sapling is if you selected SF 3 (met the vampire hunter, ..) SF 4 (gain spooky sapling or trade bar skins), and SF 5 (buy spooky saplings). If the code points to the wrong place, then ...

That being said, you can totally avoid being near the sapling seller. Since SF 5 is a sub choice of SF 4, which is in turn a sub choice of SF 3, I would recommend changing the choices of 3 and 4 if you already had a sapling or were not interested.

See what your goal is and set the SF # adventure's appropriately. I started with the goal and worked backwards in setting the choices the Mafia Adventures/Choice Advs/zone tab.

In summary, SF 3 is the top choice. SF 4, 6, and 7 are the next layer. By knowing who you are, your level, you inventory, your goals, the SF # choice adventures should be able to be dynamically set/changed.

Happy Adventuring!

PS - Anyone want to buy some Spooky-Gro Fertilizer? I have 68 of them. I should have done this exercise earlier. ;)

PPS - I would recommend changing the wording on 2 of the SF choices.
SF 1 - change the choice of "vampire heart" to "fight a spooky vampire" since the heart will not drop if you do not have wooden stakes.
SF 6 - change "fight the vampire" to "face the vampire" since SF 1 determines if you fight or not.
 

Attachments

  • SFChoices.pdf
    24.3 KB · Views: 74
Last edited:

tgetgel

Member
I now understand the progression of the numbering of the Spooky Forest choice advs in Mafia. SF 1 and 2 were the first ones created. With the additional content and such, SF 3 through 8 were added going left to right and top down on the tree. Replacing 1 and 2 with the top level choices would have messed folks up with their scripts and automation.
 

Theraze

Active member
Just remember that anytime your choice terminates in Talk to the hunter and doesn't have "take your leave" or "show in browser" as its choice, you're looking at an infinite loop.
 
Top