// http://rathena.org/board/topic/74196-walkable-and-talkable-npc/
<header>,{
function Talk;
end;
OnInit:
// Talk("Your message");
Talk("I'm talking.");
Talk("Hello!");
set .@interval, 5;
set .@step, 5;
while(1) {
sleep .@interval*1000;
getmapxy(.@m$,.@x,.@y,1);
while (checkcell(.@m$, set(.@wx, .@x+(rand(-.@step,.@step))), set(.@wy, .@y+(rand(-.@step,.@step))), cell_walkable));
npcwalkto .@wx, .@wy;
npctalk Talk(); // Randomly returns a message
}
end;
function Talk {
if (!getstrlen(getarg(0,"")))
return .talk$[rand(getarraysize(.talk$))];
set .talk$[getarraysize(.talk$)], getarg(0);
return;
}
}