Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Add-on] GM notice Npc

Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
This NPC is actually kind of useless but I got bored and scripted it. If you notice any problems let me know. I never had the opportunity to test it but if anyone could test it let me know!

PHP:
/** 
* 
*@author Soulfist 
*/ 

importPackage(Packages.tools.MaplePacketCreator);

status = 0, sname = "DominoStory", n = ""; 
Op = ["Urgent", "Warning", "Ban", "Severe", "Communication"];  

function start() { 
    var t = "Welcome to"+sname+", I am the GM notice NPC, which type will it be?"; 
    for(var i = 0; i < Op.length; t += "\r\n#L"+i+"#"+Op[i]+"#l", i++); 
    cm.sendSimple(t); 
} 

function action(m, t, s) { 
    status++;
    if (m != 1) { 
        cm.dispose(); 
        return; 
    } 
    if (status == 1) { 
        if (cm.getPlayer().gmLevel() >= 3)
            cm.sendGetText("Please type your desired announcement:\r\n"); 
        else { 
            cm.sendOk("You aren't a GM, please don't cause trouble"); 
            cm.dispose(); 
        } 
    } else if (status == 2) { 
        n = cm.getText(); 
        cm.getClient().getChannelServer().getWorldInterface().broadcastGMMessage(null, MaplePacketCreator.serverNotice(6, "["+Op[s]+"] "+n).getBytes()); 
        cm.dispose(); 
    } 
}


It basically just sends out a server notice so GMs can communicate across channels and such. Like I said its not too useful but maybe someone will like it ;)
Enjoy.

Note: It will only work if you have the "gmLevel" method. Those who dont can substitute it for "isGM" or w/e. Have fun :scared:

Edit 1: To make it for donors, change this bit.
PHP:
cm.getPlayer().gmLevel() >= 2
To
PHP:
cm.getPlayer().gmLevel() > 1
And of cource change the message and the types of announcements at the top, the loop is made to hold as many selections as you want, so enjoy...
 
Last edited:
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
Thanks but its still somewhat useless ._.

I just couldnt think of any ideas, like yesterday.

-refers you to me and chris's JQ release-
 
Initiate Mage
Joined
Jan 28, 2011
Messages
3
Reaction score
0
It's semi-useful. You could also make it a command. I'm pretty sure it's already out, but you could improve the command.
 
Custom Title Activated
Loyal Member
Joined
Aug 21, 2009
Messages
1,149
Reaction score
598
I'm a bit tired. But again, that won't work and it's untested. :thumbsdown:
 
Newbie Spellweaver
Joined
Nov 27, 2009
Messages
94
Reaction score
58
Excuse me sir, where's your proof that this doesn't work? It looks okay to me.

He calls a reference to MaplePacketCreator but doesn't import it.

Not sure if this is intended, but this logic does the opposite of what it's supposed to:

PHP:
if (cm.getPlayer().gmLevel() <= 2) {
cm.sendGetText("Please type your desired announcement:\r\n");
      } else {
cm.sendOk("You aren't a GM, please don't cause trouble");
^means players can do it, and anyone whose gm level is greater than 2 can't do it, which contradicts the else statement.

He doesn't use a try-catch block for the WorldInterface method, so the NPC won't work if it throws a RemoteException.

Also, in the description he says that it's for GMs to communicate across channels, but the method he used will make it show to all players as well.
 
Skilled Illusionist
Joined
Dec 16, 2010
Messages
304
Reaction score
164
He calls a reference to MaplePacketCreator but doesn't import it.

Not sure if this is intended, but this logic does the opposite of what it's supposed to:

PHP:
if (cm.getPlayer().gmLevel() <= 2) {
cm.sendGetText("Please type your desired announcement:\r\n");
      } else {
cm.sendOk("You aren't a GM, please don't cause trouble");
^means players can do it, and anyone whose gm level is greater than 2 can't do it, which contradicts the else statement.

He doesn't use a try-catch block for the WorldInterface method, so the NPC won't work if it throws a RemoteException.

Also, in the description he says that it's for GMs to communicate across channels, but the method he used will make it show to all players as well.
Guess I should have looked at this npc a bit longer o-o Thanks for the reasoning.
 
Custom Title Activated
Loyal Member
Joined
Aug 21, 2009
Messages
1,149
Reaction score
598
Excuse me sir, where's your proof that this doesn't work? It looks okay to me.

I may be inactive at coding at this moment, but I got an eye to detect error really fast if I go to compare.

The reason I said what I said is just simply because:

PHP:
    function start() {
var t = "Welcome to"+sname+", I am the GM notice NPC, which type will it be?";
    for(var i = 0; i < Op.length; i++) {
t += "\r\n#L"+i+"#"+Op[i]+"#l";
   cm.sendSimple(t);
}

function action(m, t, s) {

If you fail to see the huge fail in that syntax then I suggest you to re-read it until you do it because it's really clear.
 
Skilled Illusionist
Joined
Dec 16, 2010
Messages
304
Reaction score
164
I may be inactive at coding at this moment, but I got an eye to detect error really fast if I go to compare.

The reason I said what I said is just simply because:

PHP:
    function start() {
var t = "Welcome to"+sname+", I am the GM notice NPC, which type will it be?";
    for(var i = 0; i < Op.length; i++) {
t += "\r\n#L"+i+"#"+Op[i]+"#l";
   cm.sendSimple(t);
}

function action(m, t, s) {

If you fail to see the huge fail in that syntax then I suggest you to re-read it until you do it because it's really clear.
Rofl I immediately caught that error when he first showed me the script, and pointed it out to him. I assumed he had fixed it.
 
Newbie Spellweaver
Joined
Feb 4, 2011
Messages
24
Reaction score
0
This is good idea. Let GM players able show message via NPC.
 
Smoke & Fly
Loyal Member
Joined
Apr 21, 2008
Messages
1,190
Reaction score
76
Delete the bracket after the "for(var i = 0; i < Op.length; i++)" thing and it will probably work.
 
Legendary Battlemage
Loyal Member
Joined
Dec 13, 2010
Messages
649
Reaction score
140
I may be inactive at coding at this moment, but I got an eye to detect error really fast if I go to compare.

The reason I said what I said is just simply because:

PHP:
    function start() {
var t = "Welcome to"+sname+", I am the GM notice NPC, which type will it be?";
    for(var i = 0; i < Op.length; i++) {
t += "\r\n#L"+i+"#"+Op[i]+"#l";
   cm.sendSimple(t);
}

function action(m, t, s) {

If you fail to see the huge fail in that syntax then I suggest you to re-read it until you do it because it's really clear.

I see teh sytax error.

Fix3d :*:
 
Initiate Mage
Joined
Nov 4, 2010
Messages
1
Reaction score
0
Yeah, It does kinda feels useless. You could just type !notice, but if the commands aren't working, this might be useful :p
 
Newbie Spellweaver
Joined
Mar 22, 2011
Messages
14
Reaction score
0
Can you provide a ss in your post. At least show others how does it looks like in the game.
 
Back
Top