Page 1 of 1

[Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 3:59 am
by Graziel
Moved down stairs nothing happend I had to come back up and 2nd time i entered(climbed down) escort appeared. Nothing in logs.

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 8:54 am
by Grey
I've had this happen a few times in the last few versions. Especially happens in crypt-style dungeons.

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 9:03 am
by darkgod
This happens if the escort could not pop last time youwere there for some reason

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 2:52 pm
by Graziel
well there was plenty of room for him to pop up.
room looked something like this:
both doors locked and no mobs in sight.

Code: Select all

############
#..........#
#.........>#
+..........#
#..........#
#.<........#
#..........#
#####+######

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 2:58 pm
by darkgod
Does not mean it could pop, there is a minimun distance

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 3:07 pm
by Graziel
then why did he poped on 2nd time? i didnt open any doors and he was next to me. I think I could miss some of escorts because of this.

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 3:45 pm
by yufra
Graziel wrote:then why did he poped on 2nd time? i didnt open any doors and he was next to me.
Now that is odd... I thought the same thing as DG. Where did the the portal get dropped?

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Mon Nov 22, 2010 3:47 pm
by Graziel
it looked like this.
@ was the escort.

Code: Select all

############
#.........&#
#.........>#
+..........#
#..........#
#@<........#
#..........#
#####+######

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Sat Nov 27, 2010 5:15 am
by yufra
DarkGod, maybe we could add a log message to let players know that the escort quest was not placed correctly so we can collect savefiles to test them. Graziel, if you still have the savefile let me know. Cheers!

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Sat Nov 27, 2010 2:08 pm
by greycat
For whatever it's worth, I've run into this situation twice in Kor'Pul -- I'd get no escort quest while going down, but I got it while coming back up with the Shade's loot. The escortee appeared next to me by the down staircase. I haven't seen this in any other dungeon.

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Sat Nov 27, 2010 4:57 pm
by Vee
I've seen this in Kor'Pul as well. I guess it might be due to formerly closed doors, that are now open on the way back.
Ts and OF don't have doors, so there wouldn't be this problem.

Re: [Beta 15b] Escort appeard after enterning level 2nd time

Posted: Sat Nov 27, 2010 5:21 pm
by yufra
All of the Kor'Pul problems are rooted in the Astar code not recognizing doors as "open" terrain when computing the portal distance. I looked at the Astar code and this is the check made on each terrain tile:

Code: Select all

self.map:checkEntity(tx, ty, Map.TERRAIN, "block_move", self.actor, nil, true)
So this takes us to mod/class/Grid.lua and the block_move function. Here "e" is "self.actor", "act" is "nil", and "couldpass" is "true".

Code: Select all

	-- Open doors
	if self.door_opened and e.open_door and act then
		if self.door_player_check then
			if e.player then
				Dialog:yesnoPopup(self.name, self.door_player_check, function(ret)
					if ret then game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened]) end
				end, "Open", "Leave")
			end
		else
			game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened])
		end
		return true
	elseif self.door_opened and not couldpass then
		return true
	elseif self.door_opened and couldpass and not e.open_door then
		return true
	end
The first option in the outer if statement checks if the terrain can be opened (self.door_opened), if the actor can open doors (e.open_door) and finally if we are actually acting or just checking (act). Inside of that case is a check used for vault doors and then the terrain tile gets switched with the open door terrain tile. This code won't affect the Astar check because act is nil in our case.

The second and third options in the outer if statement check... to be honest I am not 100% sure. I think this is where we need another option to fix the Astar check. The couldpass variable in my mind is asking "I know we aren't actually opening the door now, but if we wanted to could we?" Right now it looks like we are only handling the "no" side of that statement, and I suggest we add this code to the end:

Code: Select all

elseif self.door_opened and couldpass and e.open_door then
    return false
end
I actually think a larger refactor like below might be clearer, and will test it out in-game. This code assumes that the door's "does_block_move" will handle the cases where the actor cannot open doors, and only opens doors or returns false if we are just checking.

Code: Select all

	-- Open doors
	if self.door_opened then
		-- Blocks move if actor cannot open it
		if not e.open_door then
			return true
		end
		-- If we are acting, actually open them
		if act then
			if self.door_player_check then
				if e.player then
					Dialog:yesnoPopup(self.name, self.door_player_check, function(ret)
						if ret then game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened]) end
					end, "Open", "Leave")
				end
			else
				game.level.map(x, y, engine.Map.TERRAIN, game.zone.grid_list[self.door_opened])
			end
			return true
		-- If we are just testing
		elseif couldpass then
			return false
                else
			return true
		end
	end
EDIT: Well I got an escort and portal to drop when I started in a single closed door room, so that part looks good. The bad news? The escort moved right through the door without opening it. Some work obviously needs to be done... :D After setting the escort's "open_door" variable to true it worked, but this worries me that maybe other monsters that cannot open doors will know just enter them.

EDIT2: Ok, just confirmed that monsters are entering doors instead and I found the reason... does_block_move isn't set for doors. Oh! Well if we aren't going to rely on does_block_move then I will edit the code above (done and tested).