View Single Post
  #1  
Old 11-12-2011, 05:56 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
findnpcbyid(); Bug

It seems to be the case with both the V5 and V6 client that findnpcbyid(); is not working upon, or within a split second of entering or re-entering a level.

Lets say I have multiple NPCs containing:

PHP Code:
//#CLIENTSIDE
function onCreated(){
  if(!(
this.id in this.level.items)){
    
this.level.items.add(this.id);
  }

And within another NPC I have:

PHP Code:
function onPlayerTouchsMe(){
  for(
temp.this.level.items){
    
temp.findnpcbyid(temp.i);
    
this.doSomething(temp.n);
  }

If I were to somehow touch this NPC within a slight moment of re-entering the level, findnpcbyid(); fails to return the npc object. I'm pretty sure the problem is with findnpcbyid(); as all the id values within the array are fine.

Could this possibly be fixed within the new client?
Reply With Quote