OnlineCop / kq-fork

Fork of KQ r910. Just for fun.
GNU General Public License v2.0
15 stars 9 forks source link

Random script fixes #163

Closed z9484 closed 1 year ago

z9484 commented 1 year ago

Apparently it was possible to get a freeze when rescuing Cassandra. move_entity(HERO1 was trying to move left first and got stuck forever. I am guessing its because HERO1 is trying to avoid HERO2.

Also if for some reason you sleep back in ekla instead of randen the bridge wouldnt be built.

OnlineCop commented 1 year ago

The "sleep in Ekla" edge case was something I totally overlooked. Great catch!

I wonder if there's a way to add a metatable to Lua's inn() function so calling it from anywhere could run through a more global lookup? That way, more "stay at an inn" requirements anywhere else in the game could all run through the same if progress.something == X tests, and not be locked to a single town's scripts (or multiple scripts, like your fix demonstrates).

OnlineCop commented 1 year ago

I see several places that call move_entity(), so it's surprising to me that this is the only one that's affected by HERO2. Or does that only occur after switching party members and it doesn't properly handle the new HERO2 in some previous HERO2's old position?

z9484 commented 1 year ago

I'm pretty sure it would only break if they are in an obstacle "tunnel": B -> a blocked tile and h1, h2 => hero1, hero2 B h1 B B h2 B

We could add an issue to make it so if an entity script fails (tries to move into an obstacle) it won't lock up the game. We could try adding in "wait" steps and then trying again. Though its a little strange HERO1 tried to move left into an obstacle anyways.