13. Making a Basic Thief
Your basic thief is going to go after the player, but instead of hurting the player (well it could, up to you) it's going to take some of the player's items.

First, since it won't be hurting the player, lets remove the this.pow variable
//Beginning Part
if (created){
  showcharacter;
  this.speed=.5;
  timeout=.05;
  hearts=3;
  hurtdx=0;
  hurtdy=0;
}
//End of Script
Now it won't hurt the player.

Lets change the hurting script to make it take items instead.
//New Player Hurting Script
if (hearts>0&&(playertouchsme||(abs((x+1.5)-(playerx+1.5))<=3 &&abs((playery+1.5)-(y+1.5))<=3))) {
  hurt 0;  //This is so the player doesn't lose life, but is still pushed away as if hurt.
  i = random (1,100);  //we're going to check "i" to see what the thief should steal.
  if (i<10&&playerrupees>0){  //what to steal when i<10
    playerrupees--;  //this removes 1 rupee from the player's rupee count
    rupees++;  //this gives the 1 rupee to the thief
  } else if (i<15&&playerrupees>4){  //what to do when less than 15, greater than 10
    playerrupees-=5;  //take 5 rupees from the player
    rupees+=5;  //gives 5 rupees to the thief
  } else if (i<25&&playerbombs>4){  //what to do when greater than 15, and less than 25
    playerbombs-=5;  //takes 5 bombs from the player
    bombs+=5;  //gives 5 bombs to the thief
  } else if (i<45&&playerdarts>4){  //what to do when greater than 25 and less than 45
    playerdarts-=5;  //takes 5 darts from the player
    darts+=5;  //gives 5 darts to the thief
  } else if (i<65&&playerdarts>4&&playerrupees>4){ //takes 5 darts and 5 rupees
    playerdarts-=5;
    darts+=5;
    playerrupees-=5;
    rupees+=5;
  } else if (i<85&&playerbombs>4&&playerrupees>4){ //takes 5 bombs and 5 rupees
    playerbombs-=5;
    bombs+=5;
    playerrupees-=5;
    rupees+=5;
  } else if (i<=100&&playerbombs>4&&playerdarts>4){ //takes 5 bombs and 5 darts
    playerbombs-=5;
    bombs+=5;
    playerdarts-=5;
    darts+=5;
  }
//the following is the "bouncing script" so the thief doesn't just suck stuff from the player
  this.hit=1;
  while(this.hit==1){
    i+=.5;
    if (x>playerx&&!onwall(x+2.5,y+1.5)) x+=.5;
    if (x<playerx&&!onwall(x-.5,y+1.5)) x-=.5;
    if (y>playery&&!onwall(x+1.5,y+2.5)) y+=.5;
    if (y<playery&&!onwall(x-1.5,y-.5)) y-=.5;
    if (i>=3.5){
      this.hit=0;
      i=0;
    }
    sleep .05;
  }
}
Well, theres the stealing script.  Feel free to edit / change the numbers to alter what and how much the thief actually steals.

We want the thief to give back everything he stole when he's killed, so lets edit the dying part of the script
//New Dying part
if (timeout&&hearts<=0){
  while(d<=8){
    dir=(dir+3)%4;
    d++;
    sleep .1;
  }
  while (rupees>=100){  //if the thief happens to have 100 or more rupees, this is what to do:
    lay goldrupee;  //lays a gold rupee
    rupees-=100;  //subtracts 100 from it's total since it laid a gold rupee
  }  //all the following stuff is the same as above, but for the different things it could steal
  while (rupees>=30){
    lay redrupee;
    rupees-=30;
  }
  while (rupees>=5){
    lay bluerupee;
    rupees-=5;
  }
  while (rupees>=1){
    lay greenrupee;
    rupees-=1;
  }
  while (bombs>=5){
    lay bombs;
    bombs-=5;
  }
  while (darts>=5){
    lay darts;
    darts-=5;
  }
  sprite=40;
}
//End of Script
Now it'll lay whatever it took when it dies.

