Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Version 2.3 rAthena Only
- prontera.gat,149,180,5 script Freebie NPC 753,{
- //Configurable Char Variables
- set @npc$, "[^0000FF"+strnpcinfo(1)+"^000000]";
- setarray @cmds$, "getitemname", "getcharid", "strcharinfo",
- "strnpcinfo" , "countitem", "blvl" ,
- "jlvl" , "var" ;
- //End
- //Character Vars
- set .@blvl, BaseLevel;
- set .@getitm$, ".itm"+#itmget+"$";
- set .@getitm_len, getarraysize(getd(.@getitm$));
- set .@rblvl, atoi(getd(.@getitm$+"[2]"));
- set .@itmid, atoi(getd(.@getitm$));
- set .@itmam, atoi(getd(.@getitm$+"[1]"));
- set @nxtrblvl, atoi(getd(".itm"+(#itmget+1)+"$[2]"));
- //End
- //NPC Dialogue
- if(.@blvl>=.@rblvl) {
- for(set .@s,0;.@s<(.@getitm_len-3);set .@s,.@s+1){
- if(!(set(.@l,.@l+1)%(.@getitm_len-3))) sleep2 1;
- set .@op$, callfunc("dispmes_func",getd(.@getitm$+"["+(.@s+3)+"]"));
- if(compare(.@op$,"next;")) { set .@op$, ""; next; }
- if(compare(.@op$,"menu;")) { if(select("Yes:No")&2) close; set .@op$, ""; }
- if(compare(.@op$,"close;")) { set .@op$, ""; close; }
- if(compare(.@op$,"item;")) {
- if(compare(.@op$,"item;(")) {
- set .@s$, callfunc("find_value",.@op$);
- explode(.@op$, .@s$, ",");
- set .@op_len, getarraysize(.@op$);
- while(.@t<.@op_len) {
- if(!(set(.@l,.@l+1)%.@op_len)) sleep2 1;
- getitem(atoi(.@op$[.@t]),atoi(.@op$[.@t+1]));
- set .@t,.@t+2;
- } set #itmget,#itmget+1; set .@op$, "";
- } else {
- set .@op$, ""; getitem .@itmid,.@itmam; set #itmget,#itmget+1;
- sleep2 1;
- }
- }
- if(compare(.@op$,"npc;")) { set .@op$, @npc$; }
- if(.@op$!="") mes .@op$;
- }
- }
- mes @npc$;
- mes (.@blvl<=.@rblvl )?
- "You have already received this item, please come back when you are level "+.@rblvl+" for a special item."
- :
- ((.@rblvl<.@blvl )?
- "Sorry, I don't have anymore items to give you!"
- :
- "");
- close;
- //End
- end;
- OnInit:
- waitingroom "Free items!",0;
- //Configure NPC Items & Dialogue HERE!
- // ItemID, Amount, Required-BaseLevel,
- setarray .itm0$, "501" , "10" , "1" ,
- "Npc;",
- "Hello, strcharinfo(0), do you want this free item?",
- "next;", "menu;",
- "Alright!", "item;",
- "Goodbye.", "close;";
- setarray .itm1$, "502", "20", "70",
- "Npc;",
- "Wow, strcharinfo, you're blvl() that's really strong!",
- "I won't keep you waiting.", "Here is your items!",
- "Item;",
- "You can get your next item at var(@nxtrblvl).",
- "Until we meet again.", "close;";
- setarray .itm2$, "1599", "1", "120",
- "Npc;",
- "You, sir, are a true god!",
- "Hh-h-here is your getitemname(1599).",
- "item;", "close;";
- //End
- /*Explanation:
- The first three values in each row are the only constant numbers.
- First is the item_id then the amount you want to give then the level you give it at.
- Every line after that is lucid. You can type what the npc is going to say.
- You can also use optional commands that I will list below to display information.
- Add new conditions by following my example just remember to change .itm<#>$ to the next value.
- I hope everyone can understand this x.x Keep in mind this is just the first version.
- It's still a little slow. You can change upper-case to ignore for speedup.
- Commands Explained:
- Commands that takeup one line:
- "Npc;", -> This will display the npcs name.
- "Item;", -> Will give the player item and increase quest value.
- (Optional) "Item;(501,1,502,2,503,3)", -> Will give the player multiple items and increase quest value.
- "Menu;", -> This will display a Yes and No menu.
- "Close;", -> This will close the script.
- "Next;", -> This will refresh chat window and display Next button.
- Commands that can be used in chat:
- getitemname(<itemid>) -> Shows item name in chat.
- getcharid(<type>) -> Will return character id number.
- strcharinfo(<type>) -> displays information from charinfo. EX: strcharinfo(0) = Characters Name
- countitem(<itemid>) -> displays the count of the itemid.
- blvl() -> Displays baselevel.
- jlvl() -> Displays joblevel.
- Skorm
- */
- }
- function script dispmes_func {
- set .@message$, getarg(0);
- explode(@explosion$, .@message$, " ");
- set .@len, getarraysize(@explosion$);
- for(set .@a,0;.@a<.@len;set .@a,.@a+1) {
- for(set .@b,0;.@b<getarraysize(@cmds$);set .@b,.@b+1){
- if (compare(@explosion$[.@a],@cmds$[.@b])){
- set .@s$, callfunc("find_value",@explosion$[.@a]);
- set .@output$, callfunc("commands_func",.@b,.@s$);
- set .@message$, replacestr(.@message$, @cmds$[.@b]+"("+.@s$+")", .@output$);
- }
- }
- }
- return .@message$;
- }
- function script commands_func {
- switch(getarg(0)){
- case 0:
- return getitemname(atoi(getarg(1)));
- case 1:
- return getcharid(atoi(getarg(1)));
- case 2:
- return strcharinfo(atoi(getarg(1)));
- case 3:
- return strnpcinfo(atoi(getarg(1)));
- case 4:
- return countitem(atoi(getarg(1)));
- case 5:
- return BaseLevel;
- case 6:
- return JobLevel;
- case 7:
- return getd(getarg(1));
- }
- }
- function script find_value {
- set .@l, strpos(getarg(0), "(", 0);
- set .@r, strpos(getarg(0), ")", 0);
- return substr(getarg(0), (.@l+1), (.@r-1));
- }
Add Comment
Please, Sign In to add comment