Page 1 of 1

Escort quest bug

Posted: Wed Sep 08, 2010 6:42 am
by Repton
Equipment resolver for Betubreda, the lost sun paladin
Equipment resolver Betubreda, the lost sun paladin weapon mace
Zone made us an equipment according to filter! iron mace
Autorequire stats
str 11
wear slot 2
[MOVE] actor moved without a starting position Betubreda, the lost sun paladin14
[QUEST] given to table: 0x1988dad0 escort-duty-tower-amon-sul-4
[LOG] #LIGHT_GREEN#Accepted quest ''! #WHITE#(Press CTRL+Q to see the quest log)
[MUSIC] playing Swashing the buck.ogg userdata: 0x198f28e4 :: current ? true
966 ticks in 10.733 seconds = 90.0028 TPS
I didn't get prompted for this quest. You'll not the log message "Accepted quest ''!".

The quest log is behaving weirdly. I can see "Of trolls and damp caves." If I push down-arrow or up-arrow, the quest log goes away. If I push down/up again, it comes back. I guess it's trying to display the empty quest, failing, and just hiding the screen.

Ah, yes, there's another bug in the log:
Lua Error: /data/quests/escort-duty.lua:244: attempt to concatenate field 'level_name' (a nil value)
At [C]:-1
At /data/quests/escort-duty.lua:244 desc
At /engine/dialogs/ShowQuests.lua:87 drawDialog
At /engine/Dialog.lua:203 display
At /engine/Game.lua:99 display
At /mod/class/Game.lua:460
I wonder if there is a portal here.. Betubreda, the lost sun paladin, certainly isn't following me.

[edit: can't find a portal]

Re: Escort quest bug

Posted: Wed Sep 08, 2010 4:49 pm
by yufra
I can confirm this bug, I saw it a bit too.

Re: Escort quest bug

Posted: Fri Sep 10, 2010 5:28 pm
by yufra
I believe that I have identified the bug. This happened to me again in Amon Sul, and I decided to analyze it a bit. Looking through data/quests/escort-duty.lua I noticed that getPortalSpot can theoretically fail (and in Amon Sul with lots of doors to impede the A* pathfinding this is highly possible). If getPortalSpot fails then the on_grant function immediately returns, and there will be no portal, the escort will not have a target (no portal was placed), the quest will not have a level_name or name (hence it does not show up in the Quest Dialog until you mouse over the invisible entry and the Lua errors for nil level_name are thrown), and the Chat is never initiated. This fits all of the symptoms.

In regards to a solution, well a quick dive into Astar.lua has me a bit perplexed. :D I think that the algorithm will be using the cached paths, and I don't want to go digging into those so I will only suggest that maybe the doors are not being considered as possibilities for the cached paths.

EDIT: I just confirmed that I can remove the quest and escort through the Lua terminal and then reproduce the behavior with "game.player:grantQuest('escort-duty')". I have attached the savefile with no NPC/quest for testing.

EDIT-2: I was surprised (although I guess I shouldn't have been) to be greeted by a repented thief on the way UP the tower after manually removing the quest. He spawned just fine at the exit, but I had also opened nearly all of the doors on the level so that is probably to be expected.

Re: Escort quest bug

Posted: Sat Sep 11, 2010 12:50 am
by darkgod
Thanks for the analysis yfra, I fixed it by allowing on_grant to return true to cancel the quest

Re: Escort quest bug

Posted: Mon Sep 13, 2010 8:04 pm
by mirrizin
yufra wrote:I can confirm this bug, I saw it a bit too.
Me too.

Re: Escort quest bug

Posted: Mon Sep 13, 2010 9:39 pm
by Shoob
escort quests should also either have the escorted guy a unique or, better yet (read more evil), have the quest auto fail if you leave the level when it is pending.

Re: Escort quest bug

Posted: Mon Sep 13, 2010 10:07 pm
by yufra
Shoob wrote:escort quests should also either have the escorted guy a unique or, better yet (read more evil), have the quest auto fail if you leave the level when it is pending.
Now that is a loop-hole I hadn't considered or tested. You are devious shoob. :wink: