Jump to content
  • 0

make me this npc script. thanks


Hatake Kakashi

Question


  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.05
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

hello, please can you make me a script like this?

 

a npc with random item giver.

 

like a game.

 

if you give 100 proof of donation, npc will give randomly items. i will put items by myself.

 

 

thank you.

Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  130
  • Topics Per Day:  0.03
  • Content Count:  528
  • Reputation:   18
  • Joined:  09/11/12
  • Last Seen:  

A item random out of the list you create or a item out of the complete ro db?

Link to comment
Share on other sites


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


prontera,150,150,0    script    Random    100,{

    if (countitem(7179) < 100) {

        mes .npc$;

        mes "You don't have 100 proof of donation";

        close;

    }

    mes .npc$;

    mes "Here you go!";

    delitem 7179,100;

    getitem rand(.min_id, .max_id), 1;

    close;

    OnInit:

        .npc$ = strnpcinfo(1);

        .min_id = 7179;

        .max_id = 7227;

        end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   3
  • Joined:  02/24/12
  • Last Seen:  

If you want an item array I think you can do it like this 

setarray .items[0],20000,20001,20002,20003,20004,20005;
getitem .items[rand(0, getarraysize(.items))], 1;

------ 

        .npc$ = strnpcinfo(1);
        .min_id = 7179;
        .max_id = 7227;

Is this possible? I mean I know it's like this in other languages but can we write it like this in athena? o.o

I used to write it like this

set .npc$,""+strnpcinfo(1)+"";
set .min_id,7179;
set .max_id,7227;
Edited by SaZzuke
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2369
  • Joined:  10/28/11
  • Last Seen:  

setarray .items[0],20000,20001,20002,20003,20004,20005;
getitem .items[rand( getarraysize(.items) ) ], 1;

read rand , your previous example will generate an non-exist item ...with item id of 0 ....

 

set .npc$,""+strnpcinfo(1)+"";
set .min_id,7179;
set .max_id,7227;

only possible in rAthena / Hercules ... but not eAthena ....

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.05
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

not working here's the script.

 

i think im wrong with it.

 

prontera,195,175,0	script	Athena Shin	100,{
    if (countitem(7179) < 100) {
        mes .npc$;
        mes "You don't have 100 proof of donation";
        close;
    }
    mes .npc$;
    mes "Here you go!";
    delitem 7179,100;
    getitem rand(.min_id, .max_id), 1;
    close;


    OnInit:
setarray .items[0],7539,5171,2863;
getitem .items[rand( getarraysize(.items) ) ], 1;
        end;
}
Link to comment
Share on other sites


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


prontera,195,175,0 script Athena Shin 100,{

if (countitem(7179) < 100) {

mes .npc$;

mes "You don't have 100 proof of donation";

close;

}

mes .npc$;

mes "Here you go!";

delitem 7179,100;

getitem callfunc("F_RandMes",3,7539,5171,2863),1;

close;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.05
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

so if i add more items?

and how/where to put message? i need to put a message of guide on how to play this game or what item will get to this npc.

Edited by Hatake Kakashi
Link to comment
Share on other sites


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

Attached from phone.

randgetitm.txt

Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.05
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

thanks skorm

 

but how to put global announce when u get those items? thank you.

Link to comment
Share on other sites


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

thanks skorm

 

but how to put global announce when u get those items? thank you.

 

prontera,195,175,0	script	Athena Shin	100,{
	mes .npc_n$;
	mes "Only "+.itm_a+" "+.itm_n$+" to play this random chance mini-game!";
	mes "Would you like to play?"; next;
	if(select("Yes:No:What can I win?")&2) {
		if(@menu-2) {
			set .@mes$, "You can win: ";
			for(set(.@a,1);.@a<=.len_i;set(.@a,.@a+1)) {
				set .@itm$, getitemname(.itm_l[(.@a-1)]);
				if(.@a%10&&.@a<=.len_i&&.@a!=.len_i) {
					set .@mes$, .@mes$+((!((.@a%10)-9)&&.@a<=.len_i)?
							"and "+.@itm$+".":.@itm$+", ");
				} else {
					mes .npc_n$;
					if(.@a<.len_i) {
						mes .@mes$; set .@mes$, "You can also win: "+.@itm$+", "; next;
						if(select("Next:Close")&2) close;
					} else {
						mes .@mes$+"and "+.@itm$+"."; close;
					}
				}
			}
		} else close;
	}
	if (countitem(.itm_p) < .itm_a) {
		mes .npc_n$;
		mes "You don't have "+.itm_a+" "+.itm_n$;
		close;
	}
	mes .npc_n$;
	mes "Here you go!";
	delitem .itm_p,.itm_a;
	set .@get, .itm_l[rand(.len_i-1)];
	if(compare(""+.@get,.itm_a$)) announce strnpcinfo(0)+": "+strcharinfo(0)+" got ["+getitemname(.@get)+"]!",bc_all|bc_yellow;
	getitem .@get,1;
	close;

	OnInit:
		set     	.npc_n$,	"[^00FF00Athena Shin^000000]"                                ; //NPC Name.
		setarray	.itm_l ,	7539, 5171, 2863, 501, 502, 503, 504, 505, 506, 507, 508, 509; //Item List.
		set     	.itm_a$,	"7539, 5171, 2863"                                           ; //Item IDs in this string are announced.
		set     	.len_i ,	getarraysize(.itm_l)                                         ; //Length of array.
		set     	.itm_a ,	100                                                          ; //Cost of npc.
		set     	.itm_p ,	7179                                                         ; //Item used as currency.
		set     	.itm_n$,	getitemname(.itm_p)                                          ; //Item Name.
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  254
  • Topics Per Day:  0.05
  • Content Count:  825
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

not working npc not announce the item you win.

here's my real script and real item id to put on this script

 

prontera,195,175,0	script	Athena Shin	717,{
	mes .npc_n$;
	mes "Only "+.itm_a+" "+.itm_n$+" to play this random chance mini-game!";
	mes "Would you like to play?"; next;
	if(select("Yes:No:What can I win?")&2) {
		if(@menu-2) {
			set .@mes$, "You can win: ";
			for(set(.@a,1);.@a<=.len_i;set(.@a,.@a+1)) {
				set .@itm$, getitemname(.itm_l[(.@a-1)]);
				if(.@a%10&&.@a<=.len_i&&.@a!=.len_i) {
					set .@mes$, .@mes$+((!((.@a%10)-9)&&.@a<=.len_i)?
							"and "+.@itm$+".":.@itm$+", ");
				} else {
					mes .npc_n$;
					if(.@a<.len_i) {
						mes .@mes$; set .@mes$, "You can also win: "+.@itm$+", "; next;
						if(select("Next:Close")&2) close;
					} else {
						mes .@mes$+"and "+.@itm$+"."; close;
					}
				}
			}
		} else close;
	}
	if (countitem(.itm_p) < .itm_a) {
		mes .npc_n$;
		mes "You don't have "+.itm_a+" "+.itm_n$;
		close;
	}
	mes .npc_n$;
	mes "Here you go!";
	delitem .itm_p,.itm_a;
	set .@get, .itm_l[rand(.len_i-1)];
	if(compare(""+.@get,.itm_a$)) announce strnpcinfo(0)+": "+strcharinfo(0)+" got ["+getitemname(.@get)+"]!",bc_all|bc_yellow;
	getitem .@get,1;
	close;

	OnInit:
		set     	.npc_n$,	"[^00FF00Athena Shin^000000]"                                ; //NPC Name.
		setarray	.itm_l ,	7539, 5171, 2629, 501, 502, 2541, 504, 505, 2383, 507, 508, 509; //Item List.
		set     	.itm_a$,	"7539, 5171, 2629, 2383, 2541"                                           ; //Item IDs in this string are announced.
		set     	.len_i ,	getarraysize(.itm_l)                                         ; //Length of array.
		set     	.itm_a ,	100                                                          ; //Cost of npc.
		set     	.itm_p ,	7179                                                         ; //Item used as currency.
		set     	.itm_n$,	getitemname(.itm_p)                                          ; //Item Name.
}

i tried to test this npc i got all this already but still no announce.

 

set     	.itm_a$,	"7539, 5171, 2629, 2383, 2541"                                           ; //Item IDs in this string are announced.
Edited by Hatake Kakashi
Link to comment
Share on other sites


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

Sorry about that small error on my part.

 

Replace:

if(compare(""+.@get,.itm_a$)) 

 

With:

if(compare(.itm_a$,""+.@get))
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...