View Single Post
  #2  
Old 09-24-2011, 08:29 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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);
} 
__________________
Reply With Quote