I'd like to create an NPC that uses a death announcer similar to the ones included in AnnieRuru's posts in a different thread for the purpose of helping event GMs keep a track of deaths while maintaining a creative flair. Ideally, the announcements would be local broadcast and configured by the GM upon whispering anything to npc:death. In theory, it'd look a little something like this:
- 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?";
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?";
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
if ($mobevent == 1) {
OnPCDieEvent:
announce strcharinfo(0) + @FlavorText$ +"!",bc_map; // Announce player death by monster
end;
}
else {
if ($pkevent == 1) {
OnPCKillEvent:
set .@name$, strcharinfo(0);
attachrid killedrid;
announce strcharinfo(0)+" "+@FlavorText$+" by "+.@name$+"!",bc_map; // Announce player death by PK
end;
}
}
}
}
}
else {
dispbottom "You are not authorized to use this feature."; // Reject player access
end;
}
}
Status:
I wrote this myself lol, it's not fully functional. The way its written, it does broadcast upon death, but it's excluding the @FlavorText$ input and announces twice; my intent for two announcements is so that if one is activated, the other is deactivated immediately. In addition, the NPC's name doesn't show up and the AnnouncerMain dialogue floods the previous window. If anyone can provide some constructive feedback in favor of fixing this script, I'd really appreciate it.
Question
Mumbles
I'd like to create an NPC that uses a death announcer similar to the ones included in AnnieRuru's posts in a different thread for the purpose of helping event GMs keep a track of deaths while maintaining a creative flair. Ideally, the announcements would be local broadcast and configured by the GM upon whispering anything to npc:death. In theory, it'd look a little something like this:
Status:
I wrote this myself lol, it's not fully functional. The way its written, it does broadcast upon death, but it's excluding the @FlavorText$ input and announces twice; my intent for two announcements is so that if one is activated, the other is deactivated immediately. In addition, the NPC's name doesn't show up and the AnnouncerMain dialogue floods the previous window. If anyone can provide some constructive feedback in favor of fixing this script, I'd really appreciate it.
Edited by ViaLink to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.