Choose Your Language

Saturday 3 July 2021

Episode 46: The Easy Option! (Puzzle Auto Solve)

It's been a difficult couple of weeks for my module creation. Just as I thought I was about to do something straightforward, instead, I found myself travelling a long way down a rabbit hole without meeting anything cute! That's the nature of the beast when it comes to coding sometimes; even though I thought I had put this section of coding behind me! For the latest module two updates, please read on ...

Sorting Items On Entry

I am going to keep this as brief as possible, but need to report it for prosperity and a reminder to myself and others about an issue with the function GetObjectByTag. Basically, when a PC enters a module, any items they are carrying are not correctly picked up as valid objects by this function in a game until after the game has been saved and loaded again. I had a situation where I wanted to locate a single item within the new module, which is normally denoted by a unique tag. However, prior to this, I had stripped PCs of items that may have the same tag. The problem was, even though the items were stripped and destroyed, the function still detected them. My thanks goes to KevL for suggesting a quick fix to change the tag prior destruction, thereafter meaning any object falsely returning valid would at least not be found due to the altered tag.

However, on the back of diagnosing this "fault" with the function, I observed that it would also return other items valid, which were not actually present in the module: Those that were on creature blueprints associated with encounter triggers! While this may not be a huge problem if we carefully consider item possession, the very fact that items are still returned valid, but without a valid owner or location, can be confusing. I had two scripts that did module wide searches for tagged items, which would have also returned any items carried on creatures that at this stage had not even been spawned into the game!

Resolving the latter issue was reasonably straightforward: I simply rewrote the scripts to avoid returning items that had invalid locations and owners. However, the first issue was the rabbit hole that had many paths! My initial fix was to force a save and reload if required. However, as I allow players to import PCs with equipment, this was almost certainly going to happen for any new module I make. The solution worked, but I did not like the impact on gameplay or the player, so I decided to rewrite the code to bypass this need ... This, however, meant having to check every item on every PC of every player that entered the module at any time. This was further complicated by the fact I allow special containers that help with inventory control when finding certain items. E.g. Gems automatically get placed into a gem bag. I also remove invalid or duplicated items from potentially various PC types. Bottom line, I eventually resolved it, but it took me a lot longer than I thought it would. Hopefully, it is behind me again now, and after testing some MP aspects, I will consider this done and ready for v1.41E. Although it won't be fully utilised until my second module is released.

Faction Code Slimlining

Another issue from recent weeks has been surrounding creature factions. During another play-test, my wife observed one other potential faction issue: If Frank (at the barn) becomes damaged during the fight with the first two ants that appear, he can turn hostile to the party. Ideally, the heroes should beat the ants before Frank sees them. However, if the party are pushed back or the ants break through, Frank can become involved and things go awry. The problem was resolved by reloading the game and doing the fight again, avoiding Frank, but I wanted a permanent solution. To this end, I went through much of the creature spawning and faction initialisation code, replacing some older ANTIPARTY faction changes to simply HOSTILE. This maintains clearer faction distinction, which should avoid any such potential issues moving forward. The ANTIPARTY faction was designed and should be reserved for when the PCs attack something they should not in front of non HOSTILES. A rare and unlikely situation.

Lava Chamber Walk Mesh

Unfortunately, I spotted a bad walk mesh for the Lava Cavern in the first module, which required the movement of some creatures and a re-bake of the area. As it currently stands in v1.40E, the creature that is supposed to turn hostile is stuck in a position that prevents it from doing so. This is now fixed, as well as some other minor issues with the area, which will be available in v1.41E. Fortunately, it's a non-critical area and one that 90% of players would probably not find anyway, due to its difficult access.

Other Minor Updates

While working on module two, I noticed some other minor points that needed addressing, including fixing a seated talk animation and some timings for message feedback. All cosmetic, and again, will come along in v1.41E for module one as well.

But, I have been making other progress too ... I have been adding an extra puzzle button to allow an AUTO SOLVE for players who really do not want to do any puzzles. I have a few different coded puzzles in the game, which players are encouraged to solve to move the game forward. Most allow for alternative play to circumvent the puzzle by using specific tools with them if the player prefers to avoid them. However, a handful did require the player to solve the puzzle themselves as a game mechanic. One of these puzzles has now had an AUTO SOLVE button added, but only when the player sets their game settings to below D&D CORE RULES setting, and only then if someone in their party meets the feat or intelligence ability requirement. Furthermore, using this new option does not reward the player's PC with XP, but does allow the plot to move forward when necessary.

There is one other puzzle that I hope to add this option to, but all other puzzles will remain unaltered as they can either be solved using other means (tool items or Life Essences) or are not plot critical, so the player does not have to do them anyway. This week's screenshot shows the new button (when available) for one of the updated puzzles.

New Auto Solve Button When Game Settings Lowered

... And The Other Puzzle With New Auto Solve Button!


No comments: