14. Making a slightly different thief
This variation on the thief script (above) is to make the thief more like the thieves in Zelda.  In that game, a thief would hit the player and both would bounce back spilling items around the player.  Then the thief would try and take what was knocked out, and the player would also have to grab the stuff.

So first lets change the stealing script
//Alternating the stealing script
if (hearts>0&&this.steal==0&&(playertouchsme||(abs((x+1.5)-(playerx+1.5))<=3 &&abs((playery+1.5)-(y+1.5))<=3))) {
  hurt 0;
  i = random (1,100);
  if (i<10&&playerrupees>0){
    playerrupees--;
    lay2 greenrupee,random(playerx-5,playerx+5),random(playery-5,playery+5); //lays a green rupee near the player
//the following does pretty much the same thing as above
  } else if (i<15&&playerrupees>4){
    playerrupees-=5;
    lay2 bluerupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<25&&playerbombs>4){
    playerbombs-=5;
    lay2 bombs,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<45&&playerdarts>4){
    playerdarts-=5;
    lay2 darts,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<65&&playerdarts>4&&playerrupees>4){
    playerdarts-=5;
    lay2 darts,random(playerx-5,playerx+5),random(playery-5,playery+5);
    playerrupees-=5;
    lay2 bluerupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<85&&playerbombs>4&&playerrupees>4){
    playerbombs-=5;
    lay2 bombs,random(playerx-5,playerx+5),random(playery-5,playery+5);
    playerrupees-=5;
    lay2 bluerupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<=100&&playerbombs>4&&playerdarts>4){
    playerbombs-=5;
    lay2 bombs,random(playerx-5,playerx+5),random(playery-5,playery+5);
    playerdarts-=5;
    lay2 darts,random(playerx-5,playerx+5),random(playery-5,playery+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>=5){
      this.hit=0;
      this.steal=1;  //this says the thief just stole
      i=0;
    }
    sleep .05;
  }
  timeout=.05;
}
//End of Script
Thats the new stealing script.  Of course, feel free to mess with the numbers and values to change what and how much the baddy steals.

But now we need to script it to run for the nearest item that was dropped, so lets change the walking script.  Caution, we have A LOT to change =/
//New walking script
if (timeout){
  if (hearts>0){
    sprite=(sprite%8)+1;
    if (this.steal!=1){  //all the movement stuff for when the baddy hasn't stolen anything
      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;
    }
    if (this.steal==1){  //what to do if the baddy stole
      for (i=0;i<itemscount;i++){ //checks for the items on the level
        this.distx=abs(items[i].x-x);  //sets the x distance between the thief and the item
        this.disty=abs(items[i].y-y); //sets the y distance between the thief and the item
        this.newdist=((this.distx*this.distx)+(this.disty*this.disty))^.5;  //this sets "this.newdist" to the distance between the baddy and the thief
        if (this.newdist<=this.curdist){ //this is what to do if the new distance is less than the current one (basically we're looking for the nearest item by comparing how far they are from the thief).
          this.curdist=this.newdist;  //since the new distance is less than the current one, the current one ought to be set to the new one
          this.tox=items[i].x; //this.tox is the x location the thief needs to go to
          this.toy=items[i].y; //this.toy is the y location the thief needs to go to
          this.itemindex=i; //this.itemindex is set to the index of the item the baddy is going towards
        }
      }
      if (this.distx<=this.disty){ //this is the same direction checking and walking stuff used normally, but I replaced all the player variables with the vars I set earlier
        if (this.toy<y)dir=0;
        if (this.toyy>y)dir=2;
      }else{
        if (this.tox<x)dir=1;
        if (this.tox>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<this.toy&&!onwall(x+1.5,y+3+this.addy)) y+=this.addy;
      if (y>this.toy&&!onwall(x+1.5,y-this.addy)) y-=this.addy;
      if (x<this.tox&&!onwall(x+3+this.addx,y+1.5)) x+=this.addx;
      if (x>this.tox&&!onwall(x-this.addx,y+1.5)) x-=this.addx;
    }
    timeout=.05;
  }
}
//End of Script
Well, that's that.

We also need to add in some other stuff to tell the baddy what to do when it has reached an item; as well as what to do if it stole something but there are no more items on screen (ie the player grabbed them).
//Script for when it reached an item, or there aren't any.
if (this.steal==1&&abs(this.tox-x)<=1&&abs(this.toy-y)<=1){  //this basically tells that the thief grabbed the item
  take2 this.itemindex;  //this will take the item with the index we specified eariler.
  this.curdist=64;  //this is done to prevent some glitches that may occur
}
if (itemscount<1){  //if itemscount is less than 1, then there are no items on the level
  this.steal=0;  //since there is nothing to take, this.steal needs to be reset to 0
}
//End of Script
So it can take items, and knows when to not run for items.

Now with that in place, we just need to set a beginning value for the this.curdist variable.
//New Beginning Part
if (created){
  showcharacter;
  timeout=.05;
  this.speed=.5;
  this.curdist=64;  //this needs to be set to a large number to prevent some glitches.
  hearts=3;
  hurtdx=0;
  hurtdy=0;
}
//End of Script
Ok, theres the beginning portion for you.

That is the entire thief.  Here's the whole script:
//Completed Zelda-ish Thief
if (created){
  showcharacter;
  setcharprop #n,Zelda Thief;
  hearts=3;
  hurtdx=0;
  hurtdy=0;
}
if (playerenters||wasthrown){
  this.speed=.4;
  this.curdist=64;
  timeout=.05;
}
if (timeout&&isleader){
  if (hearts>0){
    sprite=(sprite%8)+1;
    if (this.steal!=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;
    }
    if (this.steal==1){
      for (i=0;i<itemscount;i++){
        this.distx=abs(items[i].x-x);
        this.disty=abs(items[i].y-y);
        this.newdist=((this.distx*this.distx)+(this.disty*this.disty))^.5;
        if (this.newdist<=this.curdist){
          this.curdist=this.newdist;
          this.tox=items[i].x;
          this.toy=items[i].y;
          this.itemindex=i;
        }
      }
      if (this.distx<=this.disty){
        if (this.toy<y)dir=0;
        if (this.toyy>y)dir=2;
      }else{
        if (this.tox<x)dir=1;
        if (this.tox>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<this.toy&&!onwall(x+1.5,y+3+this.addy)) y+=this.addy;
      if (y>this.toy&&!onwall(x+1.5,y-this.addy)) y-=this.addy;
      if (x<this.tox&&!onwall(x+3+this.addx,y+1.5)) x+=this.addx;
      if (x>this.tox&&!onwall(x-this.addx,y+1.5)) x-=this.addx;
    }
    timeout=.05;
  }
}
if (this.steal==1&&abs(this.tox-x)<=1&&abs(this.toy-y)<=1){
  take2 this.itemindex;
  this.curdist=64;
}
if (itemscount<1){
  this.steal=0;
}
if (hearts>0&&this.steal==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--;
    lay2 greenrupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<15&&playerrupees>4){
    playerrupees-=5;
    lay2 bluerupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<25&&playerbombs>4){
    playerbombs-=5;
    lay2 bombs,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<45&&playerdarts>4){
    playerdarts-=5;
    lay2 darts,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<65&&playerdarts>4&&playerrupees>4){
    playerdarts-=5;
    lay2 darts,random(playerx-5,playerx+5),random(playery-5,playery+5);
    playerrupees-=5;
    lay2 bluerupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<85&&playerbombs>4&&playerrupees>4){
    playerbombs-=5;
    lay2 bombs,random(playerx-5,playerx+5),random(playery-5,playery+5);
    playerrupees-=5;
    lay2 bluerupee,random(playerx-5,playerx+5),random(playery-5,playery+5);
  } else if (i<=100&&playerbombs>4&&playerdarts>4){
    playerbombs-=5;
    lay2 bombs,random(playerx-5,playerx+5),random(playery-5,playery+5);
    playerdarts-=5;
    lay2 darts,random(playerx-5,playerx+5),random(playery-5,playery+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>=5){
      this.hit=0;
      this.steal=1;
      i=0;
    }
    sleep .05;
  }
  timeout=.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
This baddy is found in basicthieves.graal with the name Zelda Thief.