All pastes #550988 Raw Edit

Someone

public text v1 · immutable
·published 2007-06-08 16:26 UTC
rendered paste body
VOIDS:

public void squash(int emote, int gfx)
{
	setAnimation(emote);
	stillgfx(gfx, absY, absX);
}

    public void flee(int NPCID) {
        int follow = npcHandler.npcs[NPCID].followPlayer;
	int playerX = server.playerHandler.players[follow].absX;
	int playerY = server.playerHandler.players[follow].absY;
        npcHandler.npcs[NPCID].RandomWalk = false;
    if(server.playerHandler.players[follow] != null)
     {
      if(playerY > npcHandler.npcs[NPCID].absY) {
      npcHandler.npcs[NPCID].moveX = npcHandler.GetMove(npcHandler.npcs[NPCID].absX, playerX);
      npcHandler.npcs[NPCID].moveY = npcHandler.GetMove(npcs[NPCID].absY, playerY+1);
      }
      else if(playerY < npcHandler.npcs[NPCID].absY) {
      npcHandler.npcs[NPCID].moveX = npcHandler.GetMove(npcHandler.npcs[NPCID].absX, playerX);
      npcHandler.npcs[NPCID].moveY = npcHandler.GetMove(npcHandler.npcs[NPCID].absY, playerY-1);
      }
      else if(playerX > npcHandler.npcs[NPCID].absX) {
      npcHandler.npcs[NPCID].moveX = npcHandler.GetMove(npcHandler.npcs[NPCID].absX, playerX+1);
      npcHandler.npcs[NPCID].moveY = npcHandler.GetMove(npcHandler.npcs[NPCID].absY, playerY);
      }
      else if(playerX < npcHandler.npcs[NPCID].absX) {
      npcHandler.npcs[NPCID].moveX = npcHandler.GetMove(npcHandler.npcs[NPCID].absX, playerX-1);
      npcHandler.npcs[NPCID].moveY = npcHandler.GetMove(npcHandler.npcs[NPCID].absY, playerY);
      }
      npcHandler.npcs[NPCID].getNextNPCMovement();                                              
      npcHandler.npcs[NPCID].updateRequired = true;
     }
    }

public void hunt(int lvlreq, int npctype, int expgain, int itemgain, int amount, int requiredweapon, int hit)
{
	int chance = 135 - misc.random(playerLevel[30];
	if(requiredweapon != -1)
	{
		if(playerEquipment[playerWeapon] == requiredweapon && playerLevel[30] == lvlreq)
		{
			if(absX == npcHandler.npcs[npctype].absX && absY == npcHandler.npcs[npctype].absY)
			{
				if(chance == 0)
				{
					addItem(itemgain, amount);
					addXP(30, expgain);
					squash(406, 341);
					npcHandler.npcs[npctype].IsDead = true;
					sendMessage("You kill the " + GetNpcName(npctype) + ", and manage to rip " + GetItemName(requiredweapon) + " off of it!";
				else
				{
					playerLevel[3] -= hit;
					updateRequired = true;
					sendMessage("You fail to capture and kill the " + GetNpcName(npctype) + ", next time try harder!";
				}
			}
		}
		else
		{
			sendMessage("You aren't wearing a " + GetItemName(requiredweapon) + " please go equip one!";
		}
	}
	else
	{
		if(absX == npcHandler.npcs[npctype].absX && absY == npcHandler.npcs[npctype].absY)
		{
			if(chance == 0)
			{
				addItem(itemgain, amount);
				addXP(30, expgain);
				squash(406, 341);
				npcHandler.npcs[npctype].IsDead = true;
			else	
			{
                        	currentHealth -= hit;
				updateRequired = true;
				hitUpdateRequired = true;
				sendMessage("You fail to capture and kill the " + GetNpcName(npctype) + ", next time try harder!";
			}
		}
	}
	if(npcHandler.npcs[npctype].absX >= absX - 10 && npcHandler.npcs[npctype].absX <= absX + 10 && npcHandler.npcs[npctype].absY >= absY - 10 && npcHandler.npcs[npctype].absY <= absY + 10)
	{
		flee(npctype);
	}
} 

public void hunting()
{
hunt(0, 1192, 30, 1037, 1, -1, 2); //rabbits
}

Added hunting(); under public boolean proc then made a skill number [30] named hunting and added a few strings and fixed errors.