View Single Post
  #1  
Old 06-19-2013, 10:15 PM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Triggering More Than One Level NPC

Hello. I am making an event, and I need to trigger more than one NPC in the level to change color. Basically, say NPCa is the 'control npc' of the level. Say I want to trigger a lot of other NPCs in the level, but I don't want to make things hard and exceed myself. If I just duplicate the NPCs, only one will work by the way.
NPC A (control npc):
PHP Code:
function onPlayerChats() {
  
level.npcb.onFoo(player.chat); //send to more than one npc, identical to npcb

NPC B:
PHP Code:
//let's pretend this code works. I may have messed up, doing this quickly
function onCreated() {
  
level.npcb this;
}
public function 
onFoo(temp.baz) {
  
this.chat temp.baz;

Say I wanted the code to be sent to more than one NPC? I don't want to change the code to each NPC individual though when I duplicate the first, because that would be hard
Reply With Quote