Since this bug blocked me from proceeding further without using GM commands, I tried to troubleshoot it further, and ultimately got stuck. So I'm going to summarize my findings here and hope that someone who knows more than me can make something of it.
First, I added a ton of debug logging specific to this elevator (elevator id = 22), so that I could watch its behavior in the console log. I'll attach my transport.cpp with debug logging if someone is interested.
After reviewing the logging, I noticed the following:
With the current code, startElevator gets called for this elevator by the RunElevator lua command. However, the elevator never triggers arriveElevator.
After reviewing the code further, it seems that the reason for this relates to this elevator not being a permanently moving elevator. If the elevator is not permanently moving, the TransportTimer sets IsStarted to false once it thinks its done moving it:
Code: Select all
if (!elevator->isPermanent)
{
elevator->isStarted = false;
}
After I found this out, I added the following to the startElevator function (reflected in my transport.cpp) -
Code: Select all
if (!elevator->isPermanent)
{
elevator->isStarted = true;
}
The problem was, the platform still didn't move. So next I compared the elevator entry in the db to one of the other working elevators. The logging told me that the npc it was trying to move was "_3zz", so I looked it up in the NPC list. I noticed that the starting animation for this elevator was listed as "9" for its animation. That was interesting, cause according to the animation enum I see this:
Code: Select all
ANIMATION_OPEN_DOOR = 8,
ANIMATION_CLOSE_DOOR = 9,
ANIMATION_ELEVATOR_UP = 10,
ANIMATION_ELEVATOR_DOWN = 11,
I tried swapping "_3zz"'s animation to 11 (since it starts at the top), but this was no good. In fact, it caused me to not even hear the sound of the elevator moving anymore. So I reverted that...
Then finally I noticed one last interesting thing: both of the other elevator's npc name started with "@". In the very next line after "_3zz"'s definition in npc_list.sql, there exists an "@3z0", which is in elevator state 11, which happens to be the top state which is where the elevator starts off at. The positioning to "_3zz" is similar as well.
So I guess my question is....
Is it possible that the reason the elevator doesn't move is that we're trying to move the wrong npc? I don't know enough to know how we associate "_3zz" as being the elevator npc, but it seems to me that that might be the door and "@3z0" might be the elevator, but I don't know how to try this out.
Thoughts?
-SLK