npcs is the array of NPCs near the player. You can do the same thing as you do with players (haven't tested but should work):
PHP Code:
//#CLIENTSIDE
function onCreated() {
// Enablefeatures except for chat text
enablefeatures(allfeatures-0x80);
// Begin looping
setTimer(0.05);
}
function onTimeout() {
// Hide Last Drawn Chat
hideimgs(200, 1000);
// Loop through Players in the level
temp.index = 0;
for (temp.a: {players, npcs}) {
for (temp.p : temp.a) {
// Record their chat and trim it.
temp.player_chat = temp.p.chat.trim();
if (temp.p.chat != "") {
// Draw the Text over the player.
with (findimg(200 + temp.index)) {
x = temp.p.x + 1.5;
y = temp.p.y - 0.5;
style = "c";
text = temp.player_chat;
}
}
temp.index ++;
}
}
// Continue Looping
setTimer(0.05);
}