Jump to content
  • 0

Any npc like this?


eboni001

Question


  • Group:  Members
  • Topic Count:  79
  • Topics Per Day:  0.02
  • Content Count:  327
  • Reputation:   4
  • Joined:  06/22/13
  • Last Seen:  

edited post:

 

Hello guys, can somebody make or share a script like this? please ^_^.:

 

**Development News NPC:

My idea is an npc where "Admin" can leave information(prefer in game but if not is welcome too) about any changes in server such as:

 

xx/xx/xxxx: Broadcast npc already fixed now you can blah blah blah.

 

- xx/xx/xxxx: New custom items/quest has been implemented.

 

- etc. etc. i decide when to stop writing my news xD.

 

- i can edit posted news, such as delete them, remove some or add more.

 

 

hope somebody please help me with this npc ^_^, thanks in advance guys.

Edited by eboni001
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

 

Here the docs about colors

Inside the string you may put color codes, which will alter the color of the

text printed after them. The color codes are all '^<R><G><B>' and contain three

hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is

bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.

^FF00FF is a pure magenta, but it's also a color that is considered transparent

whenever the client is drawing windows on screen, so printing text in that color

will have kind of a weird effect. Once you've set a text's color to something,

you have to set it back to black unless you want all the rest of the text be in

that color:

    mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";

ok ty i already fixed the colors, how i can "edit/add/delete" news, in-game? this is my script:

 

/* Run this query before installing this script...
CREATE TABLE IF NOT EXISTS `news` (
  `id` bigint(20) unsigned NOT NULL auto_increment,
  `post_name` varchar(30) NOT NULL default '',
  `post_id` int(11) unsigned NOT NULL default '0',
  `title` varchar(45) NOT NULL default '',
  `message` varchar(255) NOT NULL default '',
  `time` date NOT NULL default '0000-00-00',
  `status` tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM;
*/

