So in RuneScape, I'm not sure if this is accurate or not, but the Balance Elemental transforms in the midst of battle in order to switch between attack styles into a different NPC. I'm trying to pull this off.
Right now, I'm just working on getting him to transform into a different style, and get him to stay that way, and I'm doing this with a command. I want to make sure I have it right before I add it in to NPCHandler.
Code:
if (playerCommand.equalsIgnoreCase("tf")) {
for (int i = 0; i < Server.npcHandler.maxNPCs; i++) {
if(Server.npcHandler.npcs[i] != null) {
if(Server.npcHandler.npcs[i].npcType == 8281) {
Server.npcHandler.npcs[i].forceAnim(10678);
Server.npcHandler.npcs[i].npcType = 8282;
//c.update();
c.sendMessage("Magic turned into Melee");
return;
}
if(Server.npcHandler.npcs[i].npcType == 8282) {
Server.npcHandler.npcs[i].forceAnim(10677);
Server.npcHandler.npcs[i].npcType = 8283;
//c.update();
c.sendMessage("Melee turned into Ranged");
return;
}
if(Server.npcHandler.npcs[i].npcType == 8283) {
Server.npcHandler.npcs[i].forceAnim(10679);
Server.npcHandler.npcs[i].npcType = 8281;
//c.update();
c.sendMessage("Ranged turned into Magic");
return;
}
}
}
}
When I launch the command, almost everything works fine. The NPC does the transformation animation and the npcType number changes, but after the animation is done, the NPC appears to not have gone through any transformation at all. When I attack the NPC, it does the animation that corresponds to the style it transformed in to, but the client still thinks it's the NPC it spawned as (I think).
I've tried replacing c.update() with several things, but none of them are updating the model.
Can anyone help?