aldelaro5/Bug-Fables-Save-Editor

Findings on flags and variables

Closed this issue · 10 comments

Here's some of my own findings on flags and variables that are marked incorrectly in the current version of the save editor.

Flag 9 (marked here as unknown) was used in the demo for accessing the underground bar by Vi talking her way in (the "i'll RUIN you" threat actually worked in the demo, if Kabbu could solve a little riddle so the bouncer wouldn't get fired); I'm almost 99% sure it's not used in the final game.

Flag 80, if false, will cause tattling Diana in the postgame to lampshade never seeing her earlier; that might be an error in the dialogue script, as from the looks of things it should be Flag 81 that would do this? I might need to look into this one more. This was an error in my notes, I think.

Flag 349, marked here as unused but checked in event 155, is set to true when talking to the ant storage service person when she gives her "Would you like to use the Ant Storage Service?" prompt. Still not sure if it DOES anything.

Flag 417 (marked here as unknown) and its accompanying event 158 were meant for the DesertBookArea map, where a book is propped up like a shelter; the area tattle if it's set to true suggests the shelter could be knocked over to make the text easier to read and the area easier to navigate, somehow. It's almost definitely unused, as the variant tattle line that goes off if this flag is true isn't included in any of the non-english translations.

Flag 596, marked here as unknown but checked in updatearea, is set to true at the end of speaking to the Roach Elder at the Wasp King Tree for the first time, and presumably prevents her from repeating her speech (haven't tested that just yet though).

Flag 708, marked here as unknown, seems to be referenced in SandCastlePressurePuzzle.prefab , specifically CastlePlatform (3) 's turnflagonactive entry. Not sure how relevant that might be to anything, more testing likely required.

FlagVar 37, marked here as TEMP (used on DoClock and event 154) is used for the berry price of Venus's healing the party (via buds). It defaults to 8, but completing the Team Snakemouth... quest (get Queen's Dinner for Aria to bring to Venus) reduces it to 5.

Finally, SOMEWHERE in the save system there SHOULD be something to check how you've paid Diana in the past, as talking to her after all tunnels are complete reimburses you for all the berries you've given her. I don't know if it's saved in a variable, or if it's calculated from multiple flags, or what.

Whenever you get around to this is fine, I realize you're taking a break from Bug Fables for now.

A lot of these are indeed correct in saying they are unused or unknown, the details are interesting, but from your looks of things, it seems more testing is required. I can put a detail thing IF the changes of the flag can affect the game in any way, but most of your findings are untested. I would gladly test them when I come back in the community though (I have anyway bigger plans for this project in the future).

That being said, one exception to this is flagVar 37, this I will add right away.

Done, I'll keep this issue open in the meantime for the other ones.

If I may ask, on a somewhat related note, how did you manage to find which variables and flags were used in which events? If we could figure out what some of the mystery events are we could figure out more about the flags / variables / etc in question? (I didn't see any event stuff in the unity asset extractor's dump of Bug Fables files though I haven't searched everything yet)

Update: Found another one. 304 isn't actually a duplicate of Chapter 5 start - instead, 304 is set to true when you use the ancient crystal from the sand castle to open the second door to access Upper Snakemouth.

Flag 353's description has a typo, it says talking to Crow when it should say talking to Hawk (it's him wondering about finding a chomper sprout)

Update: Found another one. 304 isn't actually a duplicate of Chapter 5 start - instead, 304 is set to true when you use the ancient crystal from the sand castle to open the second door to access Upper Snakemouth.

Flag 353's description has a typo, it says talking to Crow when it should say talking to Hawk (it's him wondering about finding a chomper sprout)

done

