Hi,
Ok so in my pest control there are the portals but no monsters come out of them. I was wondering how would i do this. Im in pestcontrol.java and seebut what do i do to make nps spawn.Code:spawnNpcs();
Thanks
Printable View
Hi,
Ok so in my pest control there are the portals but no monsters come out of them. I was wondering how would i do this. Im in pestcontrol.java and seebut what do i do to make nps spawn.Code:spawnNpcs();
Thanks
Ok. Well the portals won't 'spawn' the monsters so you just need to create a method in the PestControl file. Make it include something like...
Then you want to call it underCode:public void spawnMonsters() {
Server.npcHandler.spawnNpc2(3732,2630,2593,0,0,30,0,0,10);
}
in the startGame() method.Code:spawnNpcs();
I'll give you mine =] You need to make all the npcs attack properly
Code:public void spawnPcNpcs() {
int xKnight = 2654;
xKnight += Misc.random(5);
int yKnight = 2590;
yKnight += Misc.random(5);
int hp = Misc.random(50);
if (hp < 10)
hp += 10;
int npc = 3727;
npc += Misc.random3(49);
if(Misc.random(40) == 6 && npcCount < 30) {
Server.npcHandler.spawnSpecialNpc(npc,2630+Misc.random(4),2593+Misc.random(4),0,2,hp,Misc.random(15),Misc.random(250), Misc.random(10), false, false, 654);
npcCount++;
}
if(Misc.random(40) == 6 && npcCount < 30) {
Server.npcHandler.spawnSpecialNpc(npc,2645+Misc.random(4),2571+Misc.random(4),0,2,hp,Misc.random(15),Misc.random(250), Misc.random(10), false, false, 654);
npcCount++;
}
if(Misc.random(40) == 6 && npcCount < 30) {
Server.npcHandler.spawnSpecialNpc(npc,2670-Misc.random(4),2571+Misc.random(4),0,2,hp,Misc.random(15),Misc.random(250), Misc.random(10), false, false, 654);
npcCount++;
}
if(Misc.random(40) == 6 && npcCount < 30) {
Server.npcHandler.spawnSpecialNpc(npc,2680-Misc.random(4),2591-Misc.random(4),0,2,hp,Misc.random(15),Misc.random(250), Misc.random(10), false, false, 654);
npcCount++;
}
if(Misc.random(60) == 6 && npcCount < 30) {
Server.npcHandler.spawnSpecialNpc(npc,xKnight,yKnight,0,2,hp,Misc.random(15),Misc.random(250), Misc.random(10), false, false, 654);
npcCount++;
}
}
Code:public void spawnSpecialNpc(int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon, int spawnGfx) {
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}
if(slot == -1) {
return;
}
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;
npcs[slot] = newNPC;
newNPC.gfx0(spawnGfx);
}
thanks bro for answering but that did not work. I just got a bunch of errors.Quote:
Originally Posted by Harlan [Only registered and activated users can see links. Click Here To Register...]