Wintermute Engine > Fixed

Crash when NPC is reset when walking

(1/2) > >>

Eshaktaar:
Hello, first post here!

I'm currently experimenting with WME to get a feel for what it can do, and I seem to have hit a bug:

I have an NPC that walks around the scene (inside an endless loop). When the player clicks on the NPC, I want the NPC to stop what she's doing until the player actor has reached her position. After a short talk, the NPC will then resume her walk. To stop the NPC, I call her Reset() function. Then the player actor says a line, and when the NPC is supposed to answer, the game shuts down.

I could recreate the bug in a simpler example here (NPC's script):


--- Code: ---#include "scripts\base.inc"

this.GoTo(400, 470);

////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
this.Reset();
actor.GoTo(this.X, this.Y);
this.GoTo(400, 470);
}
--- End code ---

When I click on the NPC she stops and waits for the player actor to reach her position. But when the NPC is supposed to continue walking, the game crashes. Note that this only happens if I click on the NPC while she is still walking. If she stands still, the code works.

metamorphium:
could you please post all relevant scripts including the endless loop?

Eshaktaar:
Certainly, the endless loop is also in the NPC's script:


--- Code: ---#include "scripts\base.inc"

walkAround();

////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
this.Reset();
actor.GoTo(this.X, this.Y);
this.GoTo(200, 470); // crash happens here
}

////////////////////////////////////////////////////////////////////////////////
on "Talk"
{
this.Reset();
actor.GoTo(this.X, this.Y);
actor.Talk("Hey there!"); // crash happens before this line appears on screen
this.Talk("Go away!");
walkAround();
}

// LOOP
function walkAround()
{
while (true)
{
this.GoTo(200, 470);
Sleep(5000);
this.GoTo(600, 470);
Sleep(5000);
}
}

--- End code ---

My first description was inaccurate, I noticed: In the Talk event the crash happens before the player actor can say "Hey there!", right after "actor.GoTo(this.X, this.Y);". If I remove the line "actor.GoTo(this.X, this.Y);" in the Talk event, the player actor can say her line, and then the crash occurs.

If I comment out "this.Reset();" and "walkAround();" in the Talk event, no crash happens. In this case, however, I can talk to the NPC only once, and then she becomes "inactive" and talking to her or left-clicking on her does nothing (even though her caption still appears when the mouse is over her).

Mnemonic:
Thanks, Eshaktaar. I'll see if I can reproduce the crash.

Eshaktaar:
Thanks. I could reproduce the crash on two different machines (one with XP and one with Vista).

Navigation

[0] Message Index

[#] Next page

Go to full version