public void spawnNpc3(Client c, int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon, boolean summonFollow) {
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}
if(slot == -1) {
return; // no free slot found
}
NPC newNPC = new NPC(slot, npcType);
newNPC.absX = x;
newNPC.absY = y;
newNPC.makeX = x;
newNPC.makeY = y;
newNPC.heightLevel = heightLevel;
newNPC.walkingType = WalkingType;
newNPC.HP = HP;
newNPC.MaxHP = HP;
newNPC.maxHit = maxHit;
newNPC.attack = attack;
newNPC.defence = defence;
newNPC.spawnedBy = c.getId();
newNPC.underAttack = true;
newNPC.pet = true;
newNPC.facePlayer(c.playerId);
if(headIcon)
c.getPA().drawHeadicon(1, slot, 0, 0);
if (summonFollow) {
newNPC.summoner = true;
newNPC.summonedBy = c.playerId;
c.summonId = npcType;
c.hasPet = true;
}
if(attackPlayer) {
newNPC.underAttack = true;
if(c != null) {
newNPC.killerId = c.playerId;
}
}
npcs[slot] = newNPC;
}