- script death -1,{
OnInit:
set .npcname$,"[Death Announcer]"; // Define the NPC's name
OnWhisperGlobal:
if (getgmlevel() >= 40) {
AnnounceMenu:
mes .npcname$;
mes "There are several settings for this controller.";
mes "Only one announcer may be active at all times.";
mes "What would you like to do?";
next;
menu "Set Flavor Text",FlavorText,"Mob Announcer",MobAnnouncer,"PK Announcer",PKAnnouncer,"Nothing",Nothing;
Nothing:
close;
FlavorText:
next;
mes .npcname$;
mes "Pleae input the text you would like to appear when a player is killed.";
mes "^AAAAAAExample: Player <had his brains eaten>!^000000"; // @FlavorText$ would replace < >
input @FlavorText$;
next;
mes .npcname$;
mes "The message that will be broadcasted when a player dies is:";
mes "^FF0000Player "+@FlavorText$+"!^000000";
mes " ";
mes "Is that correct?";
next;
menu "Yes, that's fine",CorrectFlavor,"No, let me change it",FlavorText,"Nevermind",Nothing;
CorrectFlavor:
set $flavor,1; // At this point, Flavor Text has been defined
goto AnnounceMenu;
MobAnnouncer:
if ($flavor != 1) { // Check if Flavor Text has been defined yet
next;
mes .npcname$;
mes "I'm sorry, but you haven't set the Flavor Text yet!";
next;
goto AnnounceMenu;
} else {
if ($mobactive == 1) {
next;
mes .npcname$;
mes "The Mob Announcer is currently active.";
mes "Would you like to disable it?";
menu "Yes",DeactivateMob,"No",AnnounceMenu;
DeactivateMob:
next;
mes .npcname$;
mes "The Mob Announcer has been deactivated.";
set $mobactive,0; // Define the Mob Announcer as "inactive"
goto AnnounceMenu;
} else {
next;
mes .npcname$;
mes "Would you like to enable the Mob Announcer?";
mes "This will broadcast player deaths when they're killed by monsters.";
menu "Yes",ActivateMob,"No",AnnounceMenu;
ActivateMob:
next;
mes .npcname$;
mes "The Mob Announcer has been activated.";
set $pkactive,0; // Define the PK Announcer as "inactive"
set $mobactive,1; // Define the Mob Announcer as "active"
goto AnnounceMenu;
}
PKAnnouncer:
if ($flavor != 1) { // Check if Flavor Text has been defined yet
next;
mes .npcname$;
mes "I'm sorry, but you haven't set the Flavor Text yet!";
next;
goto AnnounceMenu;
} else {
if ($pkactive == 1) {
next;
mes .npcname$;
mes "The PK Announcer is currently active.";
mes "Would you like to disable it?";
menu "Yes",DeactivatePK,"No",AnnounceMenu;
DeactivatePK:
next;
mes .npcname$;
mes "The PK Announcer has been deactivated.";
set $pkactive,0; // Define the PK Announcer as "inactive"
goto AnnounceMenu;
} else {
next;
mes .npcname$;
mes "Would you like to enable the PK Announcer?";
mes "This will broadcast player deaths when they're killed by other players.";
menu "Yes",ActivatePK,"No",AnnounceMenu;
ActivatePK:
next;
mes .npcname$;
mes "The PK Announcer has been activated.";
set $mobactive,0; // Define the Mob Announcer as "inactive"
set $pkactive,1; // Define the PK Announcer as "active"
goto AnnounceMenu;
}
// Announcers
OnPCDieEvent:
if ($mobactive == 1) {announce strcharinfo(0) +" "+ @FlavorText$ +"!",bc_map;}
end;
OnPCKillEvent:
if ($pkactive == 1) {set .@name$, strcharinfo(0);attachrid killedrid;announce strcharinfo(0)+" "+@FlavorText$+" by "+.@name$+"!",bc_map;}
end;
}
}
} else {dispbottom "You are not authorized to use this feature.";end;}
}