CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.35k stars 4.15k forks source link

Unable to find and assign mission target cs_sex_shop #48029

Open akirashirosawa opened 3 years ago

akirashirosawa commented 3 years ago

Describe the bug

Start mission MISSION_REFUGEE_Alonso_pants shows: ERROR : src/mission_util.cpp:252 [cata::optional<tripoint_abs_omt> find_or_create_om_terrain(const tripoint_abs_omt &, const mission_target_params &)] Unable to find and assign mission target cs_sex_shop.

Steps To Reproduce

Take MISSION_REFUGEE_Alonso_pants on map w/o sex shop (i think).

Expected behavior

No error

Screenshots

Versions and configuration

Last commit 2fe59a1f146887a430349015c27e27f205c249e8

Additional context

Leather pants are not uncommon. And they are not special, contrary to the name of mission. May increase the search radius of the sex shop "search_range": 120 to larger values. May just omit the location, because finding leather pants is not a problem elsewhere. Or may combine it: try to specify the location, but do not display an error if it not found.

UPD: With "search_range": 240 sex shop found at distance 220. Although I will certainly not go there.

tsulh commented 3 years ago

This seems related to #47225, and I described likely the same issue with cs_sex_shop building recently: #47225#issuecomment-798683519

actual-nh commented 3 years ago

Perhaps a list of locations, going with the first one that can be found or created? Something like { "cs_sex_shop", "leather_shop" }.

atealein commented 3 years ago

This quest is still broken.

Xomikadze commented 2 years ago

Yes, I confirm that the problem persists. On version 34f079e. If you need a save file, I can provide.

stubkan commented 2 years ago

This bug is because the range it searches for a matching sex shop location is quite short. If you have cities wider apart or smaller (I have them slightly bigger and further apart) this comes up for this and many other missions.

I attempted to fix by increasing search range 5x, didnt work - sex shop is quite rare. So I attempted to fix by using a function called

om_terrain_replace | ID of overmap terrain to be found and replaced if om_terrain cannot be found.

To search for a commonly found om_terrain instead, I used trailhead in this case, and it throws a new error after it fails to find a sex shop and attempts to replace a trailhead with one

Invalid overmap terrain id "cs_sex_shop" FILE src/generic.factory.h

So it seems the function om_terrain_replace which would fix this bug and others similarly is itself bugged.

I made sure it was finding a trailhead by declaring a trailhead only instead of a cs_sex_shop and it found that just fine.

stubkan commented 2 years ago

I fixed it by redoing the mission location - it now goes to a trailhead which is a relatively common location, no risk of not finding one. It now involves a minivan, to better fit Alonso's story. Can be used to fix and/improve this bug/mission, or not...

  {
    "id": "MISSION_REFUGEE_Alonso_pants",
    "type": "mission_definition",
    "name": { "str": "Alonso must have his special pants" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 1000,
    "item": "pants_leather",
    "start": {
      "assign_mission_target": { "om_terrain": "trailhead", "om_terrain_match_type": "PREFIX", "reveal_radius": 1, "random": true, "min_distance": 32, "search_range": 200 },
      "update_mapgen": {
        "rows": [
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "           ###          ",
          "          ##s##         ",
          "      ###########       ",
          "     #############      ",
          "      ############      ",
          "       ##########       ",
          "         ######         ",
          "          #####         ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        ",
          "                        "
        ],
    "terrain": { "#": "t_dirt" },
    "furniture": { "s": "f_ladder" },
    "place_item": [ { "item": "blindfold", "chance": 100, "x": 11, "y": 10 },
                    { "item": "balloon", "chance": 100, "x": 11, "y": 10 },
                    { "item": "bullwhip", "chance": 100, "x": 12, "y": 9 },
                    { "item": "teddy_bear", "chance": 100, "x": 10, "y": 16 },
                    { "item": "leather_collar", "chance": 100, "x": 10, "y": 10 },
                    { "item": "clown_nose", "x": 11, "y": 10 },
                    { "item": "balloon", "x": 12, "y": 12 },
                    { "item": "clown_wig", "x": 12, "y": 12 },
                    { "item": "condom", "x": 12, "y": 10 },
                    { "item": "condom", "x": 11, "y": 15 },
                    { "item": "rope_6", "x": 11, "y": 15 },
                    { "item": "bottle_plastic_small", "x": 12, "y": 15 },
                    { "item": "box_small", "x": 8, "y": 8 },
                    { "item": "poetry_book", "x": 11, "y": 13 },
                    { "item": "pants_leather", "x": 11, "y": 13 } ],
    "place_vehicles": [ { "vehicle": "van_mini", "x": 12, "y": 12, "fuel": 0, "status": -1, "chance": 100 } ],
    "remove_vehicles": [ ],
    "place_liquids": [ { "liquid": "cooking_oil", "amount": 4, "x": 12, "y": 15 } ] } ,
    "effect": { "u_add_var": "Alonso_pants", "type": "mission", "context": "flag", "value": "in_progress" }
    },
    "end": {
      "effect": [
        { "u_add_var": "Alonso_pants", "type": "mission", "context": "flag", "value": "yes" },
        { "u_adjust_var": "refugee_happiness", "type": "counter", "context": "refugee_center", "adjustment": 2 },
        { "npc_add_effect": "Alonso_pants_restored", "duration": "PERMANENT" }
      ]
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "I think I might know where those special pants might be though…",
      "offer": "This clown was into some of the different things, not the vanilla, you understand me?  Yes.  I think you will find my valuables in a place special to me not so so far.",
      "accepted": "You make me so happy I could give you little kisses, and some big kisses, and then something else maybe.",

image

Ilurker commented 2 years ago

Issue is still present and affecting cc694a8

DalenTalas commented 1 year ago

Issue is still present and affecting game version as follows:

AriaMoradi commented 1 year ago

Issue still present, version a577338

snipercup commented 11 months ago

I got the error too:

 DEBUG    : Unable to find and assign mission target cs_sex_shop.

 FUNCTION : find_or_create_om_terrain
 FILE     : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\mission_util.cpp
 LINE     : 258
 VERSION  : 02f75a2

I'm on version:

- OS: Windows
    - OS Version: 10.0.22621.2715 (22H2)
- Game Version: 02f75a2 [64-bit]
- Graphics Version: Tiles
- Game Language: System language []
- Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth],
    Magiclysm [magiclysm],
    Tamable Wildlife [Tamable_Wildlife]
]
stubkan commented 11 months ago

I have already posted a solution, someone can put it into a PR or change the mission to not use the rare spawn sex shop, I'm not in cdda mode at the moment