Ok I'm trying to learn here so no flame for my retardation.
Code:
if (npcs[i].isDead == true) {
if (npcs[i].npcType == 750) {
spawnNpc(c, 751, c.getX(), c.getY()-1, -1, 0, 120, 25, 200, 200, true, true);
}
error is c. can't be found.
Code:
src\server\model\npcs\NPCHandler.java:1058: cannot find symbol
symbol : variable c
location: class server.model.npcs.NPCHandler
spawnNpc(c, 751, c.getX(), c.getY()-1, -
1, 0, 120, 25, 200, 200, true, true);
^
src\server\model\npcs\NPCHandler.java:1058: cannot find symbol
symbol : variable c
location: class server.model.npcs.NPCHandler
spawnNpc(c, 751, c.getX(), c.getY()-1, -
1, 0, 120, 25, 200, 200, true, true);
^
src\server\model\npcs\NPCHandler.java:1058: cannot find symbol
symbol : variable c
location: class server.model.npcs.NPCHandler
spawnNpc(c, 751, c.getX(), c.getY()-1, -
1, 0, 120, 25, 200, 200, true, true);
^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
Press any key to continue . . .
Usuaully c. works in every class so I've never understood how to declare c. to be client.java or what ever i need to declare it as for the above method to work?
the spawn npc method is here.
Code:
public void spawnNpc(Client c, int npcType, int x, int y, int heightLevel, int WalkingType, int HP, int maxHit, int attack, int defence, boolean attackPlayer, boolean headIcon) {
// first, search for a free slot
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}
if(slot == -1) {
//Misc.println("No Free Slot");
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();
if(headIcon)
c.getPA().drawHeadicon(1, slot, 0, 0);
if(attackPlayer) {
newNPC.underAttack = true;
if(c != null) {
if(server.model.minigames.Barrows.COFFIN_AND_BROTHERS[c.randomCoffin][1] != newNPC.npcType) {
if(newNPC.npcType == 2025 || newNPC.npcType == 2026 || newNPC.npcType == 2027 || newNPC.npcType == 2028 || newNPC.npcType == 2029 || newNPC.npcType == 2030) {
newNPC.forceChat("You dare disturb my rest!");
}
}
if(server.model.minigames.Barrows.COFFIN_AND_BROTHERS[c.randomCoffin][1] == newNPC.npcType) {
newNPC.forceChat("You dare steal from us!");
}
newNPC.killerId = c.playerId;
}
}
npcs[slot] = newNPC;
}
rep+ for help thankyou! =D