If I may ask, on a somewhat related note, how did you manage to find which variables and flags were used in which events? If we could figure out what some of the mystery events are we could figure out more about the flags / variables / etc in question? (I didn't see any event stuff in the unity asset extractor's dump of Bug Fables files though I haven't searched everything yet)

I would first off use utinyripper, it's WAY better and actually extracts in the closest way to the unity project.

The events are in the code meaning in the DLL. You will only see the event ids referenced in stuff like entities which I started to reverse engineer before I left (I even made an editor). They can also be called via a SetText command.

As for how I documented these, I simply patched the dll so that it would output to the console each time it detected a change in the flags, flagvar or flagstrings array. Already, this was 90% of the work.

It wasn't enough because it was possible to miss stuff or not know EXACTLY the reason why the thing changes so the rest had to be manually searched for. If you use ILSpy and you check how the flags values are accessed, you will notice a VERY similar pattern (something like MainManager,instance.flags[xxx] where xxx is the flag number). I used that to my advantage by simply doing some ctrl + shift + f.

However, it's possible to refer to flags in other ways like by using a...ConditionChecker I think it's called? it's been a while, but it's a very simple component that connects to flags to determine if something should be there or disabled. They use this extensively to do stuff like hide things and such.

For the MOST part, I think was exhaustive in how I did this, but it's normal to see little stuff here and there.

The flag research is... ongoing, since so many of them are used for so many things. I did work out two more flagvars for certain though:

Flagvar 49 isn't unused (despite being marked as such in the editor), it's used to track how many Clear Waters you've given the Golden Settlement farm worker for the Hydration Crisis quest.

There are actually TWO Miracle Matter prize medals. Flagvar 63 (the one listed as tracking Miracle Matter in the current editor) is the one gained from beating Broodmother (from Artis if done on hardmode, from caravan otherwise). Flagvar 65 (currently incorrectly marked as unused) is the Prize Medal tracker for the Miracle Matter made available for beating the final boss (from Artis if done on hardmode, from caravan otherwise).

I finally found out what Flag 349 does while trying to document the dialogue parser. If flag 349 is true when a pick-item menu comes up and the pick-item menu is of listtype 0 (your normal inventory), then it allows you to select multiple items at the same time (the only other ways to do that are if listtype is 2 (your storage) or if you're selling items, those won't use flag 349). It's set to true by the game when you speak to Amber to open storage, and set back to false once you're done with the conversation.

Sorry for not responding to your earlier comment, but some of the flags you mentioned in the message before your lattest one are actually in. See, i made and released the save editor during the awkward period between end of 1.1.0 beta and the actual release of 1.1.0. Since i had early knowledge of ALL the flags changes, i prepared a private local branch and ONLY pushed it on release to not break embargo, but afaik, i never actually updated the csv in the lattest release

Check the csv in the Data folder of this repos to make sure that the flags you have are known or not because this one is up to date.

btw, since it will unfortunately take much longer than expected for me to come back (see my pinned tweet why, but i STILL PLAN TO COME BACK, hopefully this year???), i decided to wait that i come back to change the csv from your findings. The first reason is it's been too long and the second reason is you found enough that i need to double check your findings which will take SIGNIFICANTLY less time whenever i am back.

THAT BEING SAID, please feel free to continue documenting your findings. They will be useful still and it can serve as documentation for other people who wants to use it in the meantime with updated flags.

If having better flags support is mission critical, i recommend to distribute a fork in the meantime. It will become not as useful when i come back, but be a solution for people in the meantime.

Just to update on this, I concluded that our current documentations on flags are insufficient (read twitter threads here https://twitter.com/aldelaro5/status/1552098271941873664?s=20&t=jaHTRJdAOBJGmXlUgSui-Q )

There are actual ways for me to properly document them and the fact you found enough that weren't even documented yet tells me it was kinda bad from the start.

I will specifically try to remedy the ones you reported before I do this, but I am just noting here that the true fix is to completely rehaul docs. I am thinking of starting a repos of JUST technical docs since I anyway need to document a bunch of other things (many are outside the save editor scope, but I also want this editor to be part of a toolkit with other tools such as the entity editor).

@YourBuddyBill I will be closing this for 3 reasons:

  • I updated the flags in this editor AND in my internal docs to your findings, thanks for these btw, flag 9 was especially interesting because Genow didn't even know what it was for.
  • Genow gave me a couple. You can check c67b82d for details. Some are interesting, some are mostly unused, but yeah.
  • Let me be blunt here: my way of doing flags docs sucks. It's a terrible system that I need to replace eventually and I was even debating on doing this update batch because tbh, it's tedious and I have plans to make this automated via a program that would analyse all the game for you. I need such a project for MULTIPLE other reasons anyway, but the lack of sufficient flags docs is a big one. Because of this, I really don't want to push much more batch update manually since cross validating them takes FOREVER (I can do it, but it's just tedious and kind of a mess of spaghetti rn).

If you really want to tell me news about your findings, feel free to talk to me from the bug fables discord server: https://discord.gg/bug-fables but I don't want to have a tracking issue about it since it's solved by essentially rehauling this system which I have plans to do (hopefully this year, I want to do entities docs starting next month before I do this project).