That's a basic thief baddy for you.  So lets compile it all:
//Completed Basic Thief
if (created){
  showcharacter;
  setcharprop #n,Basic Thief;
  hearts=3;
  hurtdx=0;
  hurtdy=0;
}
if (playerenters||wasthrown){
  this.speed=.3;
  timeout=.05;
}
if (timeout&&isleader){
  if (hearts>0){
    sprite=(sprite%8)+1;
    this.distx=abs(playerx-x);
    this.disty=abs(playery-y);
    if (this.distx<=this.disty){
      if (playery<y)dir=0;
      if (playery>y)dir=2;
    }else{
      if (playerx<x)dir=1;
      if (playerx>x)dir=3;
    }
    if (this.distx==0){
      this.addy=this.speed;
    }else if (this.disty==0){
      this.addx=this.speed;
    }else if (this.distx>this.disty){
      this.ratio=this.disty/this.distx;
      this.addx=this.speed;
      this.addy=this.speed*this.ratio;
    }else if (this.disty>this.distx){
      this.ratio=this.distx/this.disty;
      this.addy=this.speed;
      this.addx=this.speed*this.ratio;
    }
    if (y<playery&&!onwall(x+1.5,y+3+this.addy)) y+=this.addy;
    if (y>playery&&!onwall(x+1.5,y-this.addy)) y-=this.addy;
    if (x<playerx&&!onwall(x+3+this.addx,y+1.5)) x+=this.addx;
    if (x>playerx&&!onwall(x-this.addx,y+1.5)) x-=this.addx;
    timeout=.05;
  }
}
if (hearts>0&&(playertouchsme||(abs((x+1.5)-(playerx+1.5))<=3 &&abs((playery+1.5)-(y+1.5))<=3))) {
  hurt 0;
  sprite=39;
  i = random(1,100);
  if (i<10&&playerrupees>0){
    playerrupees--;
    rupees++;
  } else if (i<15&&playerrupees>4){
    playerrupees-=5;
    rupees+=5;
  } else if (i<25&&playerbombs>4){
    playerbombs-=5;
    bombs+=5;
  } else if (i<45&&playerdarts>4){
    playerdarts-=5;
    darts+=5;
  } else if (i<65&&playerdarts>4&&playerrupees>4){
    playerdarts-=5;
    darts+=5;
    playerrupees-=5;
    rupees+=5;
  } else if (i<85&&playerbombs>4&&playerrupees>4){
    playerbombs-=5;
    bombs+=5;
    playerrupees-=5;
    rupees+=5;
  } else if (i<=100&&playerbombs>4&&playerdarts>4){
    playerbombs-=5;
    bombs+=5;
    playerdarts-=5;
    darts+=5;
  }
  this.hit=1;
  while(this.hit==1){
    i+=.5;
    if (x>playerx&&!onwall(x+2.5,y+1.5)) x+=.5;
    if (x<playerx&&!onwall(x-.5,y+1.5)) x-=.5;
    if (y>playery&&!onwall(x+1.5,y+2.5)) y+=.5;
    if (y<playery&&!onwall(x-1.5,y-.5)) y-=.5;
    if (i>=3.5){
      this.hit=0;
      i=0;
    }
    sleep .05;
  }
}
if ((washit||wasshot||exploded||waspelt)&&hearts>0){
  if (washit){
    hurtdx=x;
    hurtdy=y;
    hearts-=playerswordpower;
  }
  if (wasshot){
    hearts--;
  }
  if (exploded){
    hearts--;
  }
  if (waspelt){
    if (peltwithbush) hearts-=.5;
    if (peltwithsign || peltwithvase || peltwithstone) hearts-=1;
    if (peltwithblackstone) hearts -=1.5;
  }
  sprite=39;
  this.hit=1;
  while(this.hit==1){
    i+=.5;
    if (x>playerx&&!onwall(x+2.5,y+1.5)) x+=.5;
    if (x<playerx&&!onwall(x-.5,y+1.5)) x-=.5;
    if (y>playery&&!onwall(x+1.5,y+2.5)) y+=.5;
    if (y<playery&&!onwall(x-1.5,y-.5)) y-=.5;
    if (i>=3.5){
      this.hit=0;
      i=0;
    }
    sleep .05;
  }
  timeout=.05;
}
if (hurtdx!=0||hurtdy!=0){
  sprite=39;
  hurtdx=0;
  hurtdy=0;
}
if (timeout&&hearts<=0&&isleader){
  while(d<=8){
    dir=(dir+3)%4;
    d++;
    sleep .1;
  }
  while (rupees>=100){
    lay goldrupee;
    rupees-=100;
  }
  while (rupees>=30){
    lay redrupee;
    rupees-=30;
  }
  while (rupees>=5){
    lay bluerupee;
    rupees-=5;
  }
  while (rupees>=1){
    lay greenrupee;
    rupees-=1;
  }
  while (bombs>=5){
    lay bombs;
    bombs-=5;
  }
  while (darts>=5){
    lay darts;
    darts-=5;
  }
  sprite=40;
}
//End of Script
That is the entire script for the Basic Thief.  This baddy can be found in basicthieves.graal