Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Version 2.4 rAthena Only
- prontera.gat,149,180,5 script Freebie NPC 753,{
- //Configurable Char Variables
- @npc$ = "[^0000FF"+strnpcinfo(1)+"^000000]";
- setarray @cmds$, "getitemname", "getcharid", "strcharinfo",
- "strnpcinfo" , "countitem", "blvl" ,
- "jlvl" , "var" ;
- //End
- //Character Vars
- .@blvl = BaseLevel;
- .@getitm$ = ".itm"+#itmget+"$";
- .@getitm_len = getarraysize(getd(.@getitm$));
- .@rblvl = atoi(getd(.@getitm$+"[2]"));
- .@itmid = atoi(getd(.@getitm$));
- .@itmam = atoi(getd(.@getitm$+"[1]"));
- @nxtrblvl = atoi(getd(".itm"+(#itmget+1)+"$[2]"));
- freeloop(1);
- //End
- //NPC Dialogue
- if(.@blvl>=.@rblvl) {
- for(.@s=0;.@s<(.@getitm_len-3);.@s++){
- .@op$=callfunc("dispmes_func",getd(.@getitm$+"["+(.@s+3)+"]"));
- if(compare(.@op$,"next;")) { .@op$=""; next; }
- if(compare(.@op$,"menu;")) { if(select("Yes:No")&2) close; .@op$=""; }
- if(compare(.@op$,"close;")) { .@op$=""; close; }
- if(compare(.@op$,"item;")) {
- if(compare(.@op$,"item;(")) {
- .@s$=callfunc("find_value",.@op$);
- explode(.@op$, .@s$, ",");
- .@op_len=getarraysize(.@op$);
- while(.@t<.@op_len) {
- getitem(atoi(.@op$[.@t]),atoi(.@op$[.@t+1]));
- .@t=.@t+2;
- } #itmget++; .@op$="";
- } else {
- .@op$=""; getitem .@itmid,.@itmam; #itmget++;
- }
- }
- if(compare(.@op$,"npc;")) { .@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(0), you're blvl() that's really strong!",
- "next;", "Npc;",
- "I won't keep you waiting.", "Here is your items!",
- "Item;(501,1,502,2,503,3)", "next;", "Npc;",
- "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 {
- .@message$ = getarg(0);
- explode(@explosion$, .@message$, " ");
- .@len = getarraysize(@explosion$);
- for(.@a=0;.@a<.@len;.@a++) {
- for(.@b=0;.@b<getarraysize(@cmds$);.@b++){
- if (compare(@explosion$[.@a],@cmds$[.@b])){
- .@s$ = callfunc("find_value",@explosion$[.@a]);
- .@output$ = callfunc("commands_func",.@b,.@s$);
- .@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 {
- .@l = strpos(getarg(0), "(", 0);
- .@r = strpos(getarg(0), ")", 0);
- return substr(getarg(0), (.@l+1), (.@r-1));
- }
Add Comment
Please, Sign In to add comment