//Version 1
prontera.gat,151,184,5	script	Server News	857,{
query_sql("SELECT * FROM `news` ORDER BY `id` DESC",.@id,.@post_name$,.@post_id,.@title$,.@message$,.@time$,.@status);
set .@len, getarraysize(.@post_id);
copyarray .@og_stat[0],.@status,128;
set @menu, -1;

	if(getgmlevel()>10) {
		mes .npc$;
		mes "Would you like to view the normal player menu?"; next;
		if(select("No:Yes")&2) goto L_Menu;
		
L_GM_Menu:
		mes .npc$;
		mes "Hello, "+strcharinfo(0)+", what would you like to do?"; next;
		switch(select("(^11772dAdd^000000)"+((.@len)?":(^FF0000Remove^000000)^0000FFFeature^000000):[^8700c9Submit^000000]":""))) {
			case 1:
				mes .npc$;
				mes "#Title# (45 Character Limit)";
				input(.@title$[.@len]);
				mes "#Message# ("+.in_len+" Character Limit)";
				input(.@message$[.@len]); next;
				while(getstrlen(.@message$[.@len])<.in_len) {
					set(.@length, .in_len-getstrlen(.@message$[.@len]));
					mes .npc$;
					mes "Would you like to add more to the message?";
					mes "^656565("+.@length+" Characters Left)^000000"; next;
					if(select("Yes:No")&2) break;
					input(.@tmp$);
					set .@message$[.@len],.@message$[.@len]+.@tmp$;
				}
				set .@post_name$[.@len], strcharinfo(0);
				set .@post_id[.@len], getcharid(0);
				if(.rathena) set .@time$[.@len], gettimestr("%Y-%m-%d",21);
				else { query_sql("SELECT CURDATE()",.@tym$); set .@time$[.@len],.@tym$; }
				set .@status[.@len], 2;
				set .@og_stat[.@len], 2;
				set .@len, getarraysize(.@post_id);
				set .@id[.@len-1], .@len;
				mes .npc$;
				mes "Added!"; next;
				goto L_GM_Menu;
			
			case 2:
				mes .npc$;
				mes "Select a notice to remove or restore it.";
				next;
			Rm_Menu:
				set .@menu$, "";
				set .@a, -1;
				while(set(.@a,.@a+1)<.@len)
					if(.@status[.@a]==1) set .@menu$,.@menu$+ .@post_name$[.@a]+
						" [^0000FF"+.@title$[.@a]+
						"^000000] ~ ("+.@time$[.@a]+"):";
					else if (!.@status[.@a]) set .@menu$,.@menu$+ 
						"^C0C0C0//"+.@post_name$[.@a]+
						" ["+.@title$[.@a]+
						"] ~ ("+.@time$[.@a]+")^000000:";
					else if (.@status[.@a]==2) set .@menu$,.@menu$+ 
						"^11772d+"+.@post_name$[.@a]+
						" ["+.@title$[.@a]+
						"] ~ ("+.@time$[.@a]+")^000000:";
					else if (.@status[.@a]==-1) set .@menu$,.@menu$+ 
						"^FF0000-"+.@post_name$[.@a]+
						" ["+.@title$[.@a]+
						"] ~ ("+.@time$[.@a]+")^000000:";
				set .@menu$,.@menu$+"[^8700c9Back^000000]";
				select(.@menu$);
				if(@menu-1>=.@len) goto L_GM_Menu;
				set .@status[@menu-1], ((.@status[@menu-1]==-1)?
											.@og_stat[@menu-1]:-1);
				goto Rm_Menu;

			case 3:
				mes .npc$;
				mes "Select a notice to enable or disable it.";
				next;
			Ft_Menu:
				set .@menu$, "";
				set .@a, -1;
				while(set(.@a,.@a+1)<.@len)
					if(.@status[.@a]==1) set .@menu$,.@menu$+ .@post_name$[.@a]+
						" [^0000FF"+.@title$[.@a]+
						"^000000] ~ ("+.@time$[.@a]+"):";
					else if (!.@status[.@a]) set .@menu$,.@menu$+ 
						"^C0C0C0//"+.@post_name$[.@a]+
						" ["+.@title$[.@a]+
						"] ~ ("+.@time$[.@a]+")^000000:";
					else if (.@status[.@a]==2) set .@menu$,.@menu$+ 
						"^11772d+"+.@post_name$[.@a]+
						" ["+.@title$[.@a]+
						"] ~ ("+.@time$[.@a]+")^000000:";
					else if (.@status[.@a]==-1) set .@menu$,.@menu$+ 
						"^FF0000-"+.@post_name$[.@a]+
						" ["+.@title$[.@a]+
						"] ~ ("+.@time$[.@a]+")^000000:";
				set .@menu$,.@menu$+"[^8700c9Back^000000]";
				select(.@menu$);
				if(@menu>.@len) goto L_GM_Menu;
				set .@status[@menu-1], ((.@status[@menu-1])?
												0:((.@og_stat[@menu-1])?.@og_stat[@menu-1]:1));
				goto Ft_Menu;
			
			case 4:
				set .@a, -1; set .@b, 0;
				while(set(.@a,.@a+1)<.@len) {
					if(.@og_stat[.@a]==2&&.@status[.@a]==-1)
						set .@b, .@b+1;
					if(.@og_stat[.@a]==2&&.@status[.@a]!=-1)
						query_sql("INSERT INTO `news` (`post_name`,`post_id`,`title`,`message`,`time`,`status`) "+
							"VALUES ('"+.@post_name$[.@a]+
							"',"+.@post_id[.@a]+
							",'"+escape_sql(.@title$[.@a])+
							"','"+escape_sql(.@message$[.@a])+"',"+
							"CURDATE(),"+((.@status[.@a]>=1)?1:0)+")");
					if(.@status[.@a]!=.@og_stat[.@a]&&.@status[.@a]!=-1)
						query_sql("UPDATE `news`"+
							"SET `status`="+((.@status[.@a]>=1)?1:0)+" "+
							"WHERE `id`="+(.@id[.@a]+.@+";");
					if(.@status[.@a]<0&&.@og_stat[.@a]!=2)
						query_sql("DELETE FROM `news`"+
							"WHERE `id`="+(.@id[.@a]+.@+";");
				}
				mes .npc$;
				mes "Server News Updated!";
				close;
		}
	}

L_Menu:
	set .@a, -1;
	while(set(.@a,.@a+1)<.@len)
		if(.@status[.@a]) {
			set @menu, .@a;
			break;
		}
		
L_PC_Menu:
	set .@a, -1;
	set .@menu$, ""; set .@f, 0;
	while(set(.@a,.@a+1)<.@len) {
		if(.@status[.@a]) {
			set .@menu$,.@menu$+ .@post_name$[.@a]+
				" [^0000FF"+.@title$[.@a]+
				"^000000] ~ ("+.@time$[.@a]+"):";
			setarray .@b[.@a], .@f;
		} else
			set(.@f,.@f+1);
	}
	if(!.@len||.@menu$=="") {
		mes .npc$;
		mes "I'm sorry no news has been posted.";
		close;
	}
	mes "[^0000FF"+.@title$[@menu]+"^000000]";
	if(compare(.@message$[@menu],.line$)) {
		if(.rathena) explode(@explode$,.@message$[@menu],.line$);
		else callfunc("str_explode","@explode$[0]",.@message$[@menu],"/");
		set .@a, -1;
		set .@str_len, getarraysize(@explode$);
		while(set(.@a,.@a+1)<.@str_len) {
			if(.case&&!.rathena) {
				callfunc "str_toarray", @explode$[.@a], "@tmp$[0]";
				set @tmp$[0],callfunc("str_changecase", @tmp$[0], 1);
				set @explode$[.@a],""; set .@i,0;
				while(getstrlen(@explode$[.@a])<getarraysize(@tmp$)) {
					set @explode$[.@a],@explode$[.@a]+@tmp$[.@i];
					set .@i,.@i+1;
				}
			}
			mes @explode$[.@a];
		}
	} else { mes .@message$[@menu]; }
	mes "By: "+.@post_name$[@menu]+".";
	mes "^656565(@ "+.@time$[@menu]+")^000000"; next;
	set .@menu$,.@menu$+"Cancel";
	select(.@menu$);
	if(@menu>(.@len-.@f)) close;
	set @menu, ((@menu-1)+.@b[(@menu-1)]);
	goto L_PC_Menu;
		

end;
OnInit:
	set .npc$,	"[^0000FFServer News^000000]";
	waitingroom "Server News!",0;
	set .rathena, 1; // If you're running rAthena or not. 0=off/1=on
	set .case, 1; // For non-rAthena only restores upper-case strings.
	set .in_len, 210; // Max input length.
	set .line$, "/"; // Line break used to seperate lines.
	/* Changing the linebreak for non-rAthena clients doesn't work
	You have to find callfunc("str_explode","@explode$[0]",.@message$[@menu],"/");
	and change "/" to what ever you want. (Example "|").*/
}

function	script	str_explode	{

	if ( getarg(2,"") == "" )
		return callfunc("str_toarray", getarg(1), getarg(0) );

	sleep2 1;

	setarray .@char$, getarg(2),
		" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
		"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",
		"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",
		"z", "x", "j", "w", "_", "-", "|", "/", ".", "'", "[",
		"]", "(", ")", "=", "*", "&", "#", "@", "!", "+", "`",
		"~", "%", "<", ">", "?", ",", "^", ":";

	set .@charsize, getarraysize(.@char$);
	set .@tmp$, "|~key~|";
	set .@str$, .@tmp$ + getarg(1) ;
	set .@len, getstrlen(getarg(1));
	set .@parse_len, getstrlen(getarg(2));

	while( .@len > .@s ) {
		set .@i, 0 ; 
		while( .@i < .@charsize  ) {
			if ( ! ( set(.@l,.@l+1) % 600) )
				sleep2 1;
			if ( compare( .@str$ , .@tmp$ + .@char$[.@i] ) ) {
				set .@tmp$, .@tmp$ + .@char$[.@i];
				if ( .@i ) 
					set .@arr$[.@p], .@arr$[.@p] + .@char$[.@i];
				else {
					set .@p, .@p + 1;
					set .@s, .@s + .@parse_len-1 ;
				}
				break;
			}
			set .@i, .@i+1 ;
		}
		if ( .@i == .@charsize ) return 0;
		else set .@s, .@s+1 ;
	}
	deletearray getd(getarg(0));
	copyarray getd(getarg(0)), .@arr$, .@p+1;
	return .@p+1;
}

function	script	str_changecase	{
	sleep2 1;
	if ( getarg(1) ) {
		setarray .@char$[ 0 ],
			" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
			"E", "I", "A", "S", "R", "N", "T", "O", "U", "L", "C",
			"P", "M", "D", "V", "H", "G", "F", "B", "Y", "Q", "K",
			"Z", "X", "J", "W", "_", "-", "(", ")", ";", ",", ":",
			".", "*", "!", "?", "'";
	}
	else {
		setarray .@char$[ 0 ],
			" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
			"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",
			"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",
			"z", "x", "j", "w", "_", "-", "(", ")", ";", ",", ":",
			".", "*", "!", "?", "'";
	}
	set .@charsize, getarraysize(.@char$);
	set .@str$, "|~key~|" + getarg(0) ;
	set .@len, getstrlen(getarg(0));
	while( .@len>.@s ) {
		set .@i,0;
		while( .@i<.@charsize ) {
			if ( ! ( set(.@l,.@l+1) % 650) )
				sleep2 1;
			if ( compare( .@str$ , "|~key~|" + .@tmp$ + .@char$[.@i] ) ) {
				set .@tmp$, .@tmp$ + .@char$[.@i];
				break;
			}
			set .@i, .@i+1;
		}
		if ( .@i == .@charsize ) return "";
		else set .@s, .@s+1;
	}
	return .@tmp$;
}

function	script	str_toarray	{
	sleep2 1;
	if ( getstrlen( getarg(0) ) > 128 ) return 0;
	setarray .@char$[ 0 ],
		" ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
		"e", "i", "a", "s", "r", "n", "t", "o", "u", "l", "c",
		"p", "m", "d", "v", "h", "g", "f", "b", "y", "q", "k",
		"z", "x", "j", "w", "_", "-", "(", ")", ";", ",", ":",
		".", "*", "!", "?", "'";

	set .@charsize, getarraysize(.@char$);
	set .@tmp$, "|~key~|";
	set .@str$, .@tmp$ + getarg(0) ;
	set .@len, getstrlen(getarg(0));
	while( .@len>.@s ) {
		set .@i,0;
		while( .@i<.@charsize ) {
			if ( ! ( set(.@l,.@l+1) % 650) )
				sleep2 1;
			if ( compare( .@str$ , .@tmp$ + .@char$[.@i] ) ) {
				set .@tmp$, .@tmp$ + .@char$[.@i];
				set .@arr$[.@s], .@char$[.@i];
				break;
			}
			set .@i, .@i+1;
		}
		if ( .@i == .@charsize ) return 0;
		else set .@s, .@s+1;
	}
	deletearray getd(getarg(1));
	copyarray getd(getarg(1)), .@arr$, .@len;
	return .@len;
}
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Survey NPC is good on your poll request just use search engine to find it

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  79
  • Topics Per Day:  0.02
  • Content Count:  327
  • Reputation:   4
  • Joined:  06/22/13
  • Last Seen:  

Survey NPC is good on your poll request just use search engine to find it

Hey Patskie this survey npc is almost the same i want, not the same, but almost, its pretty enough ty very much it really helped me ^_^.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  79
  • Topics Per Day:  0.02
  • Content Count:  327
  • Reputation:   4
  • Joined:  06/22/13
  • Last Seen:  

bump for development news ^_^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  79
  • Topics Per Day:  0.02
  • Content Count:  327
  • Reputation:   4
  • Joined:  06/22/13
  • Last Seen:  

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

You can <em>easily</em> write your own NPC <img data-cke-saved-src="http://rathena.org/board/public/style_emoticons/default/tongue.png" src="http://rathena.org/board/public/style_emoticons/default/tongue.png" class="bbc_emoticon" title=":P" /><pre class="_prettyXprint _lang-auto _linenums:0">prontera,156,163,4 script Server News 844,{

mes "[server News]";

mes "1. xx/xx/xxxx: Broadcast npc already fixed now you can blah blah blah.";

next;

mes "[server News]";

mes "2. xx/xx/xxxx: New custom items/quest has been implemented.";

next;

mes "[server News]";

mes "3. Some more news...";

next;

mes "[server News]";

mes "That's all!";

close;

}</pre>

Edit: I don't know why the bbcode tags sometimes won't work as intended.

When I posted, I only use italic + code tag, and the result is shown like the above...

Edited by nanakiwurtz
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  79
  • Topics Per Day:  0.02
  • Content Count:  327
  • Reputation:   4
  • Joined:  06/22/13
  • Last Seen:  

You can <em>easily</em> write your own NPC <img data-cke-saved-src="http://rathena.org/board/public/style_emoticons/default/tongue.png" src="http://rathena.org/board/public/style_emoticons/default/tongue.png" class="bbc_emoticon" title=":P" /><pre class="_prettyXprint _lang-auto _linenums:0">prontera,156,163,4 script Server News 844,{

mes "[server News]";

mes "1. xx/xx/xxxx: Broadcast npc already fixed now you can blah blah blah.";

next;

mes "[server News]";

mes "2. xx/xx/xxxx: New custom items/quest has been implemented.";

next;

mes "[server News]";

mes "3. Some more news...";

next;

mes "[server News]";

mes "That's all!";

close;

}</pre>

Edit: I don't know why the bbcode tags sometimes won't work as intended.

When I posted, I only use italic + code tag, and the result is shown like the above...

thank you i dont know how to script but i take your example like a guide and i made it ^_^ but now i want to add some details i dont know how to do it: i want to can add/delete/edit news in-game, turn npc name Blue, name of player talking to npc and Server News title to Red, and each number of each news to Green, please somebody help me with this ^_^.

 

this is the npc:

prontera,146,165,6	script	Development News	864,{
	mes "[GM Emely]";
	mes "Hello "+strcharinfo(0)+", maybe you know me, but let me introduce myself, I am GM Emely responsible of inform to all KyojinRO players about the good news on the progress of the server.";
	next;
	mes "[GM Emely]";
	mes "i can provide some news such as, any updates, new npc's, bugs already fixed and any other changes my superior permit me to inform about the server.";
	next;
	mes "[GM Emely]";
	mes "Ok, let me tell you some of the good news.";
	next;
	mes "[Server News]";
	mes "1. Broadcast npc already fixed now it have a 3 minuets delay per account, you can use it at the cost of 1m zeny and it will broadcast your message to all the server.";
	next;
	mes "[Server News]";
	mes "2. Build manager npc have been implemented, you can save your builds and just got them back with 1 click, it is located on prontera, 188, 209.";
	next;
	mes "[Server News]";
	mes "3. DJ PvP have been implemented on pvp rooms, it can play a music to make you feel confortable during your battles, it is located in the top of each pvp room.";
	next;
	mes "[Server News]";
	mes "That's all for now, enjoy playing KyojinRO!";
	close;
}
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Here the docs about colors

Inside the string you may put color codes, which will alter the color of the
text printed after them. The color codes are all '^<R><G><B>' and contain three
hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
^FF00FF is a pure magenta, but it's also a color that is considered transparent
whenever the client is drawing windows on screen, so printing text in that color
will have kind of a weird effect. Once you've set a text's color to something,
you have to set it back to black unless you want all the rest of the text be in
that color:

    mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  79
  • Topics Per Day:  0.02
  • Content Count:  327
  • Reputation:   4
  • Joined:  06/22/13
  • Last Seen:  

Here the docs about colors

Inside the string you may put color codes, which will alter the color of the

text printed after them. The color codes are all '^<R><G><B>' and contain three

hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is

bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.

^FF00FF is a pure magenta, but it's also a color that is considered transparent

whenever the client is drawing windows on screen, so printing text in that color

will have kind of a weird effect. Once you've set a text's color to something,

you have to set it back to black unless you want all the rest of the text be in

that color:

    mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";

ok ty i already fixed the colors, how i can "edit/add/delete" news, in-game? this is my script:

 

prontera,146,165,6	script	Development News	864,{
	mes "[^0000ff GM Emely ^000000]";
	mes "Hello ^FF0000 "+strcharinfo(0)+" ^000000, maybe you know me, but let me introduce myself, I am GM Emely responsible of inform to all ^009900 KyojinRO ^000000 players about the good news on the progress of the server.";
	next;
	mes "[^0000ff GM Emely ^000000]";
	mes "i can provide some news such as, any updates, new npc's, bugs already fixed and any other changes my superior permit me to inform about the server.";
	next;
	mes "[^0000ff GM Emely ^000000]";
	mes "Ok, let me tell you some of the good news.";
	next;
	mes "[^FF0000 Server News ^000000]";
	mes "^0000ff 1 ^000000. Broadcast npc already fixed now it have a 3 minuets delay per account, you can use it at the cost of 1m zeny and it will broadcast your message to all the server.";
	next;
	mes "[^FF0000 Server News ^000000]";
	mes "^0000ff 2 ^000000. Build manager npc have been implemented, you can save your builds and just got them back with 1 click, it is located on prontera, 188, 209.";
	next;
	mes "[^FF0000 Server News ^000000]";
	mes "^0000ff 3 ^000000. DJ PvP have been implemented on pvp rooms, it can play a music to make you feel confortable during your battles, it is located in the top of each pvp room.";
	next;
	mes "[^0000ff GM Emely ^000000]";
	mes "That's all for now, enjoy playing ^009900 KyojinRO ^000000!";
	close;
}
Link to comment
Share on other sites

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.

×
×
  • Create New...