Jump to content
  • 0

Messenger NPC using dispbottom function


Question

Posted

Can someone please make me an npc that only lvl 60 GMs and above can talk to and what happens when you talk to it, it will give you 3 options + close/cancel. The three choices will be "pvp1" , "gvg", and "bg".

 

When you choose pvp1, the npc will send a dispbottom message to all online players saying "A GM wishes to observe the PVP, proceed there if you wish to join."

if you choose gvg, the npc will send a dispbottom message to all online players saying "A GM is calling all guilds wishing to fight in the GVG arena."

if you choose bg, the npc will send a dispbottom message to all online players saying "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."

^Also, if it's possible, can the dispbottom message be in the "6600CC" color?

Thank you in advance to whoever will help me.

16 answers to this question

Recommended Posts

Posted

Try :

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: addrid(0); Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: addrid(0); Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: addrid(0); Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close; break;
        default: break;
    }
    
    end;
    
    function    Display    {
        dispbottom getarg(0);
        return;
    }
}
Posted

update your rathena to latest .... only rathena have addrid ....

 

^Also, if it's possible, can the dispbottom message be in the "6600CC" color?

it should be

announce ""+getarg(0),bc_self,0x6600CC;
Posted

eAthena

 

Didn't test :

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close; break;
        default: break;
    }
    
    function    Display    {
        query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `login`.`level` = 0 AND `char`.`online` = 1",.@aid;
        set .@size, getarraysize(.@aid);
        while ( .@i < .@size ) {
            if ( attachrid( .@aid[.@i] ) )
                dispbottom getarg(0);
            detachrid;
            set .@i, .@i + 1;
        }
        return;
    }
}
Posted

eAthena

 

Didn't test :

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close; break;
        default: break;
    }
    
    function    Display    {
        query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `login`.`level` = 0 AND `char`.`online` = 1",.@aid;
        set .@size, getarraysize(.@aid);
        while ( .@i < .@size ) {
            if ( attachrid( .@aid[.@i] ) )
                dispbottom getarg(0);
            detachrid;
            set .@i, .@i + 1;
        }
        return;
    }
}

The message thing works but when I choose an option, it doesn't do anything and the message box will stay there so I have to close my client or warp somewhere else.

Posted

@Patskie:

1. "break;" after "close;" is pointless since "close;" already terminated the script.

2. *Athena has a limit of 128 entries per array. So you'll only select the first 128 online players with that query.

 

 

The message thing works but when I choose an option, it doesn't do
anything and the message box will stay there so I have to close my
client or warp somewhere else.

That's because there is an "end;" missing behind the switch block. The function "Display" return into the switch-block - "break;" is executed and nothing more happens; no "close;" no "end;"....

 

Updated script (untested, because I'm at work):

prontera,150,150,0    script    Sample    100,{

    function Display;

    if ( getgmlevel() < 60 ) end;
    set .@npc$, "[ " +strnpcinfo(1)+ " ]";
    
    mes .@npc$;
    mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
    next;
    
    switch( select("PVP1:GVG:BG:Cancel") ) {
        case 1: Display("A GM wishes to observe the PVP, proceed there if you wish to join."); break;
        case 2: Display("A GM is calling all guilds wishing to fight in the GVG arena."); break;
        case 3: Display("A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."); break;
        case 4: close;
        default: break;
    }
	end;
    
    function    Display    {
		set .@query_i, 0;
		while(1)
		{
			query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` LIMIT .@query_i, 128 WHERE `login`.`level` = 0 AND `char`.`online` = 1", .@aid;
			set .@query_i, .@query_i + 128;
			set .@size, getarraysize(.@aid);
			for(set .@i, 0; .@i < .@size; set .@i, .@i + 1)
			{
				if (attachrid(.@aid[.@i]))
					dispbottom getarg(0);
				detachrid;
			}
			if(.@size < 128)
				break;
		}
        return;
    }
}
  • Upvote 1
Posted

Yaa miss that one >.<. 

query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` LIMIT .@query_i, 128 WHERE `login`.`level` = 0 AND `char`.`online` = 1", .@aid;

Should be : 

query_sql "SELECT `char`.`account_id` FROM `char` JOIN `login` ON `char`.`account_id` = `login`.`account_id` WHERE `login`.`level` = 0 AND `char`.`online` = 1 LIMIT " +.@query_i+ ", 128", .@aid;

otherwise you will receive syntax error.

  • Upvote 1
Posted


prontera,150,150,0 script Sample 100,{

if ( getgmlevel() < 60 ) end;

set .@npc$, "[ " +strnpcinfo(1)+ " ]";

mes .@npc$;

mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";

next;

switch( select("PVP1:GVG:BG:Cancel") ) {

case 1: announce "A GM wishes to observe the PVP, proceed there if you wish to join.",bc_all,0x6600CC; break;

case 2: announce "A GM is calling all guilds wishing to fight in the GVG arena.",bc_all,0x6600CC; break;

case 3: announce "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate.",bc_all,0x6600CC; break;

case 4:

mes "Good bye.";

close;

}

mes "Done.";

close;

}

Posted
prontera,150,150,0	script	Sample	100,{
	if ( getgmlevel() < 60 ) end;
	set .@npc$, "[ " +strnpcinfo(1)+ " ]";
	
	mes .@npc$;
	mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
	next;
	switch( select("PVP1:GVG:BG:Cancel") ) {
		case 1: announce "A GM wishes to observe the PVP, proceed there if you wish to join.",bc_all,0x6600CC; break;
		case 2: announce "A GM is calling all guilds wishing to fight in the GVG arena.",bc_all,0x6600CC; break;
		case 3: announce "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate.",bc_all,0x6600CC; break;
		case 4:
			mes "Good bye.";
			close;
	}
	mes "Done.";
	close;
}

He want a dispbottom approach 

Posted
prontera,150,150,0	script	Sample	100,{
	if ( getgmlevel() < 60 ) end;
	set .@npc$, "[ " +strnpcinfo(1)+ " ]";
	
	mes .@npc$;
	mes "What do you want, " + (Sex ? "Sir" : "Maam") + " " +strcharinfo(0)+ "?";
	next;
	switch( select("PVP1:GVG:BG:Cancel") ) {
		case 1: globalmes "A GM wishes to observe the PVP, proceed there if you wish to join."; break;
		case 2: globalmes "A GM is calling all guilds wishing to fight in the GVG arena."; break;
		case 3: globalmes "A GM wishes to start the Battlegrounds, proceed to BG arena if you wish to participate."; break;
		case 4:
			mes "Good bye.";
			close;
	}
	mes "Done.";
	close;
}

The message can't be in color then.

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...