purpose: to make every npc shout a message above its head when you type the command (message given in the command ofc)
difficulty: 1/10
assumed knowledge: c+p
tested server: whitescape pulse v2
classes modified: commandhandler/commands/client wherever your commands are.
step 1:
open the .java file that contains your command code.
step 2:
find a spot to add your new command
step 3:
add the below code to your commands on the spot you have just found:
if your commands are handled:
Code:
if(command.startsWith("npcshout")) {
try {
for(int i = 0; i < server.npcHandler.npcs.length; i++) {
try {
if(server.npcHandler.npcs[i] != null) {
server.npcHandler.npcs[i].updateRequired = true;
server.npcHandler.npcs[i].textUpdateRequired = true;
server.npcHandler.npcs[i].textUpdate = command.substring(9);
}
} catch (Exception e) {
c.sendMessage("npcslot "+i+" invalid for shouting.");
}
}
} catch (Exception e) {
c.sendMessage("command ("+command+") was invalid, please check your input.");
}
}
if your commands are inside client.java:
Code:
if(command.startsWith("npcshout")) {
try {
for(int i = 0; i < server.npcHandler.npcs.length; i++) {
try {
if(server.npcHandler.npcs[i] != null) {
server.npcHandler.npcs[i].updateRequired = true;
server.npcHandler.npcs[i].textUpdateRequired = true;
server.npcHandler.npcs[i].textUpdate = command.substring(9);
}
} catch (Exception e) {
sendMessage("npcslot "+i+" invalid for shouting.");
}
}
} catch (Exception e) {
sendMessage("command ("+command+") was invalid, please check your input.");
}
}
step 4:
then save the file you just edited
step 5:
compile your server's *.java files
step 6:
run your server
step 7:
log in to your server
step 8:
type ::npcshout "message the npcs must shout here"
step 9:
be amazed by the result :woot:
extra:
if you want your command admin only or for you only you should know what to do and if you dont:
Code:
if (command.startsWith("npcshout") && playerRights >= 2) {
or
Code:
if (command.startsWith("npcshout") && playerName.equals("your character name") {
enjoy it 

credits: 100% to me (as if this needs to be leeched..)