View Single Post
  #12  
Old 06-05-2012, 05:33 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by callimuc View Post
Wouldnt it be thiso?
This is one of those cases where this will still refer to then NPC.

Uploaded this npc in a level I was in:

PHP Code:
function onPlayerEnters() {
  
this.nick "NPC";
  echo(
"Test");
  echo(
"-" SPC this.nick);
  for (
temp.pplayers) {
    
with (temp.p) {
      echo(
"+" SPC this.nick SPC player.nick);
    }
  }

echos

PHP Code:
Test
NPC
NPC Leader fp4 
@blackbelben: Get rid of the with statement and your code should work fine, at least the section you posted should.

PHP Code:
for (temp.pplayers) {
  if (
temp.p.this.x) {
    
this.dir 1;
    
this.-= (this.speed);
  }
  if (
temp.p.this.x) {
    
this.dir 3;
    
this.+= (this.speed);
  }
  if (
temp.p.this.y) {
    
this.-= (this.speed);
  }
  if (
temp.p.this.y) {
    
this.+= (this.speed);
  }

__________________
Quote:
Reply With Quote