Jump to content

max65

Members
  • Posts

    120
  • Joined

  • Last visited

Everything posted by max65

  1. Hi rathena, how i can change that ??? When my player whant change resolution 1920 x 1080 or other, my client closes and opens a link .... thx for your repply
  2. Hi rathena, i need your help for resolve my problem's Event Trader: //===== rAthena Script ======================================= //= Euphy's Event Shop //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.6c //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= A dynamic Event Shop based on Lunar's, with easier config. //= Includes support for multiple shops & cashpoints. //= Item Preview script by ToastOfDoom. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.2 Added category support. //= 1.3 More options and fixes. //= 1.4 Added debug settings. //= 1.5 Replaced categories with shop IDs. //= 1.6 Added support for purchasing stackables. //= 1.6a Added support for previewing costumes and robes. //= 1.6b Added 'disable_items' command. //= 1.6c Replaced function 'A_An' with "F_InsertArticle". //============================================================ // Shop NPCs -- supplying no argument displays entire menu. // callfunc "qshop10"{,<shop ID>{,<shop ID>{,...}}}; // ADD YOUR NPC HERE //============================================================ prontera,165,150,2 script Event Trader#1 738,{ callfunc "qshop10"; } // prontera,165,203,6 script Quest Shop#2 998,{ callfunc "qshop",1,2; } // call the shop 1 and 2 defined below // etc.. Add your Shop NPCs 'Event Shop#XXX' here //============================================================ // Script Core - DO NOT DUPLICATE THIS NPC !!!!!!!!!!!!! //============================================================ - script Event Trader -1,{ function Add; function Chk; function Slot; OnInit: freeloop(1); // ----------------------------------------------------------- // Basic shop settings. // ----------------------------------------------------------- set .Announce,0; // Announce quest completion? (1: yes / 0: no) set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never) set .ShowID,0; // Show item IDs? (1: yes / 0: no) set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no) set .MaxStack,100; // Max number of quest items purchased at one time. // ----------------------------------------------------------- // Points variable -- optional quest requirement. // setarray .Points$[0],"<variable name>","<display name>"; // ----------------------------------------------------------- setarray .Points$[0], "#CASHPOINTS", "Cash Points"; //===================================================================================== // ------------------- ADD YOUR SHOPS NAME AND ITEMS SHOPS STARTING HERE -------------- //===================================================================================== // ----------------------------------------------------------- // Shop IDs -- to add shops, copy dummy data at bottom of file. // setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...}; // ----------------------------------------------------------- setarray .Shops$[1], "Upper Headgear", // Shop Named 1 "Middle Headgear", // Shop Named 2 "Lower Headgear", // Shop Named 3 // ----------------------------------------------------------- // Quest items -- do NOT use a reward item more than once! // Add(<shop ID>,<reward ID>,<reward amount>, // <Zeny cost>,<point cost>, // <required item ID>,<required item amount>{,...}); // ----------------------------------------------------------- // Shop 1 Add(1,5766,1,0,0,7539,50); Add(1,5531,1,0,0,7539,50); Add(1,5464,1,0,0,7539,50); Add(1,5416,1,0,0,7539,20); Add(1,18613,1,0,0,7539,100); Add(1,5762,1,0,0,7539,100); Add(1,5658,1,0,0,7539,100); Add(1,5372,1,0,0,7539,100); Add(1,5751,1,0,0,7539,100); Add(1,5457,1,0,0,7539,50); Add(1,5469,1,0,0,7539,100); Add(1,5099,1,0,0,7539,100); Add(1,5554,1,0,0,7539,20); Add(1,5501,1,0,0,7539,100); Add(1,5495,1,0,0,7539,100); Add(1,5690,1,0,0,7539,100); Add(1,5780,1,0,0,7539,100); Add(1,5208,1,0,0,7539,60); Add(1,5388,1,0,0,7539,20); // Shop 2 Add(2,5470,1,0,0,7539,70); Add(2,5664,1,0,0,7539,70); Add(2,5471,1,0,0,7539,70); Add(2,5610,1,0,0,7539,70); Add(2,5315,1,0,0,7539,70); Add(2,5358,1,0,0,7539,70); Add(2,5592,1,0,0,7539,70); // Shop 3 Add(3,5594,1,0,0,7539,20); Add(3,5775,1,0,0,7539,20); Add(3,5361,1,0,0,7539,50); Add(3,5362,1,0,0,7539,70); Add(3,5305,1,0,0,7539,70); Add(3,5767,1,0,0,7539,70); Add(3,5574,1,0,0,7539,70); // ----------------------------------------------------------- //===================================================================================== // ------------------- YOUR SHOPS AND ITEMS SHOPS HAVE BEEN ADDED --------------------- //===================================================================================== freeloop(0); set .menu$,""; for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) { set .menu$, .menu$+.Shops$[.@i]+":"; npcshopdelitem "qshop10"+.@i,909; } end; OnMenu: set .@size, getarraysize(@i); if (!.@size) set @shop_index, select(.menu$); else if (.@size == 1) set @shop_index, @i[0]; else { for(set .@j,0; .@j<.@size; set .@j,.@j+1) set .@menu$, .@menu$+.Shops$[@i[.@j]]+":"; set @shop_index, @i[select(.@menu$)-1]; } deletearray @i[0],getarraysize(@i); if (.Shops$[@shop_index] == "") { message strcharinfo(0),"An error has occurred."; end; } dispbottom "Select one item at a time."; callshop "qshop10"+@shop_index,1; npcshopattach "qshop10"+@shop_index; end; OnBuyItem: // .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... } setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]); copyarray .@q[3],getd(".q_"+@shop_index+"_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+@shop_index+"_"+.@q[0])); set .@q[2],.@q[1]*.@q[3]; if (!.@q[2] || .@q[2] > 30000) { message strcharinfo(0),"You can't purchase that many "+getitemname(.@q[0])+"."; end; } mes "[Event Shop]"; mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000"; mes "Requirements:"; disable_items; if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000"; if (.@q[5]) mes " > "+Chk(getd(.Points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+(.@q[5]*.@q[1])+")^000000"; if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2) mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000"; next; setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11); if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT))) set .@preview,1; addtimer 1000, strnpcinfo(0)+"::OnEnd"; while(1) { switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) { case 1: if (@qe[0]) { mes "[Event Shop]"; mes "You're missing one or more quest requirements."; close; } if (!checkweight(.@q[0],.@q[2])) { mes "[Event Shop]"; mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000"; close; } if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]); if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]); if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2) delitem .@q[.@i],.@q[.@i+1]*.@q[1]; getitem .@q[0],.@q[2]; if (.Announce) announce strcharinfo(0)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):callfunc("F_InsertArticle",getitemname(.@q[0])))+"!",0; specialeffect2 EF_FLOWERLEAF; close; case 2: setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1; if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2]; else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2]; else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2]; else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2]; break; case 3: close; } } OnEnd: if (@qe[7]) { changelook LOOK_HEAD_BOTTOM, @qe[3]; changelook LOOK_HEAD_TOP, @qe[4]; changelook LOOK_HEAD_MID, @qe[5]; changelook LOOK_ROBE, @qe[6]; } deletearray @qe[0],8; end; function Add { if (getitemname(getarg(1)) == "null") { debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; } setarray .@j[0],getarg(2),getarg(3),getarg(4); for(set .@i,5; .@i<getargcount(); set .@i,.@i+2) { if (getitemname(getarg(.@i)) == "null") { debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped)."; return; } else setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1); } copyarray getd(".q_"+getarg(0)+"_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j); npcshopadditem "qshop10"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0); return; } function Chk { if (getarg(0) < getarg(1)) { set @qe[0],1; return "^FF0000"; } else return "^00FF00"; } function Slot { set .@s$,getitemname(getarg(0)); switch(.ShowSlot) { case 1: if (!getitemslots(getarg(0))) return .@s$; case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]"; default: return .@s$; } } } function script qshop10 { deletearray @i[0],getarraysize(@i); for(set .@i,0; .@i<getargcount(); set .@i,.@i+1) set @i[.@i],getarg(.@i); doevent "Event Trader::OnMenu"; end; } // Dummy shop data -- copy as needed. //============================================================ - shop qshop101 -1,909:-1 - shop qshop102 -1,909:-1 - shop qshop103 -1,909:-1 Bifrost: //===== rAthena Script ======================================= //= Euphy's Event Shop //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.6c //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= A dynamic Event Shop based on Lunar's, with easier config. //= Includes support for multiple shops & cashpoints. //= Item Preview script by ToastOfDoom. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.2 Added category support. //= 1.3 More options and fixes. //= 1.4 Added debug settings. //= 1.5 Replaced categories with shop IDs. //= 1.6 Added support for purchasing stackables. //= 1.6a Added support for previewing costumes and robes. //= 1.6b Added 'disable_items' command. //= 1.6c Replaced function 'A_An' with "F_InsertArticle". //============================================================ // Shop NPCs -- supplying no argument displays entire menu. // callfunc "qshop11"{,<shop ID>{,<shop ID>{,...}}}; // ADD YOUR NPC HERE //============================================================ ecl_fild01,187,73,2 script Bifrost#1 630,{ callfunc "qshop11"; } // prontera,165,203,6 script Quest Shop#2 998,{ callfunc "qshop",1,2; } // call the shop 1 and 2 defined below // etc.. Add your Shop NPCs 'Event Shop#XXX' here //============================================================ // Script Core - DO NOT DUPLICATE THIS NPC !!!!!!!!!!!!! //============================================================ - script Bifrost -1,{ function Add; function Chk; function Slot; OnInit: freeloop(1); // ----------------------------------------------------------- // Basic shop settings. // ----------------------------------------------------------- set .Announce,0; // Announce quest completion? (1: yes / 0: no) set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never) set .ShowID,0; // Show item IDs? (1: yes / 0: no) set .ShowZeny,1; // Show Zeny cost, if any? (1: yes / 0: no) set .MaxStack,100; // Max number of quest items purchased at one time. // ----------------------------------------------------------- // Points variable -- optional quest requirement. // setarray .Points$[0],"<variable name>","<display name>"; // ----------------------------------------------------------- setarray .Points$[0], "#CASHPOINTS", "Cash Points"; //===================================================================================== // ------------------- ADD YOUR SHOPS NAME AND ITEMS SHOPS STARTING HERE -------------- //===================================================================================== // ----------------------------------------------------------- // Shop IDs -- to add shops, copy dummy data at bottom of file. // setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...}; // ----------------------------------------------------------- setarray .Shops$[1], "Quest Bifrost", // Shop Named 1 // ----------------------------------------------------------- // Quest items -- do NOT use a reward item more than once! // Add(<shop ID>,<reward ID>,<reward amount>, // <Zeny cost>,<point cost>, // <required item ID>,<required item amount>{,...}); // ----------------------------------------------------------- // Shop 1 Add(1,20462,1,1000000,0,6561,50,6560,30,6559,50,6394,60,6395,60); Add(1,20383,1,500000,0,6561,20,6560,20,6559,50,6394,60,6395,70); Add(1,20380,1,2000000,0,6561,300,6560,250,6559,100,6394,300,6395,300); Add(1,20460,1,600000,0,6561,80,6560,130,6559,150,6394,120,6395,60); Add(1,20381,1,500000,0,6561,50,6560,40,6559,70,6394,50,6395,20); // ----------------------------------------------------------- //===================================================================================== // ------------------- YOUR SHOPS AND ITEMS SHOPS HAVE BEEN ADDED --------------------- //===================================================================================== freeloop(0); set .menu$,""; for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) { set .menu$, .menu$+.Shops$[.@i]+":"; npcshopdelitem "qshop11"+.@i,909; } end; OnMenu: set .@size, getarraysize(@i); if (!.@size) set @shop_index, select(.menu$); else if (.@size == 1) set @shop_index, @i[0]; else { for(set .@j,0; .@j<.@size; set .@j,.@j+1) set .@menu$, .@menu$+.Shops$[@i[.@j]]+":"; set @shop_index, @i[select(.@menu$)-1]; } deletearray @i[0],getarraysize(@i); if (.Shops$[@shop_index] == "") { message strcharinfo(0),"An error has occurred."; end; } dispbottom "Select one item at a time."; callshop "qshop11"+@shop_index,1; npcshopattach "qshop11"+@shop_index; end; OnBuyItem: // .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... } setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]); copyarray .@q[3],getd(".q_"+@shop_index+"_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+@shop_index+"_"+.@q[0])); set .@q[2],.@q[1]*.@q[3]; if (!.@q[2] || .@q[2] > 30000) { message strcharinfo(0),"You can't purchase that many "+getitemname(.@q[0])+"."; end; } mes "[Bifrost Quest]"; mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000"; mes "Requirements:"; disable_items; if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000"; if (.@q[5]) mes " > "+Chk(getd(.Points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+(.@q[5]*.@q[1])+")^000000"; if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2) mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000"; next; setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11); if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT))) set .@preview,1; addtimer 1000, strnpcinfo(0)+"::OnEnd"; while(1) { switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) { case 1: if (@qe[0]) { mes "[Bifrost Quest]"; mes "You're missing one or more quest requirements."; close; } if (!checkweight(.@q[0],.@q[2])) { mes "[Bifrost Quest]"; mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000"; close; } if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]); if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]); if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2) delitem .@q[.@i],.@q[.@i+1]*.@q[1]; getitem .@q[0],.@q[2]; if (.Announce) announce strcharinfo(0)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):callfunc("F_InsertArticle",getitemname(.@q[0])))+"!",0; specialeffect2 EF_FLOWERLEAF; close; case 2: setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1; if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2]; else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2]; else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2]; else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2]; break; case 3: close; } } OnEnd: if (@qe[7]) { changelook LOOK_HEAD_BOTTOM, @qe[3]; changelook LOOK_HEAD_TOP, @qe[4]; changelook LOOK_HEAD_MID, @qe[5]; changelook LOOK_ROBE, @qe[6]; } deletearray @qe[0],8; end; function Add { if (getitemname(getarg(1)) == "null") { debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; } setarray .@j[0],getarg(2),getarg(3),getarg(4); for(set .@i,5; .@i<getargcount(); set .@i,.@i+2) { if (getitemname(getarg(.@i)) == "null") { debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped)."; return; } else setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1); } copyarray getd(".q_"+getarg(0)+"_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j); npcshopadditem "qshop11"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0); return; } function Chk { if (getarg(0) < getarg(1)) { set @qe[0],1; return "^FF0000"; } else return "^00FF00"; } function Slot { set .@s$,getitemname(getarg(0)); switch(.ShowSlot) { case 1: if (!getitemslots(getarg(0))) return .@s$; case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]"; default: return .@s$; } } } function script qshop11 { deletearray @i[0],getarraysize(@i); for(set .@i,0; .@i<getargcount(); set .@i,.@i+1) set @i[.@i],getarg(.@i); doevent "Bifrost::OnMenu"; end; } // Dummy shop data -- copy as needed. //============================================================ - shop qshop111 -1,909:-1 Lord: //===== rAthena Script ======================================= //= Euphy's Event Shop //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.6c //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= A dynamic Event Shop based on Lunar's, with easier config. //= Includes support for multiple shops & cashpoints. //= Item Preview script by ToastOfDoom. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.2 Added category support. //= 1.3 More options and fixes. //= 1.4 Added debug settings. //= 1.5 Replaced categories with shop IDs. //= 1.6 Added support for purchasing stackables. //= 1.6a Added support for previewing costumes and robes. //= 1.6b Added 'disable_items' command. //= 1.6c Replaced function 'A_An' with "F_InsertArticle". //============================================================ // Shop NPCs -- supplying no argument displays entire menu. // callfunc "qshop11"{,<shop ID>{,<shop ID>{,...}}}; // ADD YOUR NPC HERE //============================================================ lhz_dun04,242,63,4 script Lord#1 651,{ callfunc "qshop12"; } // prontera,165,203,6 script Quest Shop#2 998,{ callfunc "qshop",1,2; } // call the shop 1 and 2 defined below // etc.. Add your Shop NPCs 'Event Shop#XXX' here //============================================================ // Script Core - DO NOT DUPLICATE THIS NPC !!!!!!!!!!!!! //============================================================ - script Lord -1,{ function Add; function Chk; function Slot; OnInit: freeloop(1); // ----------------------------------------------------------- // Basic shop settings. // ----------------------------------------------------------- set .Announce,1; // Announce quest completion? (1: yes / 0: no) set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never) set .ShowID,0; // Show item IDs? (1: yes / 0: no) set .ShowZeny,1; // Show Zeny cost, if any? (1: yes / 0: no) set .MaxStack,100; // Max number of quest items purchased at one time. // ----------------------------------------------------------- // Points variable -- optional quest requirement. // setarray .Points$[0],"<variable name>","<display name>"; // ----------------------------------------------------------- setarray .Points$[0], "#CASHPOINTS", "Cash Points"; //===================================================================================== // ------------------- ADD YOUR SHOPS NAME AND ITEMS SHOPS STARTING HERE -------------- //===================================================================================== // ----------------------------------------------------------- // Shop IDs -- to add shops, copy dummy data at bottom of file. // setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...}; // ----------------------------------------------------------- setarray .Shops$[1], "Lord Hat", // Shop Named 1 // ----------------------------------------------------------- // Quest items -- do NOT use a reward item more than once! // Add(<shop ID>,<reward ID>,<reward amount>, // <Zeny cost>,<point cost>, // <required item ID>,<required item amount>{,...}); // ----------------------------------------------------------- // Shop 1 Add(1,20036,1,500000000,0,6470,500,6471,500,7347,500); Add(1,19574,1,50000000,0,6470,300,6471,300,7347,300); Add(1,31160,1,75000000,0,6470,500,6471,500,7347,500); // ----------------------------------------------------------- //===================================================================================== // ------------------- YOUR SHOPS AND ITEMS SHOPS HAVE BEEN ADDED --------------------- //===================================================================================== freeloop(0); set .menu$,""; for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) { set .menu$, .menu$+.Shops$[.@i]+":"; npcshopdelitem "qshop12"+.@i,909; } end; OnMenu: set .@size, getarraysize(@i); if (!.@size) set @shop_index, select(.menu$); else if (.@size == 1) set @shop_index, @i[0]; else { for(set .@j,0; .@j<.@size; set .@j,.@j+1) set .@menu$, .@menu$+.Shops$[@i[.@j]]+":"; set @shop_index, @i[select(.@menu$)-1]; } deletearray @i[0],getarraysize(@i); if (.Shops$[@shop_index] == "") { message strcharinfo(0),"An error has occurred."; end; } dispbottom "Select one item at a time."; callshop "qshop12"+@shop_index,1; npcshopattach "qshop12"+@shop_index; end; OnBuyItem: // .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... } setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]); copyarray .@q[3],getd(".q_"+@shop_index+"_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+@shop_index+"_"+.@q[0])); set .@q[2],.@q[1]*.@q[3]; if (!.@q[2] || .@q[2] > 30000) { message strcharinfo(0),"You can't purchase that many "+getitemname(.@q[0])+"."; end; } mes "[Lord]"; mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000"; mes "Requirements:"; disable_items; if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000"; if (.@q[5]) mes " > "+Chk(getd(.Points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+(.@q[5]*.@q[1])+")^000000"; if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2) mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000"; next; setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11); if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT))) set .@preview,1; addtimer 1000, strnpcinfo(0)+"::OnEnd"; while(1) { switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) { case 1: if (@qe[0]) { mes "[Lord]"; mes "You're missing one or more quest requirements."; close; } if (!checkweight(.@q[0],.@q[2])) { mes "[Lord]"; mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000"; close; } if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]); if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]); if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2) delitem .@q[.@i],.@q[.@i+1]*.@q[1]; getitem .@q[0],.@q[2]; if (.Announce) announce strcharinfo(0)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):callfunc("F_InsertArticle",getitemname(.@q[0])))+"!",0; specialeffect2 EF_FLOWERLEAF; close; case 2: setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1; if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2]; else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2]; else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2]; else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2]; break; case 3: close; } } OnEnd: if (@qe[7]) { changelook LOOK_HEAD_BOTTOM, @qe[3]; changelook LOOK_HEAD_TOP, @qe[4]; changelook LOOK_HEAD_MID, @qe[5]; changelook LOOK_ROBE, @qe[6]; } deletearray @qe[0],8; end; function Add { if (getitemname(getarg(1)) == "null") { debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; } setarray .@j[0],getarg(2),getarg(3),getarg(4); for(set .@i,5; .@i<getargcount(); set .@i,.@i+2) { if (getitemname(getarg(.@i)) == "null") { debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped)."; return; } else setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1); } copyarray getd(".q_"+getarg(0)+"_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j); npcshopadditem "qshop12"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0); return; } function Chk { if (getarg(0) < getarg(1)) { set @qe[0],1; return "^FF0000"; } else return "^00FF00"; } function Slot { set .@s$,getitemname(getarg(0)); switch(.ShowSlot) { case 1: if (!getitemslots(getarg(0))) return .@s$; case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]"; default: return .@s$; } } } function script qshop12 { deletearray @i[0],getarraysize(@i); for(set .@i,0; .@i<getargcount(); set .@i,.@i+1) set @i[.@i],getarg(.@i); doevent "Lord::OnMenu"; end; } // Dummy shop data -- copy as needed. //============================================================ - shop qshop121 -1,909:-1 and i have 4 other npc similar but he dont tell me any bug on my console i dont understand why =s can you help me plz ? Thx for your repply
  3. Hi rathena, can you tell me how disable auto message at prontera, izlude, morroc ect...for teleport dungeon provider ? Thx for your help and repply .
  4. Anacondaqq thx for your help ^^ have find other solution. just have delete my page transfert credit and other.... and have add npc on my capital for trade donation credit on cashpoint ^^.
  5. i understand but i dont know how manually replace that XD!
  6. Thx for your fast repply!! [2018-11-23 08:09:46] [SQLSTATE=42S02] Err 1146: Table 'rathena_prere_db.global_reg_value' doesn't exist do you have sql code for that plz? ^^
  7. Hello rathena, I open my server today but I have a problem, when a player donates, he earns the donation credit (it works), but to give credits on his character I have this error: can you help me for that plz? thx for your reply.
  8. Hi, have a problem's with this script =s can you help me plz . //= World Boss Event //===== By: ================================================== //= Musika6988, Sehrentos //===== Current Version: ===================================== //= 2.9.3 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Summon random World Boss and when defeated get treasure. //= Leader will have option to distribute or dispose loots. //= GM panel: info/start/stop/skip/lootMode/modify. //= Boss HP will increase or decrease by 1.500.000 per each //= player nearby and is updated every 10 seconds. //= When boss is defeated it will trigger increased exp and //= drop rates to whole server for 1 hour(IF enabled). //===== Additional Comments: ================================= //= 1.x Initial script by Musika6988. //= 2.0 Sehrentos added reward arrays. Randomly select a reward. //= 2.1 Sehrentos changed single random reward into random all rewards. //= 2.2 Sehrentos minor optimizations. //= 2.3 Sehrentos added more loot options. //= 2.4 Sehrentos added GM panel, Default mob attributes(.MOB_), //= Same party check(reward stealing) //= 2.5 Sehrentos added NPC WorldBossRadar to monitor players nearby, //= Removed Flee and Perfect Dodge from Treasure Chest, //= Added timeout to stop the event. Minor text changes. //= 2.6 Sehrentos added loot mode 1 give one reward to one random party member. //= Added loot modes 4-5 give all/one rewards to all nearby players and their party members. //= Added loot modes 6-7 give all/one rewards to all nearby players. //= 2.7 Sehrentos removed Treasure Chest monster. //= Added Treasure Chest NPCs. //= Added multiple events at once, but not in same map. //= Added loot modes 8-9 give all/one rewards to all players in same map. //= Added double server rates for 1 hour after boss is killed event. //= 2.8 Sehrentos added jump_zero optimizations. //= Fixed WorldBossRates::OnInit first run on the server. //= Added $@WB_ACCESS_EXPIRE timer. Clean the access array when it expires. //= 2.9 Sehrentos WorldBossRadar enable/disable option. //= Added loot modes 10 give all rewards to selected party member. //= Added loot modes 11 give one random reward to selected party member. //= 2.9.1 Sehrentos Fixes and additions. //= Added option to turn off mapflags. //= Added more default .MOB_ status points. //= Fix random reward will be selected only once, to avoid abuse ($@WB_REWARD_INDEX). //= Renamed some values. easier to understand. //= 2.9.2 Sehrentos Disabled FOG effect. //= Added more announcements when event fail to start. //= Added unit checks on OnMobDie event. //= Added inarray optimizations. //= 2.9.3 Sehrentos changed the way event starts and announces. //= Fixed WorldBossRates when .use_floating_rates is enabled(report @Quesooo). //= !TODO: Loot mode 12 give each reward to selected party member one by one. //============================================================ - script WorldBoss -1,{ OnInit: // Settings .npc_name$ = strnpcinfo(0); // Name of this NPC .event_sleep = 60000; // Event sleep time in milliseconds(60000 = 1 minute) .event_timeout = 7200000; // Event timeout time in milliseconds before Boss is disabled(60000 = 1 minute) .event_access_expire = 900000; // Event access expire time in milliseconds(60000 = 1 minute) // Reward distribution .loot_mode = 0; // Event loot distribution mode. Look npc_loot_mode_desc for descriptions .loop_max = 200; // Maximum number of loops (When selecting a random party member) .duplicate_npc_count = 9; // Number of duplicate Treasure Chest NPC's (Important! 0 counts as well) // Experience increases during event(In current event map) .base_exp_multiplier = 3500; // Event base exp rating multiplier(In current event map) .job_exp_multiplier = 3500; // Event job exp rating multiplier(In current event map) .use_floating_rates = 1; // Increase servers exp and drop rates for 1 hour after boss kill(0=Disable, 1=Enable) // Monsters default attributes .MOB_MAXHP = 100000000; // How much HP can monster have at maximum .MOB_HP = 5000000; // How much HP monster has on spawn .MOB_SPEED = 130; // Speed .MOB_CRIT = 450; // Crit rate (1000=100%) .MOB_HIT = 300; // Hit rate .MOB_ATKMIN = 1000; // Base Attack Minimum .MOB_ATKMAX = 4000; // Base Attack Maximum .MOB_MATKMIN = 1000; // Magic Attack Minimum .MOB_MATKMAX = 4000; // Magic Attack Maximum .MOB_DEF = 35; // Defence .MOB_MDEF = 35; // Magic Defence .MOB_FLEE = 200; // Flee rate .MOB_PDODGE = 60; // Perfect Dodge .MOB_STR = 150; // Stat strength .MOB_AGI = 150; // Stat agility .MOB_VIT = 150; // Stat vitality .MOB_INT = 150; // Stat intellect .MOB_DEX = 150; // Stat dexterity .MOB_LUK = 150; // Stat luck // Floating monster HP // When player is detected near the mob, update it's HP. .use_radar = 0; // 0=Disable, 1=Enable // Mapflags effects, monster status, party lock, etc. .use_mapflags = 0; // 0=Disable, 1=Enable // Event monster ID's setarray .event_mobs[0], 1093, // Eclipse 1096, // Angeling 1120, // Ghostring 1388, // Archangeling 1582, // Deviling 1795; // Bloody Knight // Event reward ID's (One random array is selected) setarray .loots_0[0], 501, 502, 503, 504, 505, 506; setarray .loots_1[0], 507, 508, 509, 510, 511, 512; setarray .loots_2[0], 513, 514, 515, 516, 517, 518; setarray .loots_3[0], 519, 520, 521, 522, 523, 525; // Event reward ID's array size (Important!) // If you add new .loots_<Number> arrays. You must change this accordingly. .loots_count = 3; // 0 count aswell // Event map names setarray .event_maps$[0], "prontera", "morocc", "geffen", "payon", "alberta", "aldebaran", "xmas", "comodo", "yuno", "amatsu", "gonryun", "umbala", "louyang", "ayothaya", "einbroch", "hugel", "rachel", "veins", "moscovia"; // Event loot distribution mode description setarray .loot_mode_desc$[0], "Give all rewards to all party members", // .loot_mode = 0 "Give one reward to one random party member", // .loot_mode = 1 "Give all rewards to one random party member", // .loot_mode = 2 "Give rewards randomly between all party members", // .loot_mode = 3 "Give all rewards to all nearby players and their party members", // .loot_mode = 4 (Skip UI) "Give one reward to all nearby players and their party members", // .loot_mode = 5 (Skip UI) "Give all rewards to all nearby players", // .loot_mode = 6 (Skip UI) "Give one reward to all nearby players", // .loot_mode = 7 (Skip UI) "Give all rewards to all players in the same map", // .loot_mode = 8 (Skip UI) "Give one reward to all players in the same map", // .loot_mode = 9 (Skip UI) "Give all rewards to selected party member", // .loot_mode = 10 "Give one random reward to selected party member"; // .loot_mode = 11 // TESTS // Log console information // This will report incorrect monster ID's on script load /*for( .@i = 0; .@i < getarraysize(.event_mobs); .@i++ ) { if( getmonsterinfo(.event_mobs[.@i], 0) == "null" ) { debugmes .npc_name$ + ":OnInit Monster ID:" + .event_mobs[.@i] + " DOES NOT EXIST!"; } }*/ // Start event on script load (For testing purposes) //donpcevent .npc_name$ + "::OnEnable"; end; OnEnable: OnClock0402: OnClock2359: // Check free event maps if ( getarraysize($@WB_MAP$) >= getarraysize(.event_maps$) ) { debugmes .npc_name$+"::OnEnable all event maps are active!"; //announce "[World Boss] Event has been cancelled! All event maps are active!", BC_ALL, 0xFF0000; end; } // Select random monster .@rand_mob = rand( getarraysize( .event_mobs ) ); .@monster_id = .event_mobs[ .@rand_mob ]; // Select random map .@i = 0; .@rand_map = rand( getarraysize( .event_maps$ ) ); // Random map index number while(inarray($@WB_MAP$[0], .event_maps$[.@rand_map]) != -1) { if(.@i > .loop_max) { debugmes .npc_name$+"::OnEnable event map max loop count!"; //announce "[World Boss] Event has been cancelled! Could not find free event map!", BC_ALL, 0xFF0000; end; } .@rand_map = rand( getarraysize( .event_maps$ ) ); .@i++; } .@map_name$ = .event_maps$[ .@rand_map ]; // Announce event will start soon announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in "+(.event_sleep / 60000)+" minute! Prepare your Hunting Party!",BC_ALL,0xFF0000,FW_BOLD,18; // Sleep until X time have passed and then continue script sleep .event_sleep; // Get last event index .@index = getarraysize($@WB_MOB_GID); // Set mapflags if enabled if ( .use_mapflags ) { // Save event maps original mapflags setarray $@WB_MF_PARTYLOCK[.@index], getmapflag(.@map_name$, MF_PARTYLOCK); setarray $@WB_MF_NOMOBLOOT[.@index], getmapflag(.@map_name$, MF_NOMOBLOOT); setarray $@WB_MF_NOMVPLOOT[.@index], getmapflag(.@map_name$, MF_NOMVPLOOT); setarray $@WB_MF_NOPENALTY[.@index], getmapflag(.@map_name$, MF_NOPENALTY); setarray $@WB_MF_NOMOBTELE[.@index], getmapflag(.@map_name$, MF_MONSTER_NOTELEPORT); setarray $@WB_MF_BASEEXP[.@index], getmapflag(.@map_name$, MF_BEXP); setarray $@WB_MF_JOBEXP[.@index], getmapflag(.@map_name$, MF_JEXP); //setarray $@WB_MF_FOG[.@index], getmapflag(.@map_name$, MF_FOG); // Set new mapflags setmapflag .@map_name$, MF_PARTYLOCK; // Disable changing party(Inviting new players in event map) setmapflag .@map_name$, MF_NOMOBLOOT; // Disable Normal monster loot drops setmapflag .@map_name$, MF_NOMVPLOOT; // Disable Boss monster loot drops setmapflag .@map_name$, MF_NOPENALTY; // Disable Exp and Zeny penalty setmapflag .@map_name$, MF_MONSTER_NOTELEPORT; // Disable monster teleport setmapflag .@map_name$, MF_BEXP, ($@WB_MF_BASEEXP[.@index] * .base_exp_multiplier); // Set Base Exp rating setmapflag .@map_name$, MF_JEXP, ($@WB_MF_JOBEXP[.@index] * .job_exp_multiplier); // Set Job Exp rating //setmapflag .@map_name$, MF_FOG; // Enable FOG effect } // Summon event monster unit monster .@map_name$, 0, 0, "World Boss", .@monster_id, 1, .npc_name$+"::OnMobDie", Size_Large, AI_NONE; .@gid = $@mobid[0]; // Get monster's Game ID // Change unit data to defaults setunitdata .@gid, UMOB_MAXHP, .MOB_MAXHP; setunitdata .@gid, UMOB_HP, .MOB_HP; setunitdata .@gid, UMOB_SPEED, .MOB_SPEED; setunitdata .@gid, UMOB_CRIT, .MOB_CRIT; setunitdata .@gid, UMOB_HIT, .MOB_HIT; setunitdata .@gid, UMOB_ATKMIN, .MOB_ATKMIN; setunitdata .@gid, UMOB_ATKMAX, .MOB_ATKMAX; setunitdata .@gid, UMOB_MATKMIN, .MOB_MATKMIN; setunitdata .@gid, UMOB_MATKMAX, .MOB_MATKMAX; setunitdata .@gid, UMOB_DEF, .MOB_DEF; setunitdata .@gid, UMOB_MDEF, .MOB_MDEF; setunitdata .@gid, UMOB_FLEE, .MOB_FLEE; setunitdata .@gid, UMOB_PDODGE, .MOB_PDODGE; setunitdata .@gid, UMOB_STR, .MOB_STR; setunitdata .@gid, UMOB_AGI, .MOB_AGI; setunitdata .@gid, UMOB_VIT, .MOB_VIT; setunitdata .@gid, UMOB_INT, .MOB_INT; setunitdata .@gid, UMOB_DEX, .MOB_DEX; setunitdata .@gid, UMOB_LUK, .MOB_LUK; // Get units updated data getunitdata(.@gid, .@unit); // Save event arrays setarray $@WB_MOB_ID[.@index], .@monster_id; setarray $@WB_MOB_GID[.@index], .@gid; setarray $@WB_TIMEOUT[.@index], gettimetick(0); setarray $@WB_RADAR_NEAR[.@index], 0; setarray $@WB_MAP$[.@index], .@map_name$; setarray $@WB_X[.@index], .@unit[UMOB_X]; setarray $@WB_Y[.@index], .@unit[UMOB_Y]; // Unit talk unittalk .@gid, "Tremble before me mortals!", BC_AREA; // Announce event started announce "[World Boss] A "+ getunitname(.@gid) +" has appeared in "+ .@map_name$ +" to wreck havoc!! Form a Hunting Party and stop it!!",BC_ALL,0xFF0000,FW_BOLD,18; // Start unit radar if ( .use_radar && getarraysize($@WB_MOB_GID) ) { donpcevent "WorldBossRadar::OnEnable"; } // Start timeout timer if ( !getnpctimer(1, "WorldBossTimeout") ) { donpcevent "WorldBossTimeout::OnEnable"; } end; // Disable event OnDisable: //debugmes .npc_name$+"::OnDisable stop event!"; // Stop timeout timer donpcevent "WorldBossTimeout::OnDisable"; // Stop unit radar if ( .use_radar ) { donpcevent "WorldBossRadar::OnDisable"; } // Reset server exp and drop rates if ( .use_floating_rates ) { donpcevent "WorldBossRates::OnDisable"; } // Loop all events for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { // Kill all units if ( unitexists($@WB_MOB_GID[.@i]) ) { unitkill($@WB_MOB_GID[.@i]); } // Reset all mapflags to original values if ( .use_mapflags ) { callfunc("WB_ResetMapflags", $@WB_MAP$[.@i], .@i); } } // Kill all script or gm summoned monsters //killmonster .event_map$, "All"; // Reset all event arrays callfunc("WB_ResetAllGlobals"); end; OnMobDie: // Event when monster has been killed // Stop unit radar and timeout if no unit is alive if ( !getarraysize($@WB_MOB_GID) ) { if ( .use_radar ) donpcevent "WorldBossRadar::OnDisable"; donpcevent "WorldBossTimeout::OnDisable"; } // Check attached unit .@unit_gid = getattachedrid(); if ( !.@unit_gid ) { // No unit attached. Propably killed by unitkill or other script command //donpcevent .npc_name$+"::OnDisable"; end; } // Get unit type .@unit_type = getunittype(.@unit_gid); if ( .@unit_type == -1 ) { debugmes .npc_name$+"::OnMobDie FATAL no unit type found!"; donpcevent .npc_name$+"::OnDisable"; end; } // Get map coordinates (Treasure Chest NPC will need these coordinates) getmapxy(.event_map$, .event_x, .event_y, .@unit_type); // Announce announce "[World Boss] The World Boss have been killed! Congratulations!", bc_all, 0xFF0000; // Increase server exp and drop rates for limited time if ( .use_floating_rates ) { donpcevent "WorldBossRates::OnEnable"; } // Get index if map name are the same .@event_index = inarray($@WB_MAP$[0], .event_map$); // Check if index was found and stop if not if ( .@event_index == -1 ) { debugmes .npc_name$+"::OnMobDie event index was not found!"; end; } // Reset mapflags to original values if ( .use_mapflags ) { callfunc("WB_ResetMapflags", $@WB_MAP$[.@event_index], .@event_index); } // If unit is not PC, try to attach unit master to the script if ( .@unit_type != UNITTYPE_PC ) { getunitdata(.@unit_gid, .@data); if (.@unit_type == UNITTYPE_NPC) { // NPC does not have master debugmes .npc_name$+"::OnMobDie NPC no player attached!"; end; } if (.@unit_type == UNITTYPE_PET) { if (!attachrid(.@data[UPET_MASTERAID])) { debugmes .npc_name$+"::OnMobDie PET no player attached!"; end; } } if (.@unit_type == UNITTYPE_MOB) { if (!attachrid(.@data[UMOB_MASTERAID])) { debugmes .npc_name$+"::OnMobDie MOB no player attached!"; end; } } if (.@unit_type == UNITTYPE_HOM) { .@name$ = strcharinfo(0,.@data[UHOM_MASTERCID]); if (!attachrid(getcharid(3,.@name$))) { debugmes .npc_name$+"::OnMobDie HOM no player attached!"; end; } } if (.@unit_type == UNITTYPE_MER) { .@name$ = strcharinfo(0,.@data[UMER_MASTERCID]); if (!attachrid(getcharid(3,.@name$))) { debugmes .npc_name$+"::OnMobDie MER no player attached!"; end; } } if (.@unit_type == UNITTYPE_ELEM) { .@name$ = strcharinfo(0,.@data[UELE_MASTERCID]); if (!attachrid(getcharid(3,.@name$))) { debugmes .npc_name$+"::OnMobDie ELE no player attached!"; end; } } } // Get party ID .@party_id = getcharid(1); // Save event arrays setarray $@WB_MAP$[.@event_index], .event_map$; setarray $@WB_X[.@event_index], .event_x; setarray $@WB_Y[.@event_index], .event_y; setarray $@WB_PARTY_ID[.@event_index], .@party_id; // Select random reward/loots array setarray $@WB_REWARD_INDEX[.@event_index], rand(0, .loots_count); // Enable first available Treasure Chest NPC // Set .event_map$, .event_x, .event_y before enabling ( Important! ) for ( .@i = 0; .@i <= .duplicate_npc_count; .@i++ ) { .@npc$ = "Treasure Chest#wb_"+ .@i; // Name of the NPC if ( getnpcid(0, .@npc$) ) { // If NPC exists if ( !getnpctimer( 1, .@npc$ ) ) { // If has active timer=1 setarray $@WB_NPC_NAME$[.@event_index], .@npc$; donpcevent .@npc$ +"::OnEnable"; break; } } else { debugmes .npc_name$+"::OnMobDie no Treasure Chest#wb_"+.@i+" NPC found!"; } } // Switch by loot mode and save character IDs for access switch( .loot_mode ) { case 0: case 1: case 2: case 3: // In same party or single player case 10: // All to selected party member case 11: // One random to selected party member // Attach all available party members if ( getcharid(1) ) { addrid(2, 0, getcharid(1)); } break; case 4: case 5: // In range and party // Attach all available players in 20 cells from the killer RID addrid(4, 0, (.event_x - 20),(.event_y - 20), (.event_x + 20),(.event_y + 20)); // Attach all available party members if ( getcharid(1) ) { addrid(2, 0, getcharid(1)); } break; case 6: case 7: // In range // Attach all available players in 20 cells from the killer RID addrid(4, 0, (.event_x - 20),(.event_y - 20), (.event_x + 20),(.event_y + 20)); break; case 8: case 9: // In the same map addrid(1, 0, getcharid(1)); break; } // Find matching character IDs from the access array .@access_index = inarray($@WB_ACCESS[0], getcharid(0)); // Exit if character already has access if ( .@access_index != -1 ) { end; } // Save character ID into access array setarray $@WB_ACCESS[getarraysize($@WB_ACCESS)], getcharid(0); setarray $@WB_ACCESS_EXPIRE[getarraysize($@WB_ACCESS_EXPIRE)], gettimetick(0); // Start access expire timer if not already running if ( !getnpctimer(1, "WorldBossAccessExpire") ) { donpcevent "WorldBossAccessExpire::OnEnable"; } end; // Event when player opens Treasure Chest NPC OnTreasureOpen: // Get map coordinates of the player getmapxy(.@event_map$, .@x, .@y, UNITTYPE_PC); // Search for character ID from the access array .@access_index = inarray($@WB_ACCESS[0], getcharid(0)); // User has no access! if ( .@access_index == -1 ) { message strcharinfo(0), "Treasure Chest is empty."; end; } // Get event index from the map name array .@event_index = inarray($@WB_MAP$[0], .@event_map$); // Check if event index was found if ( .@event_index == -1 ) { debugmes .@name$+"::OnTreasureOpen event map name ( "+ .@event_map$ +" ) not found!"; message strcharinfo(0), "Treasure Chest is empty."; end; } // Select reward array .@rand_reward = $@WB_REWARD_INDEX[.@event_index]; .@reward_size = getarraysize( getd(".loots_" + .@rand_reward) ); copyarray .@rewards[0], getd(".loots_" + .@rand_reward + "[0]"), .@reward_size; switch( .loot_mode ) { case 0: // All to all members case 2: // All to random member case 3: // Randomly to all members case 10: // All to selected party member case 11: // One random to selected party member if ( getcharid(1) ) { goto OnPartyLeader; } else { // Has no party for( .@i = 0; .@i < .@reward_size; .@i++ ) { getitem .@rewards[.@i], 1; } } break; case 1: // One to random member if ( getcharid(1) ) { // Party Leader will distribute loots goto OnPartyLeader; } else { // Has no party getitem .@rewards[rand(.@reward_size)], 1; } break; case 4: // All in range and party case 6: // All in range case 8: // All in same map default: // No UI for( .@i = 0; .@i < .@reward_size; .@i++ ) { getitem .@rewards[.@i], 1; } break; case 5: // One in range and party case 7: // One in range case 9: // One in same map // No UI getitem .@rewards[rand(.@reward_size)], 1; break; } // Remove character ID from the access array (Access is now used) deletearray $@WB_ACCESS[.@access_index], 1; deletearray $@WB_ACCESS_EXPIRE[.@access_index], 1; // Announce player message strcharinfo(0), "Congratulations! You have been rewarded for killing the World Boss."; // Disable current NPC Treasure Chest if ( !getarraysize($@WB_ACCESS) ) { // Disable current NPC Treasure Chest callfunc("WB_ResetBox", .@event_index); // Stop access expire timer donpcevent "WorldBossAccessExpire::OnDisable"; } end; OnPartyLeader: // Get party ID .@party_id = getcharid(1); // Check if player is party leader if ( getcharid(0) != getpartyleader( .@party_id, 2 ) ) { message strcharinfo(0), "You're not Party Leader."; end; } // Get event index from the party ID array .@event_index = inarray($@WB_PARTY_ID[0], .@party_id ); // Check if party id has access! if ( .@event_index == -1 ) { message strcharinfo(0), "Treasure Chest is empty."; end; } // Select random reward array .@rand_reward = $@WB_REWARD_INDEX[.@event_index]; .@reward_size = getarraysize(getd(".loots_" + .@rand_reward)); copyarray .@rewards[0], getd(".loots_" + .@rand_reward + "[0]"), .@reward_size; // Show loot distribution window mes "[ Loot Distributor ]"; mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards."; mes "^777777Loot mode : ^000000" + .loot_mode_desc$[.loot_mode]; // Loot mode description next; mes "[ Loot Distributor ]"; for( .@i = 0; .@i < .@reward_size; .@i++ ) { mes "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; } next; if( select( "Distribute Loots", "Dispose Loots" ) == 1 ) { // Get party data getpartymember .@party_id, 0; // Name getpartymember .@party_id, 1; // Character IDs getpartymember .@party_id, 2; // Account IDs // Copy the temporary party data .@party_size = $@partymembercount; copyarray .@party_cid[0], $@partymembercid[0], .@party_size; copyarray .@party_aid[0], $@partymemberaid[0], .@party_size; copyarray .@party_name$[0], $@partymembername$[0], .@party_size; // LOOT MODE 0: Give all rewards to all party members if( .loot_mode == 0 ) { mes "[ Loot Distributor ]"; // Loop through each party member for( .@idx = 0; .@idx < .@party_size; .@idx++ ) { // Online check if( isloggedin(.@party_aid[.@idx], .@party_cid[.@idx]) ) { mes " ~ " + strcharinfo(0, .@party_cid[.@idx]) + " was rewarded!"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { getitem .@rewards[.@i], 1, .@party_aid[.@idx]; } } } } // LOOT MODE 1: Give one reward to one random party member else if( .loot_mode == 1 ) { // Select random party member X times. SelectRandom1: .@attempts = 0; // Counter for random player select .@rand_party = rand(.@party_size); while( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { if( .@attempts >= .loop_max ) break; .@rand_party = rand(.@party_size); .@attempts++; } // Max attempts reached if( .@attempts >= .loop_max ) { mes "[ Player not found ]"; mes "Tried to select random player " + .@attempts + " times!"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom1; } else { goto OnClose; } } // Backup online check (next; will pause script and players can disconnect) if( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { mes "[ Player not online ]"; mes "Member is ^777777offline^000000"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom1; } else { goto OnClose; } } // Give random reward .@rand_item = rand(.@reward_size); .@name$ = strcharinfo(0, .@party_cid[.@rand_party]); mes "[ Loot Distributor ]"; mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@rand_item] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@rand_item] ) + " ( Distributed Randomly )"; getitem .@rewards[.@rand_item], 1, .@party_aid[.@rand_party]; } // LOOT MODE 2: Give all rewards to one random party member else if( .loot_mode == 2 ) { // Select random party member X times. SelectRandom2: .@attempts = 0; // Counter for random player select .@rand_party = rand(.@party_size); while( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { if( .@attempts >= .loop_max ) break; .@rand_party = rand(.@party_size); .@attempts++; } // Max attempts reached if( .@attempts >= .loop_max ) { mes "[ Player not found ]"; mes "Tried to select random player " + .@attempts + " times!"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom2; } else { goto OnClose; } } // Backup online check (next; will pause script and players can disconnect) if( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { mes "[ Player not online ]"; mes "Member is ^777777offline^000000"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom2; } else { goto OnClose; } } // Give rewards .@name$ = strcharinfo(0, .@party_cid[.@rand_party]); mes "[ Loot Distributor ]"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@i] ) + " ( Distributed Randomly )"; getitem .@rewards[.@i], 1, .@party_aid[.@rand_party]; } } // LOOT MODE 3: Give rewards randomly between all party members else if( .loot_mode == 3 ) { mes "[ Loot Distributor ]"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { // Select random party member X times. SelectRandom3: .@attempts = 0; // Counter for random player select .@rand_party = rand(.@party_size); while( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { if( .@attempts >= .loop_max ) break; .@rand_party = rand(.@party_size); .@attempts++; } // Max attempts reached if( .@attempts >= .loop_max ) { mes "[ Player not found ]"; mes "Tried to select random player " + .@attempts + " times!"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom3; } else { goto OnClose; } } // Backup online check (next; will pause script and players can disconnect) if( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { mes "[ Player not online ]"; mes "Member is ^777777offline^000000"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom3; } else { goto OnClose; } } // Give single reward .@name$ = strcharinfo(0, .@party_cid[.@rand_party]); mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@i] ) + " ( Distributed Randomly )"; getitem .@rewards[.@i], 1, .@party_aid[.@rand_party]; } } // LOOT MODE 10: Give all rewards to selected party member // LOOT MODE 11: Give one reward to selected party member else if( .loot_mode >= 10 && .loot_mode <= 11 ) { SelectMember: // Open Party Select Menu .@select = callfunc("WB_PartySelect", 1, 1); // Refresh selected while ( .@select == -1 ) { message strcharinfo(0), "Refresh menu!"; .@select = callfunc("WB_PartySelect", 1, 1); } // Not in a party (Leaved before select or removed) if ( .@select == -2 ) { message strcharinfo(0), "You don't have a party."; end; } // Is selected member online if ( !isloggedin(.@party_aid[.@select], .@party_cid[.@select]) ) { mes "[ Loot Distributor ]"; mes "Selected party member is not online."; mes "Please select again."; next; goto SelectMember; } // Get more party data .@party_name$ = getpartyname(.@party_id); // Party Name .@party_leader_cid = getpartyleader(.@party_id, 2); // Party Leader Character ID // Party Leader Name .@party_leader_name$ = "[Offline]"; if ( .@party_leader_cid != -1 ) { // strcharinfo(0,.@party_leader_cid); will fail if leader is offline! for (.@i = 0; .@i < .@party_size; .@i++ ) { // Match leader cid with party member cid if ( .@party_leader_cid == .@party_member_cid[.@i] ) { .@party_leader_name$ = .@party_member_name$[.@i]; } } } // Double check // Check for party changes, because players can leave anytime. .@party_id2 = getcharid(1); .@check_failed = false; // Not in a party anymore (Leaved after select or removed) if ( !.@party_id2 ) { message strcharinfo(0), "You don't have a party."; mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Check if party ID has changed if (.@party_id != .@party_id2) { message strcharinfo(0), "Failed: Party ID has changed!"; mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Get new party data getpartymember .@party_id2, 0; // names .@new_party_size = $@partymembercount; copyarray .@partymembername$[0], $@partymembername$[0], .@new_party_size; // Check if party size has changed during select. if (.@new_party_size != .@party_size) { message strcharinfo(0), "Failed: Party size has changed!"; mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Check if party member names has changed during select. for (.@i = 0; .@i < .@party_size; .@i++ ) { // Match new and old name if ( .@partymembername$[.@i] != .@party_member_name$[.@i] ) { .@check_failed = true; message strcharinfo(0), "Failed: Party member name has changed!"; break; } } // Has any checks failed if ( .@i >= .@party_size && .@check_failed ) { mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Success; Give rewards if (.loot_mode == 10) { // All rewards to selected member .@name$ = strcharinfo(0, .@party_cid[.@select]); mes "[ Loot Distributor ]"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@i] ) + " ( Distributed Randomly )"; getitem .@rewards[.@i], 1, .@party_aid[.@select]; } } else if (.loot_mode == 11) { // Give one random reward to selected member .@rand_item = rand(.@reward_size); .@name$ = strcharinfo(0, .@party_cid[.@select]); mes "[ Loot Distributor ]"; mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@rand_item] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@rand_item] ) + " ( Distributed Randomly )"; getitem .@rewards[.@rand_item], 1, .@party_aid[.@select]; } } } else { // Disposed loots mes "[ Loot Distributor ]"; } mes "Congratulations!"; // Remove all party members access callfunc("WB_ResetPartyAccess", .@party_id); close2; // Disable current NPC Treasure Chest callfunc("WB_ResetBox", .@event_index); end; OnClose: // Close reward window mes "[ Loot Distributor ]"; mes "Good bye."; close; } // Function: Reset all party members access IDs // callfunc("WB_ResetPartyAccess", <party id>) function script WB_ResetPartyAccess { .@party_id = getarg(0); getpartymember .@party_id, 1; // Character IDs .@party_size = $@partymembercount; copyarray .@party_cid[0], $@partymembercid[0], .@party_size; for ( .@i = 0; .@i < .@party_size; .@i++ ) { for ( .@j = 0; .@j < getarraysize($@WB_ACCESS); .@j++ ) { if ( $@WB_ACCESS[.@j] == .@party_cid[.@i] ) { deletearray $@WB_ACCESS[.@j], 1; deletearray $@WB_ACCESS_EXPIRE[.@j], 1; } } } // Remove party id /*for ( .@i = 0; .@i < getarraysize($@WB_PARTY_ID); .@i++ ) { if ( $@WB_PARTY_ID[.@i] == .@party_id ) { deletearray $@WB_PARTY_ID[.@i], 1; } }*/ return; } // Function: Reset specific WorldBoss event global arrays // callfunc("WB_ResetEventGlobals", <index>) function script WB_ResetEventGlobals { .@index = getarg(0, 0); // Event index Default=0 deletearray $@WB_MOB_ID[.@index], 1; // Rename from $@WB_ID deletearray $@WB_MOB_GID[.@index], 1; // Rename from $@WB_GID deletearray $@WB_TIMEOUT[.@index], 1; deletearray $@WB_RADAR_NEAR[.@index], 1; // Rename from $@WB_NEAR deletearray $@WB_MAP$[.@index], 1; deletearray $@WB_X[.@index], 1; deletearray $@WB_Y[.@index], 1; deletearray $@WB_REWARD_INDEX[.@index], 1; // Rename from $@WB_REWARD deletearray $@WB_PARTY_ID[.@index], 1; // Rename from $@WB_PARTY deletearray $@WB_NPC_NAME$[.@index], 1; // Rename from $@WB_BOX //deletearray $@WB_ACCESS[.@index], 1; //deletearray $@WB_ACCESS_EXPIRE[.@index], 1; deletearray $@WB_MF_PARTYLOCK[.@index], 1; deletearray $@WB_MF_NOMOBLOOT[.@index], 1; deletearray $@WB_MF_NOMVPLOOT[.@index], 1; deletearray $@WB_MF_NOPENALTY[.@index], 1; deletearray $@WB_MF_NOMOBTELE[.@index], 1; deletearray $@WB_MF_BASEEXP[.@index], 1; deletearray $@WB_MF_JOBEXP[.@index], 1; //deletearray $@WB_MF_FOG[.@index], 1; return; } // Function: Reset all WorldBoss event global arrays // callfunc("WB_ResetAllGlobals") function script WB_ResetAllGlobals { deletearray $@WB_MOB_ID[0], getarraysize($@WB_MOB_ID); deletearray $@WB_MOB_GID[0], getarraysize($@WB_MOB_GID); deletearray $@WB_TIMEOUT[0], getarraysize($@WB_TIMEOUT); deletearray $@WB_RADAR_NEAR[0], getarraysize($@WB_RADAR_NEAR); deletearray $@WB_MAP$[0], getarraysize($@WB_MAP$); deletearray $@WB_X[0], getarraysize($@WB_X); deletearray $@WB_Y[0], getarraysize($@WB_Y); deletearray $@WB_REWARD_INDEX[0], getarraysize($@WB_REWARD_INDEX); deletearray $@WB_PARTY_ID[0], getarraysize($@WB_PARTY_ID); deletearray $@WB_NPC_NAME$[0], getarraysize($@WB_NPC_NAME$); deletearray $@WB_ACCESS[0], getarraysize($@WB_ACCESS); deletearray $@WB_ACCESS_EXPIRE[0], getarraysize($@WB_ACCESS_EXPIRE); deletearray $@WB_MF_PARTYLOCK[0], getarraysize($@WB_MF_PARTYLOCK); deletearray $@WB_MF_NOMOBLOOT[0], getarraysize($@WB_MF_NOMOBLOOT); deletearray $@WB_MF_NOMVPLOOT[0], getarraysize($@WB_MF_NOMVPLOOT); deletearray $@WB_MF_NOPENALTY[0], getarraysize($@WB_MF_NOPENALTY); deletearray $@WB_MF_NOMOBTELE[0], getarraysize($@WB_MF_NOMOBTELE); deletearray $@WB_MF_BASEEXP[0], getarraysize($@WB_MF_BASEEXP); deletearray $@WB_MF_JOBEXP[0], getarraysize($@WB_MF_JOBEXP); //deletearray $@WB_MF_FOG[0], getarraysize($@WB_MF_FOG); return; } // Function: Reset all mapflags to original values // callfunc("WB_ResetMapflags", <map name>, <index>) function script WB_ResetMapflags { .@map$ = getarg(0, "null"); // Map name Default="null" .@index = getarg(1, 0); // Event index Default=0 // Map name exists if (.@map$ == "" || .@map$ == "null") { debugmes "WB_ResetMapflags was given:"+ .@map$; return; } // Party Lock if ( $@WB_MF_PARTYLOCK[.@index] ) setmapflag .@map$, MF_PARTYLOCK; else removemapflag .@map$, MF_PARTYLOCK; // No mob loot if ( $@WB_MF_NOMOBLOOT[.@index] ) setmapflag .@map$, MF_NOMOBLOOT; else removemapflag .@map$, MF_NOMOBLOOT; // No MVP loot if ( $@WB_MF_NOMVPLOOT[.@index] ) setmapflag .@map$, MF_NOMVPLOOT; else removemapflag .@map$, MF_NOMVPLOOT; // No penalty if ( $@WB_MF_NOPENALTY[.@index] ) setmapflag .@map$, MF_NOPENALTY; else removemapflag .@map$, MF_NOPENALTY; // No mob teleport if ( $@WB_MF_NOMOBTELE[.@index] ) setmapflag .@map$, MF_MONSTER_NOTELEPORT; else removemapflag .@map$, MF_MONSTER_NOTELEPORT; // Base Exp setmapflag .@map$, MF_BEXP, $@WB_MF_BASEEXP[.@index]; // Job Exp setmapflag .@map$, MF_JEXP, $@WB_MF_JOBEXP[.@index]; // Effect FOG //if ( $@WB_MF_FOG[.@index] ) // setmapflag .@map$, MF_FOG; //else // removemapflag .@map$, MF_FOG; return; } // Function: Reset specific Treasure Chest NPC // callfunc("WB_ResetBox", <index>) function script WB_ResetBox { .@index = getarg(0, 0); // Event index Default=0 if ( $@WB_NPC_NAME$[.@index] != "" ) { if ( getnpcid(0, $@WB_NPC_NAME$[.@index]) ) { // Do these checks or this will select all NPCs on the server when fail donpcevent $@WB_NPC_NAME$[.@index]+"::OnDisable"; } } } // Function: Reset all Treasure Chest NPC's // callfunc("WB_ResetAllBoxes") function script WB_ResetAllBoxes { for ( .@i = 0; .@i < getarraysize($@WB_NPC_NAME$); .@i++ ) { if ( $@WB_NPC_NAME$[.@i] != "" ) { if ( getnpcid(0, $@WB_NPC_NAME$[.@i]) ) { // Do these checks or this will select all NPCs on the server when fail donpcevent $@WB_NPC_NAME$[.@i]+"::OnDisable"; } } } } // Function Party Select // callfunc("WB_PartySelect", <INT_show_offline>, <INT_show_refresh>) // Return INT=Party index number, -1=Refresh selected, -2=Not in party function script WB_PartySelect { .@s_offline = getarg(0, 1); // Show offline players in menu? 1=Yes 0=No .@s_refresh = getarg(1, 1); // Show refresh menu item? 1=Yes 0=No .@party_id = getcharid(1); // Party ID // Not in a party if ( !.@party_id ) return -2; getpartymember .@party_id, 0; // Names getpartymember .@party_id, 1; // Character IDs getpartymember .@party_id, 2; // Account IDs // Copy the temporary party data .@party_size = $@partymembercount; copyarray .@party_member_name$[0], $@partymembername$[0], .@party_size; copyarray .@party_member_cid[0], $@partymembercid[0], .@party_size; copyarray .@party_member_aid[0], $@partymemberaid[0], .@party_size; // Create menu if ( .@s_refresh ) .@menu_party$ = "^777777[Refresh]^000000"; .@menu_party$ = .@menu_party$ + ":"; // Loop through each party member and add to menu for ( .@i = 0; .@i < .@party_size; .@i++ ) { if ( isloggedin(.@party_member_aid[.@i], .@party_member_cid[.@i]) ) { if (.@s_offline) .@menu_party$ = .@menu_party$ + .@party_member_name$[.@i] + " ^00cc36[ON]^000000"; else .@menu_party$ = .@menu_party$ + .@party_member_name$[.@i]; } else if (.@s_offline) .@menu_party$ = .@menu_party$ + .@party_member_name$[.@i] + " ^777777[OFF]^000000"; .@menu_party$ = .@menu_party$ + ":"; } // Open select menu (-2 select start from 1 and we have [Refresh] at first) .@select = select(.@menu_party$) - 2; return .@select; } // Treasure chest NPC alberta,0,0,5 script Treasure Chest#wb_0 1324,{ emotion ET_SURPRISE, getcharid(3); // Emotion on the player // Disable current NPC Treasure Chest if empty if ( !getarraysize($@WB_ACCESS) ) { message strcharinfo(0), "Treasure Chest is empty."; donpcevent strnpcinfo(0)+"::OnDisable"; // Stop access expire timer donpcevent "WorldBossAccessExpire::OnDisable"; end; } doevent "WorldBoss::OnTreasureOpen"; end; OnInit: .@name$ = strnpcinfo(0); //rid2name( .@id ); .@timer = getnpctimer(1, .@name$); getmapxy(.map$, .x, .y, UNITTYPE_NPC); disablenpc .@name$; //debugmes .@name$+"::OnInit target=" + .map$ + " NPC="+ .@name$ + " timer="+ .@timer; end; OnEnable: // if enabled getnpctimer(1, strnpcinfo(0)) will return 1 .@id = getnpcid(0); .@name$ = strnpcinfo(0); //rid2name( .@id ); .@timer = getnpctimer(1, .@name$); .@npc$ = "WorldBoss"; .@map$ = getvariableofnpc(.event_map$, .@npc$); .@x = getvariableofnpc(.event_x, .@npc$); .@y = getvariableofnpc(.event_y, .@npc$); enablenpc( .@name$ ); unitwarp( .@id, .@map$, .@x, .@y ); // Move to new position initnpctimer( .@name$ ); // Start timeout timer //debugmes .@name$+"::OnEnable target="+ .@map$ +", "+ .@x +", "+ .@y +" NPC="+ .@name$ +" timer="+ .@timer; end; // Disable Treasure NPC and clean event array OnDisable: .@id = getnpcid(0); .@name$ = strnpcinfo(0); //rid2name( .@id ); .@timer = getnpctimer(1, .@name$); getmapxy(.@event_map$, .@x, .@y, UNITTYPE_NPC); stopnpctimer( .@name$ ); // Stop timeout timer unitwarp( .@id, .map$, .x, .y ); // Return to default position disablenpc( .@name$ ); // Clean event data // Get event index from the map name array .@index = inarray($@WB_MAP$[0], .@event_map$); // Check if index was found if ( .@index == -1 ) { debugmes .@name$+"::OnDisable event map name ( "+ .@event_map$ +" ) not found!"; end; } // Remove current event from the arrays callfunc("WB_ResetEventGlobals", .@index); //debugmes .@name$+"::OnDisable target="+ .@event_map$ +", "+ .@x +", "+ .@y +" NPC="+ .@name$ +" timer="+ .@timer; end; //OnTimer30000: // 30 seconds //OnTimer120000: // 2 minutes //OnTimer300000: // 5 minutes OnTimer600000: // 10 minutes //OnTimer900000: // 15 minutes .@name$ = strnpcinfo(0); getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC); //debugmes .@name$+"::OnTimeout target="+ .@map$ +", "+ .@x +", "+ .@y +" NPC="+ .@name$; donpcevent .@name$+"::OnDisable"; end; } // Treasure Chest duplicates (Add more if you run out) // NPC Name = Treasure Chest#wb_<indexNumber> (Important!) alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_1 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_2 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_3 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_4 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_5 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_6 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_7 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_8 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_9 1324 // World Boss timeout timer - script WorldBossTimeout -1,{ end; OnEnable: initnpctimer; end; OnDisable: stopnpctimer; end; // Update every 1 minutes OnTimer60000: .@time = gettimetick(0); .@timeout = getvariableofnpc(.event_timeout, "WorldBoss"); .@mapflags = getvariableofnpc(.use_mapflags, "WorldBoss"); for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { // Unit must be alive if ( unitexists($@WB_MOB_GID[.@i]) && .@time > ($@WB_TIMEOUT[.@i] + .@timeout) ) { announce "[World Boss] World Boss in "+ $@WB_MAP$[.@i] +" has expired!", bc_all, 0xFF0000; unitkill( $@WB_MOB_GID[.@i] ); // Reset event mapflags if ( .@mapflags ) { callfunc("WB_ResetMapflags", $@WB_MAP$[.@i], .@i); } // Remove event global arrays callfunc("WB_ResetEventGlobals", .@i); } } initnpctimer; end; } // World Boss Unit's Radar // Count users around the world boss and increase it's HP by each Player nearby - script WorldBossRadar -1,{ end; OnInit: .npc_name$ = strnpcinfo(0); .radius = 15; // Cell radius .HPLevel = 1500000; // HP increase per player .MinHP = .HPLevel * 2; // Minimum HP when to stop decreasing HP end; OnEnable: initnpctimer; end; OnDisable: stopnpctimer; end; // Every 10 secods update all World Boss unit data OnTimer10000: for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { .@unit_gid = $@WB_MOB_GID[.@i]; if ( unitexists(.@unit_gid) ) { getunitdata(.@unit_gid, .@udata); .@hp = .@udata[UMOB_HP]; .@maxhp = .@udata[UMOB_MAXHP]; .@x = .@udata[UMOB_X]; .@y = .@udata[UMOB_Y]; .@users = getareausers(mapid2name(.@udata[UMOB_MAPID]), (.@x - .radius), (.@y - .radius), (.@x + .radius), (.@y + .radius)); if ( .@users > $@WB_RADAR_NEAR[.@i] ) { // Increase HP per each player nearby .@new_hp = .@hp + ( .HPLevel * .@users ); // Stop increasing HP after maximum has been reached if ( .@new_hp < .@maxhp ) { setunitdata .@unit_gid, UMOB_HP, .@new_hp; unittalk .@unit_gid, rid2name(.@unit_gid) + " : Mortals has entered my sight!", bc_area; } } else if ( .@users < $@WB_RADAR_NEAR[.@i] ) { // Decrease HP per each player nearby .@new_hp = .@hp - .HPLevel; // Stop decreasing HP after minimum has been reached if ( .@new_hp > .MinHP ) { setunitdata .@unit_gid, UMOB_HP, .@new_hp; unittalk .@unit_gid, rid2name(.@unit_gid) + " : Mortals has left my sight!", bc_area; } } // Update users count setarray $@WB_RADAR_NEAR[.@i], .@users; } } initnpctimer; end; } // World Boss access expire timer // This will clean event access array from getting too big in time. - script WorldBossAccessExpire -1,{ end; OnEnable: //debugmes strnpcinfo(0)+"::OnEnable"; initnpctimer; end; OnDisable: //debugmes strnpcinfo(0)+"::OnDisable"; stopnpctimer; end; // Update every 5 minutes OnTimer300000: //debugmes strnpcinfo(0)+"::OnTimer"; .@time = gettimetick(0); .@expires = getvariableofnpc(.event_access_expire, "WorldBoss"); for ( .@i = 0; .@i < getarraysize($@WB_ACCESS); .@i++ ) { // Check if access has expired if ( .@time > ($@WB_ACCESS_EXPIRE[.@i] + .@expires) ) { // Current access has expired! Remove access and expire time. deletearray $@WB_ACCESS[.@i], 1; deletearray $@WB_ACCESS_EXPIRE[.@i], 1; } } // Continue timer if access is not empty if ( getarraysize($@WB_ACCESS) ) { initnpctimer; } end; } // World Boss Floating Rates - script WorldBossRates -1,{ OnInit: // Will fire before OnInterIfInitOnce on server start // Floating rates are enabled if(!getvariableofnpc(.use_floating_rates, "WorldBoss")) end; // Reset rates on script load if ( $wb_base_exp_rate && getBattleFlag("base_exp_rate") != $wb_base_exp_rate ) donpcevent strnpcinfo(0)+"::OnDisable"; end; OnInterIfInitOnce: // Will fire after OnInit on server start // Floating rates are enabled if(!getvariableofnpc(.use_floating_rates, "WorldBoss")) end; // Set once on server start $wb_battle_flags = 0; // Set servers default battle flags $wb_base_exp_rate = getBattleFlag("base_exp_rate"); $wb_job_exp_rate = getBattleFlag("job_exp_rate"); $wb_item_rate_common = getBattleFlag("item_rate_common"); $wb_item_rate_common_boss = getBattleFlag("item_rate_common_boss"); $wb_item_rate_common_mvp = getBattleFlag("item_rate_common_mvp"); $wb_item_rate_heal = getBattleFlag("item_rate_heal"); $wb_item_rate_heal_boss = getBattleFlag("item_rate_heal_boss"); $wb_item_rate_heal_mvp = getBattleFlag("item_rate_heal_mvp"); $wb_item_rate_use = getBattleFlag("item_rate_use"); $wb_item_rate_use_boss = getBattleFlag("item_rate_use_boss"); $wb_item_rate_use_mvp = getBattleFlag("item_rate_use_mvp"); $wb_item_rate_equip = getBattleFlag("item_rate_equip"); $wb_item_rate_equip_boss = getBattleFlag("item_rate_equip_boss"); $wb_item_rate_equip_mvp = getBattleFlag("item_rate_equip_mvp"); $wb_item_rate_card = getBattleFlag("item_rate_card"); $wb_item_rate_card_boss = getBattleFlag("item_rate_card_boss"); $wb_item_rate_card_mvp = getBattleFlag("item_rate_card_mvp"); $wb_item_rate_mvp = getBattleFlag("item_rate_mvp"); $wb_item_rate_adddrop = getBattleFlag("item_rate_adddrop"); $wb_item_rate_treasure = getBattleFlag("item_rate_treasure"); end; OnDisable: // Reset normal rates if ( $wb_battle_flags ) { setBattleFlag("base_exp_rate", $wb_base_exp_rate); setBattleFlag("job_exp_rate", $wb_job_exp_rate); setBattleFlag("item_rate_common", $wb_item_rate_common); setBattleFlag("item_rate_common_boss", $wb_item_rate_common_boss); setBattleFlag("item_rate_common_mvp", $wb_item_rate_common_mvp); setBattleFlag("item_rate_heal", $wb_item_rate_heal); setBattleFlag("item_rate_heal_boss", $wb_item_rate_heal_boss); setBattleFlag("item_rate_heal_mvp", $wb_item_rate_heal_mvp); setBattleFlag("item_rate_use", $wb_item_rate_use); setBattleFlag("item_rate_use_boss", $wb_item_rate_use_boss); setBattleFlag("item_rate_use_mvp", $wb_item_rate_use_mvp); setBattleFlag("item_rate_equip", $wb_item_rate_equip); setBattleFlag("item_rate_equip_boss", $wb_item_rate_equip_boss); setBattleFlag("item_rate_equip_mvp", $wb_item_rate_equip_mvp); setBattleFlag("item_rate_card", $wb_item_rate_card); setBattleFlag("item_rate_card_boss", $wb_item_rate_card_boss); setBattleFlag("item_rate_card_mvp", $wb_item_rate_card_mvp); setBattleFlag("item_rate_mvp", $wb_item_rate_mvp); setBattleFlag("item_rate_adddrop", $wb_item_rate_adddrop); setBattleFlag("item_rate_treasure", $wb_item_rate_treasure); } $wb_battle_flags = 0; stopnpctimer; end; OnEnable: // Check already enabled if ( !$wb_battle_flags ) { // Double server ratings setBattleFlag("base_exp_rate", $wb_base_exp_rate * 2); setBattleFlag("job_exp_rate", $wb_job_exp_rate * 2); setBattleFlag("item_rate_common", $wb_item_rate_common * 2); setBattleFlag("item_rate_common_boss", $wb_item_rate_common_boss * 2); setBattleFlag("item_rate_common_mvp", $wb_item_rate_common_mvp * 2); setBattleFlag("item_rate_heal", $wb_item_rate_heal * 2); setBattleFlag("item_rate_heal_boss", $wb_item_rate_heal_boss * 2); setBattleFlag("item_rate_heal_mvp", $wb_item_rate_heal_mvp * 2); setBattleFlag("item_rate_use", $wb_item_rate_use * 2); setBattleFlag("item_rate_use_boss", $wb_item_rate_use_boss * 2); setBattleFlag("item_rate_use_mvp", $wb_item_rate_use_mvp * 2); setBattleFlag("item_rate_equip", $wb_item_rate_equip * 2); setBattleFlag("item_rate_equip_boss", $wb_item_rate_equip_boss * 2); setBattleFlag("item_rate_equip_mvp", $wb_item_rate_equip_mvp * 2); setBattleFlag("item_rate_card", $wb_item_rate_card * 2); setBattleFlag("item_rate_card_boss", $wb_item_rate_card_boss * 2); setBattleFlag("item_rate_card_mvp", $wb_item_rate_card_mvp * 2); setBattleFlag("item_rate_mvp", $wb_item_rate_mvp * 2); setBattleFlag("item_rate_adddrop", $wb_item_rate_adddrop * 2); setBattleFlag("item_rate_treasure", $wb_item_rate_treasure * 2); } announce "[World Boss] Experience and Drop rates has been doubled for one hour! Enjoy!", bc_all, 0x00FF00; $wb_battle_flags = 1; initnpctimer; end; OnTimer3600000: // 1 hour donpcevent strnpcinfo(0)+"::OnDisable"; end; } // NPC World Boss Information prontera,147,174,4 script World Boss#info 495,5,5,{ mes "[ " + strnpcinfo(1) + " ]"; mes "About the world bosses."; if ( getarraysize($@WB_MOB_GID) ) { .@time = gettimetick(0); .@timeout = getvariableofnpc(.event_timeout, "WorldBoss"); mes "Status: ^00CC36Active^000000"; for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { .@timeleft = ($@WB_TIMEOUT[.@i] + .@timeout) - .@time; mes (.@i + 1) + ". Location : " + $@WB_MAP$[.@i]; mes " ^777777 Time Left :^000000 " + (.@timeleft / 60000) + " min."; } mes "Good luck!"; } else { mes "Status: ^CC3300Inactive^000000"; mes "Event timetable:"; mes "^777777 ~ 04:02 ^000000"; mes "^777777 ~ 23:59 ^000000"; mes "Wait until the event starts."; } // GM level 60+ has access to menu if( getgmlevel() >= 60 ) { next; switch( select("Information:Start Event:Skip Start Timer:Stop Event:Change Loot Mode:Change Unit Data:Map Flags:Leave") ) { case 1: callsub S_Info; break; case 2: callsub S_Start; break; case 3: callsub S_Skip; break; case 4: callsub S_Stop; break; case 5: callsub S_Loot; break; case 6: callsub S_Unit; break; case 7: callsub S_Mapflags; break; default: break; } } close; S_Info: // Set variables .@enabled = getarraysize($@WB_MOB_GID); .@loot_mode = getvariableofnpc(.loot_mode, .event_npc$); .@time = gettimetick(0); .@timeout = getvariableofnpc(.event_timeout, "WorldBoss"); mes "[ " + strnpcinfo(1) + " ]"; mes "^777777Status: ^000000" + (.@enabled ? "^00CC36Active^000000" : "^CC3300Inactive^000000"); mes "^777777Loot mode: ^000000" + .event_loot_modes$[.@loot_mode]; .@menu$ = "Leave:"; for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { if ( $@WB_MOB_GID[.@i] || $@WB_NPC_NAME$[.@i] != "" ) { // Monster Unit .@timeleft = ($@WB_TIMEOUT[.@i] + .@timeout) - .@time; // ms // Get unit data if ( unitexists($@WB_MOB_GID[.@i]) ) { // Monster unit getunitdata($@WB_MOB_GID[.@i], .@udata); mes (.@i + 1) +". Monster: " + $@WB_MOB_ID[.@i] +" / "+ getmonsterinfo($@WB_MOB_ID[.@i], 0); mes " ^777777 GID: ^000000" + $@WB_MOB_GID[.@i]; mes " ^777777 Name: ^000000" + rid2name($@WB_MOB_GID[.@i]); mes " ^777777 HP: ^000000" + .@udata[UMOB_HP] + " / " + .@udata[UMOB_MAXHP]; mes " ^777777 Location: ^000000" + mapid2name(.@udata[UMOB_MAPID]) + " ^777777 x ^000000" + .@udata[UMOB_X] + " ^777777 y ^000000" + .@udata[UMOB_Y]; mes " ^777777 Time Left :^000000 " + (.@timeleft / 60000) + " min."; } else if (unitexists(getnpcid(0, $@WB_NPC_NAME$[.@i]))) { // NPC unit getunitdata(getnpcid(0, $@WB_NPC_NAME$[.@i]), .@udata); mes (.@i + 1) +". Treasure Chest"; mes " ^777777 GID: ^000000" + getnpcid(0, $@WB_NPC_NAME$[.@i]); mes " ^777777 Name: ^000000" + $@WB_NPC_NAME$[.@i]; mes " ^777777 Location: ^000000" + mapid2name(.@udata[UNPC_MAPID]) + " ^777777 x ^000000" + .@udata[UNPC_X] + " ^777777 y ^000000" + .@udata[UNPC_Y]; } mes "^777777-------^000000"; .@menu$ += "Go to "+$@WB_MAP$[.@i]; } .@menu$ += ":"; } .@selected = select(.@menu$) - 2; if ( .@selected >= 0 ) { if ( unitexists($@WB_MOB_GID[.@selected]) ) { // Warp to the monster location getunitdata($@WB_MOB_GID[.@selected], .@data); warp mapid2name(.@data[UMOB_MAPID]), .@data[UMOB_X], .@data[UMOB_Y]; } else if ( $@WB_NPC_NAME$[.@selected] != "" ) { // Warp to the NPC location if (unitexists(getnpcid(0, $@WB_NPC_NAME$[.@selected]))) { getunitdata(getnpcid(0, $@WB_NPC_NAME$[.@selected]), .@data); warp mapid2name(.@data[UNPC_MAPID]), .@data[UNPC_X], .@data[UNPC_Y]; } } end; } return; S_Mapflags: mes "[ " + strnpcinfo(1) + " ] Mapflags"; .@size = getarraysize($@WB_MOB_GID); .@mapflags = getvariableofnpc(.use_mapflags, "WorldBoss"); if ( .@mapflags && .@size ) { for ( .@i = 0; .@i < .@size; .@i++ ) { .@map$ = $@WB_MAP$[.@i]; mes .@map$ + " : Original Flags"; mes " ^777777 PartyLock : " + $@WB_MF_PARTYLOCK[.@i] + "^000000"; mes " ^777777 NoMobLoot : " + $@WB_MF_NOMOBLOOT[.@i] + "^000000"; mes " ^777777 NoMVPLoot : " + $@WB_MF_NOMVPLOOT[.@i] + "^000000"; mes " ^777777 NoPenalty : " + $@WB_MF_NOPENALTY[.@i] + "^000000"; mes " ^777777 NoMobTele : " + $@WB_MF_NOMOBTELE[.@i] + "^000000"; mes " ^777777 BaseExp : " + $@WB_MF_BASEEXP[.@i] + "^000000"; mes " ^777777 JobExp : " + $@WB_MF_JOBEXP[.@i] + "^000000"; //mes " ^777777 Fog : " + $@WB_MF_FOG[.@i] + "^000000"; mes .@map$ + " : New Flags"; mes " ^777777 PartyLock : " + getmapflag(.@map$, MF_PARTYLOCK) + "^000000"; mes " ^777777 NoMobLoot : " + getmapflag(.@map$, MF_NOMOBLOOT) + "^000000"; mes " ^777777 NoMVPLoot : " + getmapflag(.@map$, MF_NOMVPLOOT) + "^000000"; mes " ^777777 NoPenalty : " + getmapflag(.@map$, MF_NOPENALTY) + "^000000"; mes " ^777777 NoMobTele : " + getmapflag(.@map$, MF_MONSTER_NOTELEPORT) + "^000000"; mes " ^777777 BaseExp : " + getmapflag(.@map$, MF_BEXP) + "^000000"; mes " ^777777 JobExp : " + getmapflag(.@map$, MF_JEXP) + "^000000"; //mes " ^777777 Fog : " + getmapflag(.@map$, MF_FOG) + "^000000"; mes "^777777-------^000000"; } } else { mes "No mapflags has been set."; } return; S_Start: donpcevent .event_npc$ + "::OnEnable"; message strcharinfo(0), "Event has been started!"; return; S_Skip: awake .event_npc$; // Cancels any running sleep timers on the NPC message strcharinfo(0), "Event timer has been skipped!"; return; S_Stop: awake .event_npc$; // Cancels any running sleep timers on the NPC donpcevent .event_npc$ + "::OnDisable"; // Announce event stopped announce "[World Boss] The event has been stopped!", bc_all, 0xFF0000; message strcharinfo(0), "Event has been stopped!"; return; S_Loot: .@size = getarraysize(.event_loot_modes$); for( .@i = 0; .@i < .@size; .@i++ ) { message strcharinfo(0), "Loot mode "+ .@i +" : " + .event_loot_modes$[.@i]; } // Change event loot mode option input .@input, 0, .@size; set getvariableofnpc(.loot_mode, .event_npc$), .@input; message strcharinfo(0), "Event loot mode changed: " + .event_loot_modes$[.@input]; return; S_Unit: // Create menu .@menu$ = "Leave:"; for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { if ( unitexists($@WB_MOB_GID[.@i]) ) { .@menu$ += $@WB_MAP$[.@i] +" - "+ getmonsterinfo($@WB_MOB_ID[.@i], 0); } .@menu$ += ":"; } .@selected = select(.@menu$) - 2; // Change unit data (HP,Level,Atk,Etc.) if ( .@selected >= 0 ) { mes "[ " + strnpcinfo(1) + " ]"; getunitdata($@WB_MOB_GID[.@selected], .@udata); for (.@i = 0; .@i < getarraysize(.@udata); .@i++ ) { mes .UMOB$[.@i] + " = " + .@udata[.@i]; } .@select = select(.UMOB_menu$) - 1; message strcharinfo(0), "Write a new unit ( " + .UMOB$[.@select] + " ) value."; input .@val, 0, 1000000000; setunitdata($@WB_MOB_GID[.@selected], .@select, .@val); // Confim data has changed getunitdata($@WB_MOB_GID[.@selected], .@confirm_udata); message strcharinfo(0), "New unit data is: " + .@confirm_udata[.@select]; } return; OnInit: // Event NPC name .event_npc$ = "WorldBoss"; // Event loot mode descriptions // Copy array from other NPC copyarray .event_loot_modes$[0], getelementofarray(getvariableofnpc(.loot_mode_desc$, .event_npc$),0), getarraysize(getvariableofnpc(.loot_mode_desc$, .event_npc$)); // Unit data attibute names setarray .UMOB$[0], "Size","Level","Hp","Max Hp", "Master AID","Map ID","Map X","Map Y", "Speed","Mode","Ai","Scoption", "Sex","Class","Hair style","Hair color", "Head bottom","Head middle","Head top","Cloth color", "Shield","Weapon","Look dir","Can move tick", "Str","Agi","Vit","Int", "Dex","Luk","Slave cpymstrmd","Dmg immune", "Atk range","Atk min","Atk max","Matk min", "Matk max","Def","Mdef","Hit", "Flee","Pdodge","Crit","Race", "Ele type","Ele level","A-motion","A-delay", "D-motion"; // Unit data menu string .UMOB_menu$ = implode(.UMOB$, ":"); // Set NPC size if class_id supports .@npc_class = rand(495, 498); .@npc_size = rand(0, 2); // 0=normal, 1=small, 2=big setnpcdisplay(strnpcinfo(0), strnpcinfo(1), .@npc_class, .@npc_size); end; OnTouch: // Player attached end; OnTouchNPC: // Monster attached .@UNIT_GID = getattachedrid(); //.@UNIT_NAME$ = rid2name(.@UNIT_GID); //debugmes "Target unit name:" + .@UNIT_NAME$; // Get unit data as Array getunitdata(.@UNIT_GID, .@data); .@MASTER_AID = .@data[UMOB_MASTERAID]; // UMOB_MASTERAID=4 // Unit has a master if ( .@MASTER_AID ) { .@MASTER_NAME$ = rid2name(.@MASTER_AID); .@online = isloggedin(.@MASTER_AID); if ( .@online ) { end; // Do not target players unit } } // NPC emotion emotion ET_KEK; // Warp monsters away from the NPC unitwarp 0, "this", -1, -1; end; } Can you tell me how resolve that ^^  thx for your repply.
  9. hi, thx for this script but on my server he doesnt work =s //= World Boss Event //===== By: ================================================== //= Musika6988, Sehrentos //===== Current Version: ===================================== //= 2.9.3 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Summon random World Boss and when defeated get treasure. //= Leader will have option to distribute or dispose loots. //= GM panel: info/start/stop/skip/lootMode/modify. //= Boss HP will increase or decrease by 1.500.000 per each //= player nearby and is updated every 10 seconds. //= When boss is defeated it will trigger increased exp and //= drop rates to whole server for 1 hour(IF enabled). //===== Additional Comments: ================================= //= 1.x Initial script by Musika6988. //= 2.0 Sehrentos added reward arrays. Randomly select a reward. //= 2.1 Sehrentos changed single random reward into random all rewards. //= 2.2 Sehrentos minor optimizations. //= 2.3 Sehrentos added more loot options. //= 2.4 Sehrentos added GM panel, Default mob attributes(.MOB_), //= Same party check(reward stealing) //= 2.5 Sehrentos added NPC WorldBossRadar to monitor players nearby, //= Removed Flee and Perfect Dodge from Treasure Chest, //= Added timeout to stop the event. Minor text changes. //= 2.6 Sehrentos added loot mode 1 give one reward to one random party member. //= Added loot modes 4-5 give all/one rewards to all nearby players and their party members. //= Added loot modes 6-7 give all/one rewards to all nearby players. //= 2.7 Sehrentos removed Treasure Chest monster. //= Added Treasure Chest NPCs. //= Added multiple events at once, but not in same map. //= Added loot modes 8-9 give all/one rewards to all players in same map. //= Added double server rates for 1 hour after boss is killed event. //= 2.8 Sehrentos added jump_zero optimizations. //= Fixed WorldBossRates::OnInit first run on the server. //= Added $@WB_ACCESS_EXPIRE timer. Clean the access array when it expires. //= 2.9 Sehrentos WorldBossRadar enable/disable option. //= Added loot modes 10 give all rewards to selected party member. //= Added loot modes 11 give one random reward to selected party member. //= 2.9.1 Sehrentos Fixes and additions. //= Added option to turn off mapflags. //= Added more default .MOB_ status points. //= Fix random reward will be selected only once, to avoid abuse ($@WB_REWARD_INDEX). //= Renamed some values. easier to understand. //= 2.9.2 Sehrentos Disabled FOG effect. //= Added more announcements when event fail to start. //= Added unit checks on OnMobDie event. //= Added inarray optimizations. //= 2.9.3 Sehrentos changed the way event starts and announces. //= Fixed WorldBossRates when .use_floating_rates is enabled(report @Quesooo). //= !TODO: Loot mode 12 give each reward to selected party member one by one. //============================================================ - script WorldBoss -1,{ OnInit: // Settings .npc_name$ = strnpcinfo(0); // Name of this NPC .event_sleep = 60000; // Event sleep time in milliseconds(60000 = 1 minute) .event_timeout = 7200000; // Event timeout time in milliseconds before Boss is disabled(60000 = 1 minute) .event_access_expire = 900000; // Event access expire time in milliseconds(60000 = 1 minute) // Reward distribution .loot_mode = 0; // Event loot distribution mode. Look npc_loot_mode_desc for descriptions .loop_max = 200; // Maximum number of loops (When selecting a random party member) .duplicate_npc_count = 9; // Number of duplicate Treasure Chest NPC's (Important! 0 counts as well) // Experience increases during event(In current event map) .base_exp_multiplier = 3500; // Event base exp rating multiplier(In current event map) .job_exp_multiplier = 3500; // Event job exp rating multiplier(In current event map) .use_floating_rates = 1; // Increase servers exp and drop rates for 1 hour after boss kill(0=Disable, 1=Enable) // Monsters default attributes .MOB_MAXHP = 100000000; // How much HP can monster have at maximum .MOB_HP = 5000000; // How much HP monster has on spawn .MOB_SPEED = 130; // Speed .MOB_CRIT = 450; // Crit rate (1000=100%) .MOB_HIT = 300; // Hit rate .MOB_ATKMIN = 1000; // Base Attack Minimum .MOB_ATKMAX = 4000; // Base Attack Maximum .MOB_MATKMIN = 1000; // Magic Attack Minimum .MOB_MATKMAX = 4000; // Magic Attack Maximum .MOB_DEF = 35; // Defence .MOB_MDEF = 35; // Magic Defence .MOB_FLEE = 200; // Flee rate .MOB_PDODGE = 60; // Perfect Dodge .MOB_STR = 150; // Stat strength .MOB_AGI = 150; // Stat agility .MOB_VIT = 150; // Stat vitality .MOB_INT = 150; // Stat intellect .MOB_DEX = 150; // Stat dexterity .MOB_LUK = 150; // Stat luck // Floating monster HP // When player is detected near the mob, update it's HP. .use_radar = 0; // 0=Disable, 1=Enable // Mapflags effects, monster status, party lock, etc. .use_mapflags = 0; // 0=Disable, 1=Enable // Event monster ID's setarray .event_mobs[0], 1093, // Eclipse 1096, // Angeling 1120, // Ghostring 1388, // Archangeling 1582, // Deviling 1795; // Bloody Knight // Event reward ID's (One random array is selected) setarray .loots_0[0], 501, 502, 503, 504, 505, 506; setarray .loots_1[0], 507, 508, 509, 510, 511, 512; setarray .loots_2[0], 513, 514, 515, 516, 517, 518; setarray .loots_3[0], 519, 520, 521, 522, 523, 525; // Event reward ID's array size (Important!) // If you add new .loots_<Number> arrays. You must change this accordingly. .loots_count = 3; // 0 count aswell // Event map names setarray .event_maps$[0], "prontera", "morocc", "geffen", "payon", "alberta", "aldebaran", "xmas", "comodo", "yuno", "amatsu", "gonryun", "umbala", "louyang", "ayothaya", "einbroch", "hugel", "rachel", "veins", "moscovia"; // Event loot distribution mode description setarray .loot_mode_desc$[0], "Give all rewards to all party members", // .loot_mode = 0 "Give one reward to one random party member", // .loot_mode = 1 "Give all rewards to one random party member", // .loot_mode = 2 "Give rewards randomly between all party members", // .loot_mode = 3 "Give all rewards to all nearby players and their party members", // .loot_mode = 4 (Skip UI) "Give one reward to all nearby players and their party members", // .loot_mode = 5 (Skip UI) "Give all rewards to all nearby players", // .loot_mode = 6 (Skip UI) "Give one reward to all nearby players", // .loot_mode = 7 (Skip UI) "Give all rewards to all players in the same map", // .loot_mode = 8 (Skip UI) "Give one reward to all players in the same map", // .loot_mode = 9 (Skip UI) "Give all rewards to selected party member", // .loot_mode = 10 "Give one random reward to selected party member"; // .loot_mode = 11 // TESTS // Log console information // This will report incorrect monster ID's on script load /*for( .@i = 0; .@i < getarraysize(.event_mobs); .@i++ ) { if( getmonsterinfo(.event_mobs[.@i], 0) == "null" ) { debugmes .npc_name$ + ":OnInit Monster ID:" + .event_mobs[.@i] + " DOES NOT EXIST!"; } }*/ // Start event on script load (For testing purposes) //donpcevent .npc_name$ + "::OnEnable"; end; OnEnable: OnClock0402: OnClock2359: // Check free event maps if ( getarraysize($@WB_MAP$) >= getarraysize(.event_maps$) ) { debugmes .npc_name$+"::OnEnable all event maps are active!"; //announce "[World Boss] Event has been cancelled! All event maps are active!", BC_ALL, 0xFF0000; end; } // Select random monster .@rand_mob = rand( getarraysize( .event_mobs ) ); .@monster_id = .event_mobs[ .@rand_mob ]; // Select random map .@i = 0; .@rand_map = rand( getarraysize( .event_maps$ ) ); // Random map index number while(inarray($@WB_MAP$[0], .event_maps$[.@rand_map]) != -1) { if(.@i > .loop_max) { debugmes .npc_name$+"::OnEnable event map max loop count!"; //announce "[World Boss] Event has been cancelled! Could not find free event map!", BC_ALL, 0xFF0000; end; } .@rand_map = rand( getarraysize( .event_maps$ ) ); .@i++; } .@map_name$ = .event_maps$[ .@rand_map ]; // Announce event will start soon announce "[World Boss] A rift on time and space is about to be opened! A World Boss will appear in "+(.event_sleep / 60000)+" minute! Prepare your Hunting Party!",BC_ALL,0xFF0000,FW_BOLD,18; // Sleep until X time have passed and then continue script sleep .event_sleep; // Get last event index .@index = getarraysize($@WB_MOB_GID); // Set mapflags if enabled if ( .use_mapflags ) { // Save event maps original mapflags setarray $@WB_MF_PARTYLOCK[.@index], getmapflag(.@map_name$, MF_PARTYLOCK); setarray $@WB_MF_NOMOBLOOT[.@index], getmapflag(.@map_name$, MF_NOMOBLOOT); setarray $@WB_MF_NOMVPLOOT[.@index], getmapflag(.@map_name$, MF_NOMVPLOOT); setarray $@WB_MF_NOPENALTY[.@index], getmapflag(.@map_name$, MF_NOPENALTY); setarray $@WB_MF_NOMOBTELE[.@index], getmapflag(.@map_name$, MF_MONSTER_NOTELEPORT); setarray $@WB_MF_BASEEXP[.@index], getmapflag(.@map_name$, MF_BEXP); setarray $@WB_MF_JOBEXP[.@index], getmapflag(.@map_name$, MF_JEXP); //setarray $@WB_MF_FOG[.@index], getmapflag(.@map_name$, MF_FOG); // Set new mapflags setmapflag .@map_name$, MF_PARTYLOCK; // Disable changing party(Inviting new players in event map) setmapflag .@map_name$, MF_NOMOBLOOT; // Disable Normal monster loot drops setmapflag .@map_name$, MF_NOMVPLOOT; // Disable Boss monster loot drops setmapflag .@map_name$, MF_NOPENALTY; // Disable Exp and Zeny penalty setmapflag .@map_name$, MF_MONSTER_NOTELEPORT; // Disable monster teleport setmapflag .@map_name$, MF_BEXP, ($@WB_MF_BASEEXP[.@index] * .base_exp_multiplier); // Set Base Exp rating setmapflag .@map_name$, MF_JEXP, ($@WB_MF_JOBEXP[.@index] * .job_exp_multiplier); // Set Job Exp rating //setmapflag .@map_name$, MF_FOG; // Enable FOG effect } // Summon event monster unit monster .@map_name$, 0, 0, "World Boss", .@monster_id, 1, .npc_name$+"::OnMobDie", Size_Large, AI_NONE; .@gid = $@mobid[0]; // Get monster's Game ID // Change unit data to defaults setunitdata .@gid, UMOB_MAXHP, .MOB_MAXHP; setunitdata .@gid, UMOB_HP, .MOB_HP; setunitdata .@gid, UMOB_SPEED, .MOB_SPEED; setunitdata .@gid, UMOB_CRIT, .MOB_CRIT; setunitdata .@gid, UMOB_HIT, .MOB_HIT; setunitdata .@gid, UMOB_ATKMIN, .MOB_ATKMIN; setunitdata .@gid, UMOB_ATKMAX, .MOB_ATKMAX; setunitdata .@gid, UMOB_MATKMIN, .MOB_MATKMIN; setunitdata .@gid, UMOB_MATKMAX, .MOB_MATKMAX; setunitdata .@gid, UMOB_DEF, .MOB_DEF; setunitdata .@gid, UMOB_MDEF, .MOB_MDEF; setunitdata .@gid, UMOB_FLEE, .MOB_FLEE; setunitdata .@gid, UMOB_PDODGE, .MOB_PDODGE; setunitdata .@gid, UMOB_STR, .MOB_STR; setunitdata .@gid, UMOB_AGI, .MOB_AGI; setunitdata .@gid, UMOB_VIT, .MOB_VIT; setunitdata .@gid, UMOB_INT, .MOB_INT; setunitdata .@gid, UMOB_DEX, .MOB_DEX; setunitdata .@gid, UMOB_LUK, .MOB_LUK; // Get units updated data getunitdata(.@gid, .@unit); // Save event arrays setarray $@WB_MOB_ID[.@index], .@monster_id; setarray $@WB_MOB_GID[.@index], .@gid; setarray $@WB_TIMEOUT[.@index], gettimetick(0); setarray $@WB_RADAR_NEAR[.@index], 0; setarray $@WB_MAP$[.@index], .@map_name$; setarray $@WB_X[.@index], .@unit[UMOB_X]; setarray $@WB_Y[.@index], .@unit[UMOB_Y]; // Unit talk unittalk .@gid, "Tremble before me mortals!", BC_AREA; // Announce event started announce "[World Boss] A "+ getunitname(.@gid) +" has appeared in "+ .@map_name$ +" to wreck havoc!! Form a Hunting Party and stop it!!",BC_ALL,0xFF0000,FW_BOLD,18; // Start unit radar if ( .use_radar && getarraysize($@WB_MOB_GID) ) { donpcevent "WorldBossRadar::OnEnable"; } // Start timeout timer if ( !getnpctimer(1, "WorldBossTimeout") ) { donpcevent "WorldBossTimeout::OnEnable"; } end; // Disable event OnDisable: //debugmes .npc_name$+"::OnDisable stop event!"; // Stop timeout timer donpcevent "WorldBossTimeout::OnDisable"; // Stop unit radar if ( .use_radar ) { donpcevent "WorldBossRadar::OnDisable"; } // Reset server exp and drop rates if ( .use_floating_rates ) { donpcevent "WorldBossRates::OnDisable"; } // Loop all events for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { // Kill all units if ( unitexists($@WB_MOB_GID[.@i]) ) { unitkill($@WB_MOB_GID[.@i]); } // Reset all mapflags to original values if ( .use_mapflags ) { callfunc("WB_ResetMapflags", $@WB_MAP$[.@i], .@i); } } // Kill all script or gm summoned monsters //killmonster .event_map$, "All"; // Reset all event arrays callfunc("WB_ResetAllGlobals"); end; OnMobDie: // Event when monster has been killed // Stop unit radar and timeout if no unit is alive if ( !getarraysize($@WB_MOB_GID) ) { if ( .use_radar ) donpcevent "WorldBossRadar::OnDisable"; donpcevent "WorldBossTimeout::OnDisable"; } // Check attached unit .@unit_gid = getattachedrid(); if ( !.@unit_gid ) { // No unit attached. Propably killed by unitkill or other script command //donpcevent .npc_name$+"::OnDisable"; end; } // Get unit type .@unit_type = getunittype(.@unit_gid); if ( .@unit_type == -1 ) { debugmes .npc_name$+"::OnMobDie FATAL no unit type found!"; donpcevent .npc_name$+"::OnDisable"; end; } // Get map coordinates (Treasure Chest NPC will need these coordinates) getmapxy(.event_map$, .event_x, .event_y, .@unit_type); // Announce announce "[World Boss] The World Boss have been killed! Congratulations!", bc_all, 0xFF0000; // Increase server exp and drop rates for limited time if ( .use_floating_rates ) { donpcevent "WorldBossRates::OnEnable"; } // Get index if map name are the same .@event_index = inarray($@WB_MAP$[0], .event_map$); // Check if index was found and stop if not if ( .@event_index == -1 ) { debugmes .npc_name$+"::OnMobDie event index was not found!"; end; } // Reset mapflags to original values if ( .use_mapflags ) { callfunc("WB_ResetMapflags", $@WB_MAP$[.@event_index], .@event_index); } // If unit is not PC, try to attach unit master to the script if ( .@unit_type != UNITTYPE_PC ) { getunitdata(.@unit_gid, .@data); if (.@unit_type == UNITTYPE_NPC) { // NPC does not have master debugmes .npc_name$+"::OnMobDie NPC no player attached!"; end; } if (.@unit_type == UNITTYPE_PET) { if (!attachrid(.@data[UPET_MASTERAID])) { debugmes .npc_name$+"::OnMobDie PET no player attached!"; end; } } if (.@unit_type == UNITTYPE_MOB) { if (!attachrid(.@data[UMOB_MASTERAID])) { debugmes .npc_name$+"::OnMobDie MOB no player attached!"; end; } } if (.@unit_type == UNITTYPE_HOM) { .@name$ = strcharinfo(0,.@data[UHOM_MASTERCID]); if (!attachrid(getcharid(3,.@name$))) { debugmes .npc_name$+"::OnMobDie HOM no player attached!"; end; } } if (.@unit_type == UNITTYPE_MER) { .@name$ = strcharinfo(0,.@data[UMER_MASTERCID]); if (!attachrid(getcharid(3,.@name$))) { debugmes .npc_name$+"::OnMobDie MER no player attached!"; end; } } if (.@unit_type == UNITTYPE_ELEM) { .@name$ = strcharinfo(0,.@data[UELE_MASTERCID]); if (!attachrid(getcharid(3,.@name$))) { debugmes .npc_name$+"::OnMobDie ELE no player attached!"; end; } } } // Get party ID .@party_id = getcharid(1); // Save event arrays setarray $@WB_MAP$[.@event_index], .event_map$; setarray $@WB_X[.@event_index], .event_x; setarray $@WB_Y[.@event_index], .event_y; setarray $@WB_PARTY_ID[.@event_index], .@party_id; // Select random reward/loots array setarray $@WB_REWARD_INDEX[.@event_index], rand(0, .loots_count); // Enable first available Treasure Chest NPC // Set .event_map$, .event_x, .event_y before enabling ( Important! ) for ( .@i = 0; .@i <= .duplicate_npc_count; .@i++ ) { .@npc$ = "Treasure Chest#wb_"+ .@i; // Name of the NPC if ( getnpcid(0, .@npc$) ) { // If NPC exists if ( !getnpctimer( 1, .@npc$ ) ) { // If has active timer=1 setarray $@WB_NPC_NAME$[.@event_index], .@npc$; donpcevent .@npc$ +"::OnEnable"; break; } } else { debugmes .npc_name$+"::OnMobDie no Treasure Chest#wb_"+.@i+" NPC found!"; } } // Switch by loot mode and save character IDs for access switch( .loot_mode ) { case 0: case 1: case 2: case 3: // In same party or single player case 10: // All to selected party member case 11: // One random to selected party member // Attach all available party members if ( getcharid(1) ) { addrid(2, 0, getcharid(1)); } break; case 4: case 5: // In range and party // Attach all available players in 20 cells from the killer RID addrid(4, 0, (.event_x - 20),(.event_y - 20), (.event_x + 20),(.event_y + 20)); // Attach all available party members if ( getcharid(1) ) { addrid(2, 0, getcharid(1)); } break; case 6: case 7: // In range // Attach all available players in 20 cells from the killer RID addrid(4, 0, (.event_x - 20),(.event_y - 20), (.event_x + 20),(.event_y + 20)); break; case 8: case 9: // In the same map addrid(1, 0, getcharid(1)); break; } // Find matching character IDs from the access array .@access_index = inarray($@WB_ACCESS[0], getcharid(0)); // Exit if character already has access if ( .@access_index != -1 ) { end; } // Save character ID into access array setarray $@WB_ACCESS[getarraysize($@WB_ACCESS)], getcharid(0); setarray $@WB_ACCESS_EXPIRE[getarraysize($@WB_ACCESS_EXPIRE)], gettimetick(0); // Start access expire timer if not already running if ( !getnpctimer(1, "WorldBossAccessExpire") ) { donpcevent "WorldBossAccessExpire::OnEnable"; } end; // Event when player opens Treasure Chest NPC OnTreasureOpen: // Get map coordinates of the player getmapxy(.@event_map$, .@x, .@y, UNITTYPE_PC); // Search for character ID from the access array .@access_index = inarray($@WB_ACCESS[0], getcharid(0)); // User has no access! if ( .@access_index == -1 ) { message strcharinfo(0), "Treasure Chest is empty."; end; } // Get event index from the map name array .@event_index = inarray($@WB_MAP$[0], .@event_map$); // Check if event index was found if ( .@event_index == -1 ) { debugmes .@name$+"::OnTreasureOpen event map name ( "+ .@event_map$ +" ) not found!"; message strcharinfo(0), "Treasure Chest is empty."; end; } // Select reward array .@rand_reward = $@WB_REWARD_INDEX[.@event_index]; .@reward_size = getarraysize( getd(".loots_" + .@rand_reward) ); copyarray .@rewards[0], getd(".loots_" + .@rand_reward + "[0]"), .@reward_size; switch( .loot_mode ) { case 0: // All to all members case 2: // All to random member case 3: // Randomly to all members case 10: // All to selected party member case 11: // One random to selected party member if ( getcharid(1) ) { goto OnPartyLeader; } else { // Has no party for( .@i = 0; .@i < .@reward_size; .@i++ ) { getitem .@rewards[.@i], 1; } } break; case 1: // One to random member if ( getcharid(1) ) { // Party Leader will distribute loots goto OnPartyLeader; } else { // Has no party getitem .@rewards[rand(.@reward_size)], 1; } break; case 4: // All in range and party case 6: // All in range case 8: // All in same map default: // No UI for( .@i = 0; .@i < .@reward_size; .@i++ ) { getitem .@rewards[.@i], 1; } break; case 5: // One in range and party case 7: // One in range case 9: // One in same map // No UI getitem .@rewards[rand(.@reward_size)], 1; break; } // Remove character ID from the access array (Access is now used) deletearray $@WB_ACCESS[.@access_index], 1; deletearray $@WB_ACCESS_EXPIRE[.@access_index], 1; // Announce player message strcharinfo(0), "Congratulations! You have been rewarded for killing the World Boss."; // Disable current NPC Treasure Chest if ( !getarraysize($@WB_ACCESS) ) { // Disable current NPC Treasure Chest callfunc("WB_ResetBox", .@event_index); // Stop access expire timer donpcevent "WorldBossAccessExpire::OnDisable"; } end; OnPartyLeader: // Get party ID .@party_id = getcharid(1); // Check if player is party leader if ( getcharid(0) != getpartyleader( .@party_id, 2 ) ) { message strcharinfo(0), "You're not Party Leader."; end; } // Get event index from the party ID array .@event_index = inarray($@WB_PARTY_ID[0], .@party_id ); // Check if party id has access! if ( .@event_index == -1 ) { message strcharinfo(0), "Treasure Chest is empty."; end; } // Select random reward array .@rand_reward = $@WB_REWARD_INDEX[.@event_index]; .@reward_size = getarraysize(getd(".loots_" + .@rand_reward)); copyarray .@rewards[0], getd(".loots_" + .@rand_reward + "[0]"), .@reward_size; // Show loot distribution window mes "[ Loot Distributor ]"; mes "Please ensure you distribute the Rewards. If you cancelled this, your party might not able to receive any rewards."; mes "^777777Loot mode : ^000000" + .loot_mode_desc$[.loot_mode]; // Loot mode description next; mes "[ Loot Distributor ]"; for( .@i = 0; .@i < .@reward_size; .@i++ ) { mes "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; } next; if( select( "Distribute Loots", "Dispose Loots" ) == 1 ) { // Get party data getpartymember .@party_id, 0; // Name getpartymember .@party_id, 1; // Character IDs getpartymember .@party_id, 2; // Account IDs // Copy the temporary party data .@party_size = $@partymembercount; copyarray .@party_cid[0], $@partymembercid[0], .@party_size; copyarray .@party_aid[0], $@partymemberaid[0], .@party_size; copyarray .@party_name$[0], $@partymembername$[0], .@party_size; // LOOT MODE 0: Give all rewards to all party members if( .loot_mode == 0 ) { mes "[ Loot Distributor ]"; // Loop through each party member for( .@idx = 0; .@idx < .@party_size; .@idx++ ) { // Online check if( isloggedin(.@party_aid[.@idx], .@party_cid[.@idx]) ) { mes " ~ " + strcharinfo(0, .@party_cid[.@idx]) + " was rewarded!"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { getitem .@rewards[.@i], 1, .@party_aid[.@idx]; } } } } // LOOT MODE 1: Give one reward to one random party member else if( .loot_mode == 1 ) { // Select random party member X times. SelectRandom1: .@attempts = 0; // Counter for random player select .@rand_party = rand(.@party_size); while( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { if( .@attempts >= .loop_max ) break; .@rand_party = rand(.@party_size); .@attempts++; } // Max attempts reached if( .@attempts >= .loop_max ) { mes "[ Player not found ]"; mes "Tried to select random player " + .@attempts + " times!"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom1; } else { goto OnClose; } } // Backup online check (next; will pause script and players can disconnect) if( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { mes "[ Player not online ]"; mes "Member is ^777777offline^000000"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom1; } else { goto OnClose; } } // Give random reward .@rand_item = rand(.@reward_size); .@name$ = strcharinfo(0, .@party_cid[.@rand_party]); mes "[ Loot Distributor ]"; mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@rand_item] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@rand_item] ) + " ( Distributed Randomly )"; getitem .@rewards[.@rand_item], 1, .@party_aid[.@rand_party]; } // LOOT MODE 2: Give all rewards to one random party member else if( .loot_mode == 2 ) { // Select random party member X times. SelectRandom2: .@attempts = 0; // Counter for random player select .@rand_party = rand(.@party_size); while( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { if( .@attempts >= .loop_max ) break; .@rand_party = rand(.@party_size); .@attempts++; } // Max attempts reached if( .@attempts >= .loop_max ) { mes "[ Player not found ]"; mes "Tried to select random player " + .@attempts + " times!"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom2; } else { goto OnClose; } } // Backup online check (next; will pause script and players can disconnect) if( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { mes "[ Player not online ]"; mes "Member is ^777777offline^000000"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom2; } else { goto OnClose; } } // Give rewards .@name$ = strcharinfo(0, .@party_cid[.@rand_party]); mes "[ Loot Distributor ]"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@i] ) + " ( Distributed Randomly )"; getitem .@rewards[.@i], 1, .@party_aid[.@rand_party]; } } // LOOT MODE 3: Give rewards randomly between all party members else if( .loot_mode == 3 ) { mes "[ Loot Distributor ]"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { // Select random party member X times. SelectRandom3: .@attempts = 0; // Counter for random player select .@rand_party = rand(.@party_size); while( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { if( .@attempts >= .loop_max ) break; .@rand_party = rand(.@party_size); .@attempts++; } // Max attempts reached if( .@attempts >= .loop_max ) { mes "[ Player not found ]"; mes "Tried to select random player " + .@attempts + " times!"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom3; } else { goto OnClose; } } // Backup online check (next; will pause script and players can disconnect) if( !isloggedin(.@party_aid[.@rand_party], .@party_cid[.@rand_party]) ) { mes "[ Player not online ]"; mes "Member is ^777777offline^000000"; mes "Do you want to try again?"; next; if( select("Yes:No") == 1 ) { goto SelectRandom3; } else { goto OnClose; } } // Give single reward .@name$ = strcharinfo(0, .@party_cid[.@rand_party]); mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@i] ) + " ( Distributed Randomly )"; getitem .@rewards[.@i], 1, .@party_aid[.@rand_party]; } } // LOOT MODE 10: Give all rewards to selected party member // LOOT MODE 11: Give one reward to selected party member else if( .loot_mode >= 10 && .loot_mode <= 11 ) { SelectMember: // Open Party Select Menu .@select = callfunc("WB_PartySelect", 1, 1); // Refresh selected while ( .@select == -1 ) { message strcharinfo(0), "Refresh menu!"; .@select = callfunc("WB_PartySelect", 1, 1); } // Not in a party (Leaved before select or removed) if ( .@select == -2 ) { message strcharinfo(0), "You don't have a party."; end; } // Is selected member online if ( !isloggedin(.@party_aid[.@select], .@party_cid[.@select]) ) { mes "[ Loot Distributor ]"; mes "Selected party member is not online."; mes "Please select again."; next; goto SelectMember; } // Get more party data .@party_name$ = getpartyname(.@party_id); // Party Name .@party_leader_cid = getpartyleader(.@party_id, 2); // Party Leader Character ID // Party Leader Name .@party_leader_name$ = "[Offline]"; if ( .@party_leader_cid != -1 ) { // strcharinfo(0,.@party_leader_cid); will fail if leader is offline! for (.@i = 0; .@i < .@party_size; .@i++ ) { // Match leader cid with party member cid if ( .@party_leader_cid == .@party_member_cid[.@i] ) { .@party_leader_name$ = .@party_member_name$[.@i]; } } } // Double check // Check for party changes, because players can leave anytime. .@party_id2 = getcharid(1); .@check_failed = false; // Not in a party anymore (Leaved after select or removed) if ( !.@party_id2 ) { message strcharinfo(0), "You don't have a party."; mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Check if party ID has changed if (.@party_id != .@party_id2) { message strcharinfo(0), "Failed: Party ID has changed!"; mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Get new party data getpartymember .@party_id2, 0; // names .@new_party_size = $@partymembercount; copyarray .@partymembername$[0], $@partymembername$[0], .@new_party_size; // Check if party size has changed during select. if (.@new_party_size != .@party_size) { message strcharinfo(0), "Failed: Party size has changed!"; mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Check if party member names has changed during select. for (.@i = 0; .@i < .@party_size; .@i++ ) { // Match new and old name if ( .@partymembername$[.@i] != .@party_member_name$[.@i] ) { .@check_failed = true; message strcharinfo(0), "Failed: Party member name has changed!"; break; } } // Has any checks failed if ( .@i >= .@party_size && .@check_failed ) { mes "[ Loot Distributor ]"; mes "Your party has made changes during selection."; mes "Please select again."; close; } // Success; Give rewards if (.loot_mode == 10) { // All rewards to selected member .@name$ = strcharinfo(0, .@party_cid[.@select]); mes "[ Loot Distributor ]"; // Loop through each reward for( .@i = 0; .@i < .@reward_size; .@i++ ) { mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@i] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@i] ) + " ( Distributed Randomly )"; getitem .@rewards[.@i], 1, .@party_aid[.@select]; } } else if (.loot_mode == 11) { // Give one random reward to selected member .@rand_item = rand(.@reward_size); .@name$ = strcharinfo(0, .@party_cid[.@select]); mes "[ Loot Distributor ]"; mes .@name$ + "^777777 ~ " + getitemname( .@rewards[.@rand_item] ) + "^000000"; message .@name$, "Gained " + getitemname( .@rewards[.@rand_item] ) + " ( Distributed Randomly )"; getitem .@rewards[.@rand_item], 1, .@party_aid[.@select]; } } } else { // Disposed loots mes "[ Loot Distributor ]"; } mes "Congratulations!"; // Remove all party members access callfunc("WB_ResetPartyAccess", .@party_id); close2; // Disable current NPC Treasure Chest callfunc("WB_ResetBox", .@event_index); end; OnClose: // Close reward window mes "[ Loot Distributor ]"; mes "Good bye."; close; } // Function: Reset all party members access IDs // callfunc("WB_ResetPartyAccess", <party id>) function script WB_ResetPartyAccess { .@party_id = getarg(0); getpartymember .@party_id, 1; // Character IDs .@party_size = $@partymembercount; copyarray .@party_cid[0], $@partymembercid[0], .@party_size; for ( .@i = 0; .@i < .@party_size; .@i++ ) { for ( .@j = 0; .@j < getarraysize($@WB_ACCESS); .@j++ ) { if ( $@WB_ACCESS[.@j] == .@party_cid[.@i] ) { deletearray $@WB_ACCESS[.@j], 1; deletearray $@WB_ACCESS_EXPIRE[.@j], 1; } } } // Remove party id /*for ( .@i = 0; .@i < getarraysize($@WB_PARTY_ID); .@i++ ) { if ( $@WB_PARTY_ID[.@i] == .@party_id ) { deletearray $@WB_PARTY_ID[.@i], 1; } }*/ return; } // Function: Reset specific WorldBoss event global arrays // callfunc("WB_ResetEventGlobals", <index>) function script WB_ResetEventGlobals { .@index = getarg(0, 0); // Event index Default=0 deletearray $@WB_MOB_ID[.@index], 1; // Rename from $@WB_ID deletearray $@WB_MOB_GID[.@index], 1; // Rename from $@WB_GID deletearray $@WB_TIMEOUT[.@index], 1; deletearray $@WB_RADAR_NEAR[.@index], 1; // Rename from $@WB_NEAR deletearray $@WB_MAP$[.@index], 1; deletearray $@WB_X[.@index], 1; deletearray $@WB_Y[.@index], 1; deletearray $@WB_REWARD_INDEX[.@index], 1; // Rename from $@WB_REWARD deletearray $@WB_PARTY_ID[.@index], 1; // Rename from $@WB_PARTY deletearray $@WB_NPC_NAME$[.@index], 1; // Rename from $@WB_BOX //deletearray $@WB_ACCESS[.@index], 1; //deletearray $@WB_ACCESS_EXPIRE[.@index], 1; deletearray $@WB_MF_PARTYLOCK[.@index], 1; deletearray $@WB_MF_NOMOBLOOT[.@index], 1; deletearray $@WB_MF_NOMVPLOOT[.@index], 1; deletearray $@WB_MF_NOPENALTY[.@index], 1; deletearray $@WB_MF_NOMOBTELE[.@index], 1; deletearray $@WB_MF_BASEEXP[.@index], 1; deletearray $@WB_MF_JOBEXP[.@index], 1; //deletearray $@WB_MF_FOG[.@index], 1; return; } // Function: Reset all WorldBoss event global arrays // callfunc("WB_ResetAllGlobals") function script WB_ResetAllGlobals { deletearray $@WB_MOB_ID[0], getarraysize($@WB_MOB_ID); deletearray $@WB_MOB_GID[0], getarraysize($@WB_MOB_GID); deletearray $@WB_TIMEOUT[0], getarraysize($@WB_TIMEOUT); deletearray $@WB_RADAR_NEAR[0], getarraysize($@WB_RADAR_NEAR); deletearray $@WB_MAP$[0], getarraysize($@WB_MAP$); deletearray $@WB_X[0], getarraysize($@WB_X); deletearray $@WB_Y[0], getarraysize($@WB_Y); deletearray $@WB_REWARD_INDEX[0], getarraysize($@WB_REWARD_INDEX); deletearray $@WB_PARTY_ID[0], getarraysize($@WB_PARTY_ID); deletearray $@WB_NPC_NAME$[0], getarraysize($@WB_NPC_NAME$); deletearray $@WB_ACCESS[0], getarraysize($@WB_ACCESS); deletearray $@WB_ACCESS_EXPIRE[0], getarraysize($@WB_ACCESS_EXPIRE); deletearray $@WB_MF_PARTYLOCK[0], getarraysize($@WB_MF_PARTYLOCK); deletearray $@WB_MF_NOMOBLOOT[0], getarraysize($@WB_MF_NOMOBLOOT); deletearray $@WB_MF_NOMVPLOOT[0], getarraysize($@WB_MF_NOMVPLOOT); deletearray $@WB_MF_NOPENALTY[0], getarraysize($@WB_MF_NOPENALTY); deletearray $@WB_MF_NOMOBTELE[0], getarraysize($@WB_MF_NOMOBTELE); deletearray $@WB_MF_BASEEXP[0], getarraysize($@WB_MF_BASEEXP); deletearray $@WB_MF_JOBEXP[0], getarraysize($@WB_MF_JOBEXP); //deletearray $@WB_MF_FOG[0], getarraysize($@WB_MF_FOG); return; } // Function: Reset all mapflags to original values // callfunc("WB_ResetMapflags", <map name>, <index>) function script WB_ResetMapflags { .@map$ = getarg(0, "null"); // Map name Default="null" .@index = getarg(1, 0); // Event index Default=0 // Map name exists if (.@map$ == "" || .@map$ == "null") { debugmes "WB_ResetMapflags was given:"+ .@map$; return; } // Party Lock if ( $@WB_MF_PARTYLOCK[.@index] ) setmapflag .@map$, MF_PARTYLOCK; else removemapflag .@map$, MF_PARTYLOCK; // No mob loot if ( $@WB_MF_NOMOBLOOT[.@index] ) setmapflag .@map$, MF_NOMOBLOOT; else removemapflag .@map$, MF_NOMOBLOOT; // No MVP loot if ( $@WB_MF_NOMVPLOOT[.@index] ) setmapflag .@map$, MF_NOMVPLOOT; else removemapflag .@map$, MF_NOMVPLOOT; // No penalty if ( $@WB_MF_NOPENALTY[.@index] ) setmapflag .@map$, MF_NOPENALTY; else removemapflag .@map$, MF_NOPENALTY; // No mob teleport if ( $@WB_MF_NOMOBTELE[.@index] ) setmapflag .@map$, MF_MONSTER_NOTELEPORT; else removemapflag .@map$, MF_MONSTER_NOTELEPORT; // Base Exp setmapflag .@map$, MF_BEXP, $@WB_MF_BASEEXP[.@index]; // Job Exp setmapflag .@map$, MF_JEXP, $@WB_MF_JOBEXP[.@index]; // Effect FOG //if ( $@WB_MF_FOG[.@index] ) // setmapflag .@map$, MF_FOG; //else // removemapflag .@map$, MF_FOG; return; } // Function: Reset specific Treasure Chest NPC // callfunc("WB_ResetBox", <index>) function script WB_ResetBox { .@index = getarg(0, 0); // Event index Default=0 if ( $@WB_NPC_NAME$[.@index] != "" ) { if ( getnpcid(0, $@WB_NPC_NAME$[.@index]) ) { // Do these checks or this will select all NPCs on the server when fail donpcevent $@WB_NPC_NAME$[.@index]+"::OnDisable"; } } } // Function: Reset all Treasure Chest NPC's // callfunc("WB_ResetAllBoxes") function script WB_ResetAllBoxes { for ( .@i = 0; .@i < getarraysize($@WB_NPC_NAME$); .@i++ ) { if ( $@WB_NPC_NAME$[.@i] != "" ) { if ( getnpcid(0, $@WB_NPC_NAME$[.@i]) ) { // Do these checks or this will select all NPCs on the server when fail donpcevent $@WB_NPC_NAME$[.@i]+"::OnDisable"; } } } } // Function Party Select // callfunc("WB_PartySelect", <INT_show_offline>, <INT_show_refresh>) // Return INT=Party index number, -1=Refresh selected, -2=Not in party function script WB_PartySelect { .@s_offline = getarg(0, 1); // Show offline players in menu? 1=Yes 0=No .@s_refresh = getarg(1, 1); // Show refresh menu item? 1=Yes 0=No .@party_id = getcharid(1); // Party ID // Not in a party if ( !.@party_id ) return -2; getpartymember .@party_id, 0; // Names getpartymember .@party_id, 1; // Character IDs getpartymember .@party_id, 2; // Account IDs // Copy the temporary party data .@party_size = $@partymembercount; copyarray .@party_member_name$[0], $@partymembername$[0], .@party_size; copyarray .@party_member_cid[0], $@partymembercid[0], .@party_size; copyarray .@party_member_aid[0], $@partymemberaid[0], .@party_size; // Create menu if ( .@s_refresh ) .@menu_party$ = "^777777[Refresh]^000000"; .@menu_party$ = .@menu_party$ + ":"; // Loop through each party member and add to menu for ( .@i = 0; .@i < .@party_size; .@i++ ) { if ( isloggedin(.@party_member_aid[.@i], .@party_member_cid[.@i]) ) { if (.@s_offline) .@menu_party$ = .@menu_party$ + .@party_member_name$[.@i] + " ^00cc36[ON]^000000"; else .@menu_party$ = .@menu_party$ + .@party_member_name$[.@i]; } else if (.@s_offline) .@menu_party$ = .@menu_party$ + .@party_member_name$[.@i] + " ^777777[OFF]^000000"; .@menu_party$ = .@menu_party$ + ":"; } // Open select menu (-2 select start from 1 and we have [Refresh] at first) .@select = select(.@menu_party$) - 2; return .@select; } // Treasure chest NPC alberta,0,0,5 script Treasure Chest#wb_0 1324,{ emotion ET_SURPRISE, getcharid(3); // Emotion on the player // Disable current NPC Treasure Chest if empty if ( !getarraysize($@WB_ACCESS) ) { message strcharinfo(0), "Treasure Chest is empty."; donpcevent strnpcinfo(0)+"::OnDisable"; // Stop access expire timer donpcevent "WorldBossAccessExpire::OnDisable"; end; } doevent "WorldBoss::OnTreasureOpen"; end; OnInit: .@name$ = strnpcinfo(0); //rid2name( .@id ); .@timer = getnpctimer(1, .@name$); getmapxy(.map$, .x, .y, UNITTYPE_NPC); disablenpc .@name$; //debugmes .@name$+"::OnInit target=" + .map$ + " NPC="+ .@name$ + " timer="+ .@timer; end; OnEnable: // if enabled getnpctimer(1, strnpcinfo(0)) will return 1 .@id = getnpcid(0); .@name$ = strnpcinfo(0); //rid2name( .@id ); .@timer = getnpctimer(1, .@name$); .@npc$ = "WorldBoss"; .@map$ = getvariableofnpc(.event_map$, .@npc$); .@x = getvariableofnpc(.event_x, .@npc$); .@y = getvariableofnpc(.event_y, .@npc$); enablenpc( .@name$ ); unitwarp( .@id, .@map$, .@x, .@y ); // Move to new position initnpctimer( .@name$ ); // Start timeout timer //debugmes .@name$+"::OnEnable target="+ .@map$ +", "+ .@x +", "+ .@y +" NPC="+ .@name$ +" timer="+ .@timer; end; // Disable Treasure NPC and clean event array OnDisable: .@id = getnpcid(0); .@name$ = strnpcinfo(0); //rid2name( .@id ); .@timer = getnpctimer(1, .@name$); getmapxy(.@event_map$, .@x, .@y, UNITTYPE_NPC); stopnpctimer( .@name$ ); // Stop timeout timer unitwarp( .@id, .map$, .x, .y ); // Return to default position disablenpc( .@name$ ); // Clean event data // Get event index from the map name array .@index = inarray($@WB_MAP$[0], .@event_map$); // Check if index was found if ( .@index == -1 ) { debugmes .@name$+"::OnDisable event map name ( "+ .@event_map$ +" ) not found!"; end; } // Remove current event from the arrays callfunc("WB_ResetEventGlobals", .@index); //debugmes .@name$+"::OnDisable target="+ .@event_map$ +", "+ .@x +", "+ .@y +" NPC="+ .@name$ +" timer="+ .@timer; end; //OnTimer30000: // 30 seconds //OnTimer120000: // 2 minutes //OnTimer300000: // 5 minutes OnTimer600000: // 10 minutes //OnTimer900000: // 15 minutes .@name$ = strnpcinfo(0); getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC); //debugmes .@name$+"::OnTimeout target="+ .@map$ +", "+ .@x +", "+ .@y +" NPC="+ .@name$; donpcevent .@name$+"::OnDisable"; end; } // Treasure Chest duplicates (Add more if you run out) // NPC Name = Treasure Chest#wb_<indexNumber> (Important!) alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_1 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_2 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_3 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_4 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_5 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_6 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_7 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_8 1324 alberta,0,0,5 duplicate(Treasure Chest#wb_0) Treasure Chest#wb_9 1324 // World Boss timeout timer - script WorldBossTimeout -1,{ end; OnEnable: initnpctimer; end; OnDisable: stopnpctimer; end; // Update every 1 minutes OnTimer60000: .@time = gettimetick(0); .@timeout = getvariableofnpc(.event_timeout, "WorldBoss"); .@mapflags = getvariableofnpc(.use_mapflags, "WorldBoss"); for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { // Unit must be alive if ( unitexists($@WB_MOB_GID[.@i]) && .@time > ($@WB_TIMEOUT[.@i] + .@timeout) ) { announce "[World Boss] World Boss in "+ $@WB_MAP$[.@i] +" has expired!", bc_all, 0xFF0000; unitkill( $@WB_MOB_GID[.@i] ); // Reset event mapflags if ( .@mapflags ) { callfunc("WB_ResetMapflags", $@WB_MAP$[.@i], .@i); } // Remove event global arrays callfunc("WB_ResetEventGlobals", .@i); } } initnpctimer; end; } // World Boss Unit's Radar // Count users around the world boss and increase it's HP by each Player nearby - script WorldBossRadar -1,{ end; OnInit: .npc_name$ = strnpcinfo(0); .radius = 15; // Cell radius .HPLevel = 1500000; // HP increase per player .MinHP = .HPLevel * 2; // Minimum HP when to stop decreasing HP end; OnEnable: initnpctimer; end; OnDisable: stopnpctimer; end; // Every 10 secods update all World Boss unit data OnTimer10000: for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { .@unit_gid = $@WB_MOB_GID[.@i]; if ( unitexists(.@unit_gid) ) { getunitdata(.@unit_gid, .@udata); .@hp = .@udata[UMOB_HP]; .@maxhp = .@udata[UMOB_MAXHP]; .@x = .@udata[UMOB_X]; .@y = .@udata[UMOB_Y]; .@users = getareausers(mapid2name(.@udata[UMOB_MAPID]), (.@x - .radius), (.@y - .radius), (.@x + .radius), (.@y + .radius)); if ( .@users > $@WB_RADAR_NEAR[.@i] ) { // Increase HP per each player nearby .@new_hp = .@hp + ( .HPLevel * .@users ); // Stop increasing HP after maximum has been reached if ( .@new_hp < .@maxhp ) { setunitdata .@unit_gid, UMOB_HP, .@new_hp; unittalk .@unit_gid, rid2name(.@unit_gid) + " : Mortals has entered my sight!", bc_area; } } else if ( .@users < $@WB_RADAR_NEAR[.@i] ) { // Decrease HP per each player nearby .@new_hp = .@hp - .HPLevel; // Stop decreasing HP after minimum has been reached if ( .@new_hp > .MinHP ) { setunitdata .@unit_gid, UMOB_HP, .@new_hp; unittalk .@unit_gid, rid2name(.@unit_gid) + " : Mortals has left my sight!", bc_area; } } // Update users count setarray $@WB_RADAR_NEAR[.@i], .@users; } } initnpctimer; end; } // World Boss access expire timer // This will clean event access array from getting too big in time. - script WorldBossAccessExpire -1,{ end; OnEnable: //debugmes strnpcinfo(0)+"::OnEnable"; initnpctimer; end; OnDisable: //debugmes strnpcinfo(0)+"::OnDisable"; stopnpctimer; end; // Update every 5 minutes OnTimer300000: //debugmes strnpcinfo(0)+"::OnTimer"; .@time = gettimetick(0); .@expires = getvariableofnpc(.event_access_expire, "WorldBoss"); for ( .@i = 0; .@i < getarraysize($@WB_ACCESS); .@i++ ) { // Check if access has expired if ( .@time > ($@WB_ACCESS_EXPIRE[.@i] + .@expires) ) { // Current access has expired! Remove access and expire time. deletearray $@WB_ACCESS[.@i], 1; deletearray $@WB_ACCESS_EXPIRE[.@i], 1; } } // Continue timer if access is not empty if ( getarraysize($@WB_ACCESS) ) { initnpctimer; } end; } // World Boss Floating Rates - script WorldBossRates -1,{ OnInit: // Will fire before OnInterIfInitOnce on server start // Floating rates are enabled if(!getvariableofnpc(.use_floating_rates, "WorldBoss")) end; // Reset rates on script load if ( $wb_base_exp_rate && getBattleFlag("base_exp_rate") != $wb_base_exp_rate ) donpcevent strnpcinfo(0)+"::OnDisable"; end; OnInterIfInitOnce: // Will fire after OnInit on server start // Floating rates are enabled if(!getvariableofnpc(.use_floating_rates, "WorldBoss")) end; // Set once on server start $wb_battle_flags = 0; // Set servers default battle flags $wb_base_exp_rate = getBattleFlag("base_exp_rate"); $wb_job_exp_rate = getBattleFlag("job_exp_rate"); $wb_item_rate_common = getBattleFlag("item_rate_common"); $wb_item_rate_common_boss = getBattleFlag("item_rate_common_boss"); $wb_item_rate_common_mvp = getBattleFlag("item_rate_common_mvp"); $wb_item_rate_heal = getBattleFlag("item_rate_heal"); $wb_item_rate_heal_boss = getBattleFlag("item_rate_heal_boss"); $wb_item_rate_heal_mvp = getBattleFlag("item_rate_heal_mvp"); $wb_item_rate_use = getBattleFlag("item_rate_use"); $wb_item_rate_use_boss = getBattleFlag("item_rate_use_boss"); $wb_item_rate_use_mvp = getBattleFlag("item_rate_use_mvp"); $wb_item_rate_equip = getBattleFlag("item_rate_equip"); $wb_item_rate_equip_boss = getBattleFlag("item_rate_equip_boss"); $wb_item_rate_equip_mvp = getBattleFlag("item_rate_equip_mvp"); $wb_item_rate_card = getBattleFlag("item_rate_card"); $wb_item_rate_card_boss = getBattleFlag("item_rate_card_boss"); $wb_item_rate_card_mvp = getBattleFlag("item_rate_card_mvp"); $wb_item_rate_mvp = getBattleFlag("item_rate_mvp"); $wb_item_rate_adddrop = getBattleFlag("item_rate_adddrop"); $wb_item_rate_treasure = getBattleFlag("item_rate_treasure"); end; OnDisable: // Reset normal rates if ( $wb_battle_flags ) { setBattleFlag("base_exp_rate", $wb_base_exp_rate); setBattleFlag("job_exp_rate", $wb_job_exp_rate); setBattleFlag("item_rate_common", $wb_item_rate_common); setBattleFlag("item_rate_common_boss", $wb_item_rate_common_boss); setBattleFlag("item_rate_common_mvp", $wb_item_rate_common_mvp); setBattleFlag("item_rate_heal", $wb_item_rate_heal); setBattleFlag("item_rate_heal_boss", $wb_item_rate_heal_boss); setBattleFlag("item_rate_heal_mvp", $wb_item_rate_heal_mvp); setBattleFlag("item_rate_use", $wb_item_rate_use); setBattleFlag("item_rate_use_boss", $wb_item_rate_use_boss); setBattleFlag("item_rate_use_mvp", $wb_item_rate_use_mvp); setBattleFlag("item_rate_equip", $wb_item_rate_equip); setBattleFlag("item_rate_equip_boss", $wb_item_rate_equip_boss); setBattleFlag("item_rate_equip_mvp", $wb_item_rate_equip_mvp); setBattleFlag("item_rate_card", $wb_item_rate_card); setBattleFlag("item_rate_card_boss", $wb_item_rate_card_boss); setBattleFlag("item_rate_card_mvp", $wb_item_rate_card_mvp); setBattleFlag("item_rate_mvp", $wb_item_rate_mvp); setBattleFlag("item_rate_adddrop", $wb_item_rate_adddrop); setBattleFlag("item_rate_treasure", $wb_item_rate_treasure); } $wb_battle_flags = 0; stopnpctimer; end; OnEnable: // Check already enabled if ( !$wb_battle_flags ) { // Double server ratings setBattleFlag("base_exp_rate", $wb_base_exp_rate * 2); setBattleFlag("job_exp_rate", $wb_job_exp_rate * 2); setBattleFlag("item_rate_common", $wb_item_rate_common * 2); setBattleFlag("item_rate_common_boss", $wb_item_rate_common_boss * 2); setBattleFlag("item_rate_common_mvp", $wb_item_rate_common_mvp * 2); setBattleFlag("item_rate_heal", $wb_item_rate_heal * 2); setBattleFlag("item_rate_heal_boss", $wb_item_rate_heal_boss * 2); setBattleFlag("item_rate_heal_mvp", $wb_item_rate_heal_mvp * 2); setBattleFlag("item_rate_use", $wb_item_rate_use * 2); setBattleFlag("item_rate_use_boss", $wb_item_rate_use_boss * 2); setBattleFlag("item_rate_use_mvp", $wb_item_rate_use_mvp * 2); setBattleFlag("item_rate_equip", $wb_item_rate_equip * 2); setBattleFlag("item_rate_equip_boss", $wb_item_rate_equip_boss * 2); setBattleFlag("item_rate_equip_mvp", $wb_item_rate_equip_mvp * 2); setBattleFlag("item_rate_card", $wb_item_rate_card * 2); setBattleFlag("item_rate_card_boss", $wb_item_rate_card_boss * 2); setBattleFlag("item_rate_card_mvp", $wb_item_rate_card_mvp * 2); setBattleFlag("item_rate_mvp", $wb_item_rate_mvp * 2); setBattleFlag("item_rate_adddrop", $wb_item_rate_adddrop * 2); setBattleFlag("item_rate_treasure", $wb_item_rate_treasure * 2); } announce "[World Boss] Experience and Drop rates has been doubled for one hour! Enjoy!", bc_all, 0x00FF00; $wb_battle_flags = 1; initnpctimer; end; OnTimer3600000: // 1 hour donpcevent strnpcinfo(0)+"::OnDisable"; end; } // NPC World Boss Information prontera,147,174,4 script World Boss#info 495,5,5,{ mes "[ " + strnpcinfo(1) + " ]"; mes "About the world bosses."; if ( getarraysize($@WB_MOB_GID) ) { .@time = gettimetick(0); .@timeout = getvariableofnpc(.event_timeout, "WorldBoss"); mes "Status: ^00CC36Active^000000"; for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { .@timeleft = ($@WB_TIMEOUT[.@i] + .@timeout) - .@time; mes (.@i + 1) + ". Location : " + $@WB_MAP$[.@i]; mes " ^777777 Time Left :^000000 " + (.@timeleft / 60000) + " min."; } mes "Good luck!"; } else { mes "Status: ^CC3300Inactive^000000"; mes "Event timetable:"; mes "^777777 ~ 04:02 ^000000"; mes "^777777 ~ 23:59 ^000000"; mes "Wait until the event starts."; } // GM level 60+ has access to menu if( getgmlevel() >= 60 ) { next; switch( select("Information:Start Event:Skip Start Timer:Stop Event:Change Loot Mode:Change Unit Data:Map Flags:Leave") ) { case 1: callsub S_Info; break; case 2: callsub S_Start; break; case 3: callsub S_Skip; break; case 4: callsub S_Stop; break; case 5: callsub S_Loot; break; case 6: callsub S_Unit; break; case 7: callsub S_Mapflags; break; default: break; } } close; S_Info: // Set variables .@enabled = getarraysize($@WB_MOB_GID); .@loot_mode = getvariableofnpc(.loot_mode, .event_npc$); .@time = gettimetick(0); .@timeout = getvariableofnpc(.event_timeout, "WorldBoss"); mes "[ " + strnpcinfo(1) + " ]"; mes "^777777Status: ^000000" + (.@enabled ? "^00CC36Active^000000" : "^CC3300Inactive^000000"); mes "^777777Loot mode: ^000000" + .event_loot_modes$[.@loot_mode]; .@menu$ = "Leave:"; for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { if ( $@WB_MOB_GID[.@i] || $@WB_NPC_NAME$[.@i] != "" ) { // Monster Unit .@timeleft = ($@WB_TIMEOUT[.@i] + .@timeout) - .@time; // ms // Get unit data if ( unitexists($@WB_MOB_GID[.@i]) ) { // Monster unit getunitdata($@WB_MOB_GID[.@i], .@udata); mes (.@i + 1) +". Monster: " + $@WB_MOB_ID[.@i] +" / "+ getmonsterinfo($@WB_MOB_ID[.@i], 0); mes " ^777777 GID: ^000000" + $@WB_MOB_GID[.@i]; mes " ^777777 Name: ^000000" + rid2name($@WB_MOB_GID[.@i]); mes " ^777777 HP: ^000000" + .@udata[UMOB_HP] + " / " + .@udata[UMOB_MAXHP]; mes " ^777777 Location: ^000000" + mapid2name(.@udata[UMOB_MAPID]) + " ^777777 x ^000000" + .@udata[UMOB_X] + " ^777777 y ^000000" + .@udata[UMOB_Y]; mes " ^777777 Time Left :^000000 " + (.@timeleft / 60000) + " min."; } else if (unitexists(getnpcid(0, $@WB_NPC_NAME$[.@i]))) { // NPC unit getunitdata(getnpcid(0, $@WB_NPC_NAME$[.@i]), .@udata); mes (.@i + 1) +". Treasure Chest"; mes " ^777777 GID: ^000000" + getnpcid(0, $@WB_NPC_NAME$[.@i]); mes " ^777777 Name: ^000000" + $@WB_NPC_NAME$[.@i]; mes " ^777777 Location: ^000000" + mapid2name(.@udata[UNPC_MAPID]) + " ^777777 x ^000000" + .@udata[UNPC_X] + " ^777777 y ^000000" + .@udata[UNPC_Y]; } mes "^777777-------^000000"; .@menu$ += "Go to "+$@WB_MAP$[.@i]; } .@menu$ += ":"; } .@selected = select(.@menu$) - 2; if ( .@selected >= 0 ) { if ( unitexists($@WB_MOB_GID[.@selected]) ) { // Warp to the monster location getunitdata($@WB_MOB_GID[.@selected], .@data); warp mapid2name(.@data[UMOB_MAPID]), .@data[UMOB_X], .@data[UMOB_Y]; } else if ( $@WB_NPC_NAME$[.@selected] != "" ) { // Warp to the NPC location if (unitexists(getnpcid(0, $@WB_NPC_NAME$[.@selected]))) { getunitdata(getnpcid(0, $@WB_NPC_NAME$[.@selected]), .@data); warp mapid2name(.@data[UNPC_MAPID]), .@data[UNPC_X], .@data[UNPC_Y]; } } end; } return; S_Mapflags: mes "[ " + strnpcinfo(1) + " ] Mapflags"; .@size = getarraysize($@WB_MOB_GID); .@mapflags = getvariableofnpc(.use_mapflags, "WorldBoss"); if ( .@mapflags && .@size ) { for ( .@i = 0; .@i < .@size; .@i++ ) { .@map$ = $@WB_MAP$[.@i]; mes .@map$ + " : Original Flags"; mes " ^777777 PartyLock : " + $@WB_MF_PARTYLOCK[.@i] + "^000000"; mes " ^777777 NoMobLoot : " + $@WB_MF_NOMOBLOOT[.@i] + "^000000"; mes " ^777777 NoMVPLoot : " + $@WB_MF_NOMVPLOOT[.@i] + "^000000"; mes " ^777777 NoPenalty : " + $@WB_MF_NOPENALTY[.@i] + "^000000"; mes " ^777777 NoMobTele : " + $@WB_MF_NOMOBTELE[.@i] + "^000000"; mes " ^777777 BaseExp : " + $@WB_MF_BASEEXP[.@i] + "^000000"; mes " ^777777 JobExp : " + $@WB_MF_JOBEXP[.@i] + "^000000"; //mes " ^777777 Fog : " + $@WB_MF_FOG[.@i] + "^000000"; mes .@map$ + " : New Flags"; mes " ^777777 PartyLock : " + getmapflag(.@map$, MF_PARTYLOCK) + "^000000"; mes " ^777777 NoMobLoot : " + getmapflag(.@map$, MF_NOMOBLOOT) + "^000000"; mes " ^777777 NoMVPLoot : " + getmapflag(.@map$, MF_NOMVPLOOT) + "^000000"; mes " ^777777 NoPenalty : " + getmapflag(.@map$, MF_NOPENALTY) + "^000000"; mes " ^777777 NoMobTele : " + getmapflag(.@map$, MF_MONSTER_NOTELEPORT) + "^000000"; mes " ^777777 BaseExp : " + getmapflag(.@map$, MF_BEXP) + "^000000"; mes " ^777777 JobExp : " + getmapflag(.@map$, MF_JEXP) + "^000000"; //mes " ^777777 Fog : " + getmapflag(.@map$, MF_FOG) + "^000000"; mes "^777777-------^000000"; } } else { mes "No mapflags has been set."; } return; S_Start: donpcevent .event_npc$ + "::OnEnable"; message strcharinfo(0), "Event has been started!"; return; S_Skip: awake .event_npc$; // Cancels any running sleep timers on the NPC message strcharinfo(0), "Event timer has been skipped!"; return; S_Stop: awake .event_npc$; // Cancels any running sleep timers on the NPC donpcevent .event_npc$ + "::OnDisable"; // Announce event stopped announce "[World Boss] The event has been stopped!", bc_all, 0xFF0000; message strcharinfo(0), "Event has been stopped!"; return; S_Loot: .@size = getarraysize(.event_loot_modes$); for( .@i = 0; .@i < .@size; .@i++ ) { message strcharinfo(0), "Loot mode "+ .@i +" : " + .event_loot_modes$[.@i]; } // Change event loot mode option input .@input, 0, .@size; set getvariableofnpc(.loot_mode, .event_npc$), .@input; message strcharinfo(0), "Event loot mode changed: " + .event_loot_modes$[.@input]; return; S_Unit: // Create menu .@menu$ = "Leave:"; for ( .@i = 0; .@i < getarraysize($@WB_MOB_GID); .@i++ ) { if ( unitexists($@WB_MOB_GID[.@i]) ) { .@menu$ += $@WB_MAP$[.@i] +" - "+ getmonsterinfo($@WB_MOB_ID[.@i], 0); } .@menu$ += ":"; } .@selected = select(.@menu$) - 2; // Change unit data (HP,Level,Atk,Etc.) if ( .@selected >= 0 ) { mes "[ " + strnpcinfo(1) + " ]"; getunitdata($@WB_MOB_GID[.@selected], .@udata); for (.@i = 0; .@i < getarraysize(.@udata); .@i++ ) { mes .UMOB$[.@i] + " = " + .@udata[.@i]; } .@select = select(.UMOB_menu$) - 1; message strcharinfo(0), "Write a new unit ( " + .UMOB$[.@select] + " ) value."; input .@val, 0, 1000000000; setunitdata($@WB_MOB_GID[.@selected], .@select, .@val); // Confim data has changed getunitdata($@WB_MOB_GID[.@selected], .@confirm_udata); message strcharinfo(0), "New unit data is: " + .@confirm_udata[.@select]; } return; OnInit: // Event NPC name .event_npc$ = "WorldBoss"; // Event loot mode descriptions // Copy array from other NPC copyarray .event_loot_modes$[0], getelementofarray(getvariableofnpc(.loot_mode_desc$, .event_npc$),0), getarraysize(getvariableofnpc(.loot_mode_desc$, .event_npc$)); // Unit data attibute names setarray .UMOB$[0], "Size","Level","Hp","Max Hp", "Master AID","Map ID","Map X","Map Y", "Speed","Mode","Ai","Scoption", "Sex","Class","Hair style","Hair color", "Head bottom","Head middle","Head top","Cloth color", "Shield","Weapon","Look dir","Can move tick", "Str","Agi","Vit","Int", "Dex","Luk","Slave cpymstrmd","Dmg immune", "Atk range","Atk min","Atk max","Matk min", "Matk max","Def","Mdef","Hit", "Flee","Pdodge","Crit","Race", "Ele type","Ele level","A-motion","A-delay", "D-motion"; // Unit data menu string .UMOB_menu$ = implode(.UMOB$, ":"); // Set NPC size if class_id supports .@npc_class = rand(495, 498); .@npc_size = rand(0, 2); // 0=normal, 1=small, 2=big setnpcdisplay(strnpcinfo(0), strnpcinfo(1), .@npc_class, .@npc_size); end; OnTouch: // Player attached end; OnTouchNPC: // Monster attached .@UNIT_GID = getattachedrid(); //.@UNIT_NAME$ = rid2name(.@UNIT_GID); //debugmes "Target unit name:" + .@UNIT_NAME$; // Get unit data as Array getunitdata(.@UNIT_GID, .@data); .@MASTER_AID = .@data[UMOB_MASTERAID]; // UMOB_MASTERAID=4 // Unit has a master if ( .@MASTER_AID ) { .@MASTER_NAME$ = rid2name(.@MASTER_AID); .@online = isloggedin(.@MASTER_AID); if ( .@online ) { end; // Do not target players unit } } // NPC emotion emotion ET_KEK; // Warp monsters away from the NPC unitwarp 0, "this", -1, -1; end; } Can you tell me how resolve that ^^ thx for your repply.
  10. Hi rathena,I do not know if the post is in the right places (sorry if it's not good). i have try Endless Tower but have a gravity error Quest when i started =s can you tell me how resolve that plz ? Thx for your repply ^^
  11. Hi rathena, can you help me for resolve my problem's with this ^^ //===== rAthena Script ======================================= //= Hunting Missions //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.3 //===== Compatible With: ===================================== //= rAthena SVN //===== Description: ========================================= //= Random hunting missions. //= Rewards are based on quest difficulty. //============================================================ prontera,168,162,3 script Hunting Missions 619,{ function Chk; function Cm; mes "[Hunting Missions]"; mes "Hello, "+strcharinfo(0)+"!"; if (!#Mission_Delay) { next; mes "[Hunting Missions]"; mes "I can't find any records..."; mes "You must be new here!"; emotion ET_HUK; next; callsub Mission_Info; emotion ET_GO; set #Mission_Delay,1; close; } mes rand(2)?"Working hard, as always...":"Not slacking, I hope..."; mes "Is there anything I can help"; mes "you with?"; mes " "; mes "^777777~ You've completed ^0055FF"+Mission_Total+"^777777 mission"+((Mission_Total == 1)?"":"s")+". ~^000000"; next; switch(select(((!Mission0)?" ~ New Mission::":": ~ Mission Status: ~ Abandon Mission")+": ~ Information: ~ Mission Shop: ~ View Top Hunters: ~ ^777777Cancel^000000")) { case 1: mes "[Hunting Missions]"; if (#Mission_Count) { mes "You've started a mission"; mes "on another character."; close; } if (#Mission_Delay > gettimetick(2) && .Delay) { set .@i, #Mission_Delay-gettimetick(2); if (.@i > 3600) set .@j$, (.@i/3600)+" hour"+(((.@i/3600) == 1)?"":"s"); else if (.@i > 60) set .@j$, (.@i/60)+" minute"+(((.@i/60) == 1)?"":"s"); else set .@j$, (.@i)+" second"+((.@i == 1)?"":"s"); mes "I'm afraid you'll have to wait "+.@j$+" before taking another mission."; close; } mes "You must hunt:"; query_sql("SELECT ID FROM `mob_db` WHERE left(Sprite, 4) != 'meta' AND left(Sprite, 2) != 'E_' AND ~Mode & 32 AND EXP > 0 AND MVP1id = 0 AND DropCardid > 4000 AND DropCardid < 5000 AND ID < 2000 AND instr('"+.Blacklist$+"',ID) = 0 ORDER BY rand() LIMIT "+.Quests, .@mob); for (set .@i,0; .@i<.Quests; set .@i,.@i+1) { setd "Mission"+.@i, .@mob[.@i]; setd "Mission"+.@i +"_",0; } set #Mission_Count, rand(.Count[0],.Count[1]); callsub Mission_Status; next; mes "[Hunting Missions]"; mes "Report back when"; mes "you've finished."; mes "Good luck!"; close; case 2: mes "[Hunting Missions]"; mes "Mission status:"; callsub Mission_Status; close; case 3: mes "[Hunting Missions]"; mes "Do you really want to"; mes "abandon your mission?"; if (.Delay) mes "Your delay time will not be reset."; next; switch(select(" ~ Abandon...: ~ ^777777Cancel^000000")) { case 1: mes "[Hunting Missions]"; mes "Alright, I've dropped"; mes "your current mission."; specialeffect2 EF_STORMKICK4; for(set .@i,0; .@i<.Quests; set .@i,.@i+1) { setd "Mission"+.@i,0; setd "Mission"+.@i+"_",0; } set #Mission_Count,0; if (.Delay) set #Mission_Delay, gettimetick(2)+(.Delay*3600); close; case 2: mes "[Hunting Missions]"; mes "I knew you were kidding!"; mes "Keep up the good work."; emotion ET_SMILE; close; } case 4: callsub Mission_Info; close; case 5: mes "[Hunting Missions]"; mes "You have ^0055FF"+#Mission_Points+"^000000 Mission Points."; mes "Use them well!"; callshop "mission_shop",1; npcshopattach "mission_shop"; end; case 6: mes "[Hunting Missions]"; mes "The top hunters are:"; query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `global_reg_value` WHERE str = 'Mission_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5",.@id,.@name$,.@val); for(set .@i,0; .@i<5; set .@i,.@i+1) mes " [Rank "+(.@i+1)+"] "+((.@name$[.@i] == "")?"^777777none":"^0055FF"+.@name$[.@i]+"^000000 : ^FF0000"+.@val[.@i]+" pt.")+"^000000"; close; case 7: mes "[Hunting Missions]"; mes "Nothing? Okay..."; emotion ET_SCRATCH; close; } Mission_Status: set @f,0; deletearray .@j[0], getarraysize(.@j); for(set .@i,0; .@i<.Quests; set .@i,.@i+1) { set .@j[.@i], getd("Mission"+.@i); set .@j[.Quests], .@j[.Quests]+strmobinfo(3,.@j[.@i]); set .@j[.Quests+1], .@j[.Quests+1]+(strmobinfo(6,.@j[.@i])/(getbattleflag("base_exp_rate")/100)*.Modifier[0]); set .@j[.Quests+2], .@j[.Quests+2]+(strmobinfo(7,.@j[.@i])/(getbattleflag("job_exp_rate")/100)*.Modifier[1]); mes " > "+Chk(getd("Mission"+.@i+"_"),#Mission_Count)+strmobinfo(1,.@j[.@i])+" ("+getd("Mission"+.@i+"_")+"/"+#Mission_Count+")^000000"; } // Reward formulas: set .@Mission_Points, 3+(.@j[.Quests]/.Quests/6); set .@Base_Exp, #Mission_Count*.@j[.Quests+1]/5; set .@Job_Exp, #Mission_Count*.@j[.Quests+2]/5; set .@Zeny, #Mission_Count*.Quests*.@j[.@i]*.Modifier[2]; next; mes "[Hunting Missions]"; mes "Mission rewards:"; mes " > Mission Points: ^0055FF"+.@Mission_Points+"^000000"; mes " > Base Experience: ^0055FF"+Cm(.@Base_Exp)+"^000000"; mes " > Job Experience: ^0055FF"+Cm(.@Job_Exp)+"^000000"; mes " > Zeny: ^0055FF"+Cm(.@Zeny)+"^000000"; if (@f) { set @f,0; return; } next; mes "[Hunting Missions]"; mes "Oh, you're done!"; mes "Good work."; mes "Here's your reward."; emotion ET_BEST; specialeffect2 EF_ANGEL; specialeffect2 EF_TRUESIGHT; set #Mission_Points, #Mission_Points+.@Mission_Points; set BaseExp, BaseExp+.@Base_Exp; set JobExp, JobExp+.@Job_Exp; set Zeny, Zeny+.@Zeny; for(set .@i,0; .@i<.Quests; set .@i,.@i+1) { setd "Mission"+.@i,0; setd "Mission"+.@i+"_",0; } set #Mission_Count,0; if (.Delay) set #Mission_Delay, gettimetick(2)+(.Delay*3600); set Mission_Total, Mission_Total+1; if (Mission_Total == 1) query_sql("INSERT INTO `global_reg_value` (`char_id`,`str`,`value`,`type`,`account_id`) VALUES ("+getcharid(0)+",'Mission_Total','1',3,0)"); else query_sql("UPDATE `global_reg_value` SET `value` = "+Mission_Total+" WHERE char_id = "+getcharid(0)+" AND `str` = 'Mission_Total'"); close; Mission_Info: mes "[Hunting Missions]"; mes "If you so choose, I can assign"; mes "you a random hunting quest."; mes "Some are easier than others, but"; mes "the rewards increase with difficulty."; next; mes "[Hunting Missions]"; mes "Missions points are shared"; mes "amongst all your characters."; if (.Delay) mes "Delay time is, too."; mes "You can't take missions on"; mes "multiple characters at once."; next; mes "[Hunting Missions]"; mes "You can start a quest"; if (.Delay) mes "every "+((.Delay == 1)?"hour.":.Delay+" hours."); else mes "whenever you want."; mes "That's everything~"; return; function Chk { if (getarg(0) < getarg(1)) { set @f,1; return "^FF0000"; } else return "^00FF00"; } function Cm { set .@str$, getarg(0); for(set .@i,getstrlen(.@str$)-3; .@i>0; set .@i,.@i-3) set .@str$, insertchar(.@str$,",",.@i); return .@str$; } OnBuyItem: set @cost,0; for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) for(set .@j,0; .@j<getarraysize(.Shop); set .@j,.@j+2) if (@bought_nameid[.@i] == .Shop[.@j]) { set @cost, @cost+(.Shop[.@j+1]*@bought_quantity[.@i]); break; } mes "[Hunting Missions]"; if (@cost > #Mission_Points) mes "You don't have enough Mission Points."; else { for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) { getitem @bought_nameid[.@i], @bought_quantity[.@i]; dispbottom "Purchased "+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+"."; } set #Mission_Points, #Mission_Points-@cost; mes "Deal completed."; emotion ET_MONEY; } set @cost,0; deletearray @bought_nameid[0], getarraysize(@bought_nameid); deletearray @bought_quantity[0], getarraysize(@bought_quantity); close; OnNPCKillEvent: if (!getcharid(1) || !.Party) { if (!#Mission_Count || !Mission0) end; for (set .@i, 0; .@i<.Quests; set .@i,.@i+1) { if (strmobinfo(1,killedrid) == strmobinfo(1,getd("Mission"+.@i))) { if (getd("Mission"+.@i+"_") < #Mission_Count) { dispbottom "[Hunting Mission] Killed "+(set(getd("Mission"+.@i+"_"),getd("Mission"+.@i+"_")+1))+" of "+#Mission_Count+" "+strmobinfo(1,killedrid)+"."; end; } } } } else if (.Party) { set .@mob, killedrid; getmapxy(.@map1$,.@x1,.@y1,0); getpartymember getcharid(1),1; getpartymember getcharid(1),2; for(set .@i,0; .@i<$@partymembercount; set .@i,.@i+1) { if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i])) { attachrid $@partymemberaid[.@i]; if (#Mission_Count && Mission0 && HP > 0) { getmapxy(.@map2$,.@x2,.@y2,0); if ((.@map1$ == .@map2$ || .Party == 1) && (distance(.@x1,.@y1,.@x2,.@y2) <= 30 || .Party < 3)) { for(set .@j,0; .@j<.Quests; set .@j,.@j+1) { if (strmobinfo(1,.@mob) == strmobinfo(1,getd("Mission"+.@j))) { if (getd("Mission"+.@j+"_") < #Mission_Count) { dispbottom "[Hunting Mission] Killed "+(set(getd("Mission"+.@j+"_"),getd("Mission"+.@j+"_")+1))+" of "+#Mission_Count+" "+strmobinfo(1,.@mob)+"."; break; } } } } } } } } end; OnInit: set .Delay,12; // Quest delay, in hours (0 to disable). set .Quests,4; // Number of subquests per mission (increases rewards). set .Party,3; // Party options: 0 (exclude party kills), 1 (include party kills), 2 (same map only), 3 (screen area only) setarray .Count[0], // Min and max monsters per subquest (increases rewards). 40,70; setarray .Modifier[0], // Multipliers for Base Exp, Job Exp, and Zeny rewards. getbattleflag("base_exp_rate")/100,getbattleflag("job_exp_rate")/100,60; setarray .Shop[0], // Reward items: <ID>,<point cost> (about 10~20 points per h538 20500,500,20727,500,20763,300,20507,300,20504,500,20764,500,20762,500,20761,500,20737,500,20502,500,20746,500,20510,500,40031,500; set .Blacklist$, // Blacklisted mob IDs. "1062,1088,1183,1186,1200,1212,1220,1221,1234,1235,"+ "1244,1245,1250,1268,1290,1293,1294,1296,1298,1299,"+ "1300,1301,1303,1304,1305,1306,1308,1309,1311,1313,"+ "1515,1588,1618,1676,1677,1678,1679,1796,1797,1974,"+ "1975,1976,1977,1978,1979"; npcshopdelitem "mission_shop",512; for(set .@i,0; .@i<getarraysize(.Shop); set .@i,.@i+2) npcshopadditem "mission_shop", .Shop[.@i], .Shop[.@i+1]; end; } - shop mission_shop -1,20500:500,20727:500,20763:300,20507:300,20504:500,20764:500,20762:500,20761:500,20737:500,20502:500,20746:500,20510:500,40031:500 Thx for your repply . ?
  12. yes but if i put iteminfo in data/ , when i want change custom or item with my patcher its work no?
  13. Hi rathena, I would like to know if it is possible to put ItemInfo.lua in my grf because if I want to add the custom in the future my patcher up just my .grf no? if it's possible I need to change something? to share my iteminfo in my grf? thx for your repply^^
  14. Hi rathena, I would like the system to calculate Pre-renewal on my server Renewal but have looked many topic on this forum but nothing working. i would like 150 agi= 190aspd , 150dex= no-cast. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL // For more information, see LICENCE in the main folder #ifndef _CONFIG_RENEWAL_HPP_ #define _CONFIG_RENEWAL_HPP_ //quick option to disable all renewal option, used by ./configure #define PRERE #ifndef PRERE /** * rAthena configuration file (http://rathena.org) * For detailed guidance on these check http://rathena.org/wiki/SRC/config/ **/ /** * @INFO: This file holds general-purpose renewal settings, for class-specific ones check /src/config/classes folder **/ /// Game renewal server mode /// (disable by commenting the line) /// /// Leave this line to enable renewal specific support such as renewal formulas #define RENEWAL /// Renewal cast time /// (disable by commenting the line) /// /// Leave this line to enable renewal casting time algorithms and enable fixed cast bonuses. /// See also default_fixed_castrate in conf/battle/skill.conf for default fixed cast time (default is 20%). /// Cast time is altered be 2 portion, Variable Cast Time (VCT) and Fixed Cast Time (FCT). /// By default FCT is 20% of VCT (some skills aren't) /// - VCT is decreased by DEX * 2 + INT. /// - FCT is NOT reduced by stats, reduced by equips or buffs. /// Example: /// On a skill whos cast time is 10s, only 8s may be reduced. the other 2s are part of a FCT //#define RENEWAL_CAST /// Renewal drop rate algorithms /// (disable by commenting the line) /// /// Leave this line to enable renewal item drop rate algorithms /// While enabled a special modified based on the difference between the player and monster level is applied /// Based on the http://irowiki.org/wiki/Drop_System#Level_Factor table #define RENEWAL_DROP /// Renewal exp rate algorithms /// (disable by commenting the line) /// /// Leave this line to enable renewal item exp rate algorithms /// While enabled a special modified based on the difference between the player and monster level is applied #define RENEWAL_EXP /// Renewal level modifier on damage /// (disable by commenting the line) /// // Leave this line to enable renewal base level modifier on skill damage (selected skills only) #define RENEWAL_LVDMG /// Renewal ASPD [malufett] /// (disable by commenting the line) /// /// Leave this line to enable renewal ASPD /// - shield penalty is applied /// - AGI has a greater factor in ASPD increase /// - there is a change in how skills/items give ASPD /// - some skill/item ASPD bonuses won't stack //#define RENEWAL_ASPD /// Renewal stat calculations /// (disable by commenting the line) /// /// Leave this line to enable renewal calculation for increasing status/parameter points //#define RENEWAL_STAT #endif #endif // _CONFIG_RENEWAL_HPP_ can you help me for solved my problem's ... thanks for your repply. ^^
  15. thx for your repply ^^ //===== rAthena Script ======================================= //= Job Master //===== Description: ========================================= //= A fully functional job changer. //===== Additional Comments: ================================= //= 1.0 Initial script. [Euphy] //= 1.1 Fixed reset on Baby job change. //= 1.2 Added Expanded Super Novice support and initial Kagerou/Oboro support. //= 1.3 Kagerou/Oboro added. //= 1.4 Rebellion added. //= 1.5 Added option to disable RebirthClass. [mazvi] //= 1.6 Added option to get job related equipment on change. [Braniff] //= 1.7 Readability changes. Also added BabyExpanded and BabySummoner classes. [Jey] //= 1.8 Added option to disable Baby Novice Only but Baby Class can be Enabled [mazvi] //= 1.9 Migrate/Integrate to Global Functions Platinum Skills. [mazvi] //============================================================ prontera,152,190,6 script Job Master 618,{ function Get_Job_Equip; // Checks if the Player has the required level. // closes if not, returns if yes function Require_Level { if (BaseLevel < getarg(0) || JobLevel < getarg(1)) { .@blvl = getarg(0) - BaseLevel; .@jlvl = getarg(1) - JobLevel; mes "Level requirement:"; mes ((getarg(0)>1)? "^bb0000"+getarg(0)+"^000000 (^bb0000Base^000000) / ":"")+"^00bb00"+ getarg(1)+"^000000 (^00bb00Job^000000)"; mes "You need " + ((.@blvl > 0) ? "^bb0000"+.@blvl+"^000000 more base levels " + ((.@jlvl > 0) ? "and " : "") : "") + ((.@jlvl > 0) ? "^00bb00"+.@jlvl+"^000000 more job levels " : "") + "to continue."; close; } return; } // Checks if the given eac is a baby class function Is_Baby { return ((getarg(0, eaclass())&EAJL_BABY)>0); } // Checks if the player can change to third class. // Note: This does not include the level checks. function Can_Change_Third { // To change to third class you either need to be: // * Second Class // * Transcendent Second Class // * Baby Second Class if( !.ThirdClass ) return false; // Third job change disabled if( !(eaclass()&EAJL_2) ) return false; // Not second Class if( eaclass()&EAJL_THIRD ) return false; // Already Third Class if( roclass(eaclass()|EAJL_THIRD) < 0 ) return false; // Job has no third Class if( (eaclass()&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE ) return false; // Exp. Super Novice equals 3rd Cls, but has it's own case if( Is_Baby() && (!.BabyClass || !.BabyThird) ) return false; // No Baby (Third) change allowed return true; } function Can_Rebirth { // To rebirth, you need to be: // * Second Class if( !.RebirthClass ) return false; // Rebirth disabled if( !(eaclass()&EAJL_2) ) return false; // Not second Class if( eaclass()&EAJL_UPPER ) return false; // Already Rebirthed if( roclass(eaclass()|EAJL_UPPER) < 0 ) return false; // Job has no transcended class if( Is_Baby() && !.BabyClass ) return false; // No Baby changes allowed return true; } // Checks if the given eac is a first class function Is_First_Cls { return (getarg(0) <= EAJ_TAEKWON); } function Check_Riding { // Note: Why we should always check for Riding: // Mounts are considered as another class, which // would make this NPC bigger just to handle with // those special cases. if (checkfalcon() || checkcart() || checkriding() || ismounting()) { mes "Please remove your " + ((checkfalcon()) ? "falcon" : "") + ((checkcart()) ? "cart" : "") + ((checkriding()) ? "Peco" : "") + ((ismounting()) ? "mount" : "") + " before proceeding."; close; } return; } function Check_SkillPoints { if (.SkillPointCheck && SkillPoint) { mes "Please use all your skill points before proceeding."; close; } return; } // addJobOptions is essentially the same like // setarray .@array[getarraysize(.@array)],opt1,opt2,...; // It's just easier to read, since we're using it very often function Job_Options { .@argcount = getargcount(); .@arr_size = getarraysize(getarg(0)); for( .@i = 1; .@i < .@argcount; .@i++) { setarray getelementofarray(getarg(0), .@arr_size++),getarg(.@i); } } // Begin of the NPC mes .NPCName$; Check_Riding(); Check_SkillPoints(); // initialisation deletearray .@job_opt[0],getarraysize(.@job_opt); .@eac = eaclass(); .@third_possible = Can_Change_Third(); .@rebirth_possible = Can_Rebirth(); .@first_eac = .@eac&EAJ_BASEMASK; .@second_eac = .@eac&EAJ_UPPERMASK; // Note: These are already set in pc.c // BaseClass = roclass(.@eac&EAJ_BASEMASK) which is the players First Class // BaseJob = roclass(.@eac&EAJ_UPPERMASK) which is the players Second Class //dispbottom "Debug: eac ("+.@eac+"), third ("+.@third_possible+"), rebirth("+.@rebirth_possible+"), BaseClass ("+BaseClass+"), BaseJob ("+BaseJob+")"; // From here on the jobmaster checks the current class // and fills the the array `.@job_opt` with possible // job options for the player. if( .@rebirth_possible ) { // Rebirth option (displayed on the top of the menu) Require_Level(.Req_Rebirth[0], .Req_Rebirth[1]); Job_Options(.@job_opt, Job_Novice_High); } if( .@third_possible ) { // Third Job change (displayed below rebirth) Require_Level(.Req_Third[0], .Req_Third[1]); Job_Options(.@job_opt, roclass(.@eac|EAJL_THIRD)); } if (.SecondExpanded && (.@eac&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE && // is Super Novice !(eaclass()&EAJL_THIRD) ) { // not already Expanded SN // (Baby) Super Novice to Expanded (Baby) Super Novice if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) { // .BabyClass & .BabyExpanded must be enabled if the is a baby Require_Level(.Req_Exp_SNOVI[0], .Req_Exp_SNOVI[1]); Job_Options(.@job_opt,roclass(.@eac|EAJL_THIRD)); // Expanded SN is "third" cls } } if (.SecondExpanded && ((.@eac&(~EAJL_BABY)) == EAJ_NINJA || // is (Baby) Ninja (.@eac&(~EAJL_BABY)) == EAJ_GUNSLINGER)) { // is (Baby) Gunslinger // (Baby) Ninja to (Baby) Kagerou / Oboro // (Baby) Gunslinger to (Baby) Rebellion if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) { // .BabyClass & .BabyExpanded must be enabled if the is a baby Require_Level(.Req_Exp_NJ_GS[0], .Req_Exp_NJ_GS[1]); // Kagerou, Oboro, Rebellion are considered as a 2-1 class Job_Options(.@job_opt, roclass(.@eac|EAJL_2_1)); } } // Player is Job_Novice, Job_Novice_High or Job_Baby if (.@first_eac == EAJ_NOVICE && .@second_eac != EAJ_SUPER_NOVICE) { // MAPID_NOVICE, MAPID_SUPER_NOVICE, MAPID_NOVICE_HIGH, MAPID_BABY Require_Level(.Req_First[0], .Req_First[1]); switch(Class) { case Job_Novice: // First job change Job_Options(.@job_opt,Job_Swordman, Job_Mage, Job_Archer, Job_Acolyte, Job_Merchant, Job_Thief, Job_Super_Novice, Job_Taekwon, Job_Gunslinger, Job_Ninja); if( .BabyNovice ) Job_Options(.@job_opt, Job_Baby); break; case Job_Novice_High: // Job change after rebirth if( .LastJob && lastJob ) Job_Options(.@job_opt, roclass((eaclass(lastJob)&EAJ_BASEMASK)|EAJL_UPPER)); else Job_Options(.@job_opt, Job_Swordman_High, Job_Mage_High, Job_Archer_High, Job_Acolyte_High, Job_Merchant_High, Job_Thief_High); break; case Job_Baby: if( !.BabyClass ) break; // First job change as a baby Job_Options(.@job_opt, Job_Baby_Swordman, Job_Baby_Mage, Job_Baby_Archer,Job_Baby_Acolyte, Job_Baby_Merchant, Job_Baby_Thief); if( .BabyExpanded ) Job_Options(.@job_opt, Job_Super_Baby, Job_Baby_Taekwon, Job_Baby_Gunslinger, Job_Baby_Ninja); if( .BabySummoner ) Job_Options(.@job_opt, Job_Baby_Summoner); break; default: mes "An error has occurred."; close; } } else if( Is_First_Cls(.@eac) || // First Class Is_First_Cls(.@eac&(~EAJL_UPPER)) || // Trans. First Cls (.BabyClass && Is_First_Cls(.@eac&(~EAJL_BABY))) ) { // Baby First Cls // Player is First Class (not Novice) // most jobs should have two options here (2-1 and 2-2) .@class1 = roclass(.@eac|EAJL_2_1); // 2-1 .@class2 = roclass(.@eac|EAJL_2_2); // 2-2 // dispbottom "Debug: Classes: class1 ("+.@class1+"), class2 ("+.@class2+")"; if(.LastJob && lastJob && (.@eac&EAJL_UPPER)) { // Player is rebirth Cls and linear class changes are enforced Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, lastJob + Job_Novice_High); } else { // Class is not enforced, player can decide. if( .@class1 > 0 ) { // 2-1 Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, .@class1); } if( .@class2 > 0 ) { // 2-2 Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, .@class2); } } } // Displaying the Job Menu defined by .@job_opt. // .@job_opt should not be changed below this line. function Job_Menu; Job_Menu(.@job_opt); close; // Displays the job menu function Job_Menu { if ((.@class == Job_Novice_High) && ((Zeny < 2000000) || (countitem(12040) < 1))) { mes "You do not have enough zeny or missing the required item!"; return; } // getarg(0) is the .@job_opt array holding all available job changes. function Confirm_Change; while(true) { .@opt_cnt = getarraysize(getarg(0)); if( .@opt_cnt <= 0 ) { mes "No more jobs are available."; close; } .@selected = 0; // Just a single job class given, no select needed if (.@opt_cnt > 1) { // Multiple job classes given. Select one and save it to .@class // After that confirm .@class mes "Select a job."; .@menu$ = ""; for (.@i = 0; .@i < .@opt_cnt; .@i++) { if( getelementofarray(getarg(0), .@i) == Job_Novice_High) .@jobname$ = "^0055FFRebirth^000000"; else .@jobname$ = jobname(getelementofarray(getarg(0), .@i)); .@menu$ = .@menu$ + " ~ " + .@jobname$ + ":"; } .@menu$ = .@menu$+" ~ ^777777Cancel^000000"; .@selected = select(.@menu$) - 1; if( .@selected < 0 || .@selected >= .@opt_cnt ) close; next; mes .NPCName$; } .@class = getelementofarray(getarg(0), .@selected); if ((.@class == Job_Super_Novice || .@class == Job_Super_Baby) && BaseLevel < .SNovice) { // Special Level Requirement because Super Novice and // Super Baby can both be selected in one of the first class // changes. That's why the Level Requirement is after and not before // the selection. mes "A base level of " + .SNovice + " is required to turn into a " + jobname(.@class) + "."; return; } // Confirm the Class Confirm_Change(.@class, .@opt_cnt > 1); next; mes .NPCName$; } return; } // Executes the actual jobchange and closes. function Job_Change { .@to_cls = getarg(0); next; mes .NPCName$; mes "You are now " + callfunc("F_InsertArticle", jobname(.@to_cls)) + "!"; if (.@to_cls == Job_Novice_High && .LastJob) lastJob = Class; // Saves the lastJob for rebirth jobchange .@to_cls; if (.@to_cls == Job_Novice_High) resetlvl(1); getitem 40030, 1; else if (.@to_cls == Job_Baby) { resetstatus; resetskill; set SkillPoint,0; } specialeffect2 EF_ANGEL2; specialeffect2 EF_ELECTRIC; if (.Platinum) callfunc "F_GetPlatinumSkills"; if (.GetJobEquip) Get_Job_Equip(); close; // Always closes after the change } function Confirm_Change { // Player confirms he want to change into .@class .@class = getarg(0, -1); .@back = getarg(1, false); if( .@class < 0 ) { mes "Unknown Class Error."; close; } mes "Do you want to change into ^0055FF"+jobname(.@class)+"^000000 class?"; .@job_option$ = " ~ Change into ^0055FF"+jobname(.@class)+"^000000 class"; if( .@class == Job_Novice_High) .@job_option$ = " ~ ^0055FFRebirth^000000"; if (select(.@job_option$+": ~ ^777777" + ((.@back) ?"Go back" : "Cancel") + "^000000") == 1) { Job_Change(.@class); } if (!.@back) close; // "Cancel" pressed return; } // Function which gives a job related item to the player // the items are the rewards from the original job change quests function Get_Job_Equip { // Note: The item is dropping, when the player can't hold it. // But that's better than not giving the item at all. .@eac = eaclass(); if( .@eac&EAJL_THIRD ) { // Third Class Items switch(BaseJob) { // BaseJob of Third Cls // For Normal Third, Baby Third and Transcended Third Cls case Job_Knight: getitem 5746,1; break; // Rune Circlet [1] case Job_Wizard: getitem 5753,1; break; // Magic Stone Hat [1] case Job_Hunter: getitem 5748,1; break; // Sniper Goggle [1] case Job_Priest: getitem 5747,1; break; // Mitra [1] case Job_Blacksmith: getitem 5749,1; break; // Driver Band [1] case Job_Assassin: getitem 5755,1; break; // Silent Executor [1] case Job_Crusader: getitem 5757,1; break; // Dip Schmidt Helm [1] case Job_Sage: getitem 5756,1; break; // Wind Whisper [1] case Job_Bard: getitem 5751,1; break; // Maestro Song's Hat [1] case Job_Dancer: getitem 5758,1; break; // Dying Swan [1] case Job_Monk: getitem 5754,1; break; // Blazing Soul [1] case Job_Alchemist: getitem 5752,1; break; // Midas Whisper[1] case Job_Rogue: getitem 5750,1; // Shadow Handicraft [1] } } else if (.@eac&EAJL_2) { // Second Class (And not Third Class) switch(BaseJob) { // Second Class case Job_Knight: getitem 1163,1; break; // Claymore [0] case Job_Priest: getitem 1522,1; break; // Stunner [0] case Job_Wizard: getitem 1617,1; break; // Survivor's Rod [0] case Job_Blacksmith: getitem 1360,1; break; // Two-Handed-Axe [1] case Job_Hunter: getitem 1718,1; break; // Hunter Bow [0] case Job_Assassin: getitem 1254,1; break; // Jamadhar [0] case Job_Crusader: getitem 1410,1; break; // Lance [0] case Job_Monk: getitem 1807,1; break; // Fist [0] case Job_Sage: getitem 1550,1; break; // Book [3] case Job_Rogue: getitem 1222,1; break; // Damascus [1] case Job_Alchemist: getitem 1126,1; break; // Saber [2] case Job_Bard: getitem 1907,1; break; // Guitar [0] case Job_Dancer: getitem 1960,1; break; // Whip [1] case Job_Super_Novice: getitem 1208,1; break; // Main Gauche [4] case Job_Gunslinger: getitem 13101,1; break; // Six Shooter [2] case Job_Ninja: getitem 13010,1; break; // Asura [2] case Job_Star_Gladiator: getitem 1550,1; break; // Book [3] case Job_Soul_Linker: getitem 1617,1; break; // Survivor's Rod [0] } } else { // Neither Second or Third Cls // => First Cls or not covered by the switch switch(BaseClass) { // First Class case Job_Swordman: getitem 1108,1; break; // Blade [4] case Job_Mage: getitem 1602,1; break; // Rod [4] case Job_Archer: getitem 1705,1; break; // Composite Bow [4] case Job_Acolyte: getitem 1505,1; break; // Mace [4] case Job_Merchant: getitem 1302,1; break; // Axe [4] case Job_Thief: getitem 1208,1; break; // Main Gauche [4] } } return; } OnInit: // Initialisation, do not edit these .NPCName$ = "[Job Master]"; // Settings .ThirdClass = false; // Enable third classes? .RebirthClass = true; // Enable rebirth classes? .SecondExpanded = false; // Enable new expanded second classes: Ex. Super Novice, Kagerou/Oboro, Rebellion? .BabyNovice = true; // Enable Baby novice classes? Disable it if you like player must have parent to get job baby. .BabyClass = true; // Enable Baby classes? .BabyThird = false; // Enable Baby third classes? .BabyExpanded = false; // Enable Baby Expanded classes: Ex. Baby Ninja, Baby Taekwon, etc. .BabySummoner = false; // Enable Baby Summoner? .LastJob = true; // Enforce linear class changes? .SkillPointCheck = true; // Force player to use up all skill points? .Platinum = false; // Get platinum skills automatically? .GetJobEquip = true; // Get job equipment (mostly weapons) on job change? // Level Requirements setarray .Req_First[0],1,10; // Minimum base level, job level to turn into 1st class setarray .Req_Second[0],1,40; // Minimum base level, job level to turn into 2nd class setarray .Req_Rebirth[0],99,50; // Minimum base level, job level to rebirth setarray .Req_Third[0],99,50; // Minimum base level, job level to change to third class setarray .Req_Exp_NJ_GS[0],99,70; // Minimum base level, job level to turn into Expanded Ninja and Gunslinger setarray .Req_Exp_SNOVI[0],99,99; // Minimum base level, job level to turn into Expanded Super Novice .SNovice = 45; // Minimum base level to turn into Super Novice // Setting adjustments by PACKETVER if( PACKETVER < 20161207 ) { if( .BabyExpanded ) debugmes "jobmaster: BabyExpanded is disabled due to outdated PACKETVER."; if( .BabySummoner ) debugmes "jobmaster: BabySummoner is disabled due to outdated PACKETVER."; .BabyExpanded = false; .BabySummoner = false; } end; } For Zeny and my item does not work it must be my fault ... can you send the code plz? thx for your repply guys.
  16. Hi, i would like give item when player rebirth on High Novice can you give me how plz? ^^ //===== rAthena Script ======================================= //= Job Master //===== Description: ========================================= //= A fully functional job changer. //===== Additional Comments: ================================= //= 1.0 Initial script. [Euphy] //= 1.1 Fixed reset on Baby job change. //= 1.2 Added Expanded Super Novice support and initial Kagerou/Oboro support. //= 1.3 Kagerou/Oboro added. //= 1.4 Rebellion added. //= 1.5 Added option to disable RebirthClass. [mazvi] //= 1.6 Added option to get job related equipment on change. [Braniff] //= 1.7 Readability changes. Also added BabyExpanded and BabySummoner classes. [Jey] //= 1.8 Added option to disable Baby Novice Only but Baby Class can be Enabled [mazvi] //= 1.9 Migrate/Integrate to Global Functions Platinum Skills. [mazvi] //============================================================ prontera,152,190,6 script Job Master 618,{ function Get_Job_Equip; // Checks if the Player has the required level. // closes if not, returns if yes function Require_Level { if (BaseLevel < getarg(0) || JobLevel < getarg(1)) { .@blvl = getarg(0) - BaseLevel; .@jlvl = getarg(1) - JobLevel; mes "Level requirement:"; mes ((getarg(0)>1)? "^bb0000"+getarg(0)+"^000000 (^bb0000Base^000000) / ":"")+"^00bb00"+ getarg(1)+"^000000 (^00bb00Job^000000)"; mes "You need " + ((.@blvl > 0) ? "^bb0000"+.@blvl+"^000000 more base levels " + ((.@jlvl > 0) ? "and " : "") : "") + ((.@jlvl > 0) ? "^00bb00"+.@jlvl+"^000000 more job levels " : "") + "to continue."; close; } return; } // Checks if the given eac is a baby class function Is_Baby { return ((getarg(0, eaclass())&EAJL_BABY)>0); } // Checks if the player can change to third class. // Note: This does not include the level checks. function Can_Change_Third { // To change to third class you either need to be: // * Second Class // * Transcendent Second Class // * Baby Second Class if( !.ThirdClass ) return false; // Third job change disabled if( !(eaclass()&EAJL_2) ) return false; // Not second Class if( eaclass()&EAJL_THIRD ) return false; // Already Third Class if( roclass(eaclass()|EAJL_THIRD) < 0 ) return false; // Job has no third Class if( (eaclass()&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE ) return false; // Exp. Super Novice equals 3rd Cls, but has it's own case if( Is_Baby() && (!.BabyClass || !.BabyThird) ) return false; // No Baby (Third) change allowed return true; } function Can_Rebirth { // To rebirth, you need to be: // * Second Class if( !.RebirthClass ) return false; // Rebirth disabled if( !(eaclass()&EAJL_2) ) return false; // Not second Class if( eaclass()&EAJL_UPPER ) return false; // Already Rebirthed if( roclass(eaclass()|EAJL_UPPER) < 0 ) return false; // Job has no transcended class if( Is_Baby() && !.BabyClass ) return false; // No Baby changes allowed return true; } // Checks if the given eac is a first class function Is_First_Cls { return (getarg(0) <= EAJ_TAEKWON); } function Check_Riding { // Note: Why we should always check for Riding: // Mounts are considered as another class, which // would make this NPC bigger just to handle with // those special cases. if (checkfalcon() || checkcart() || checkriding() || ismounting()) { mes "Please remove your " + ((checkfalcon()) ? "falcon" : "") + ((checkcart()) ? "cart" : "") + ((checkriding()) ? "Peco" : "") + ((ismounting()) ? "mount" : "") + " before proceeding."; close; } return; } function Check_SkillPoints { if (.SkillPointCheck && SkillPoint) { mes "Please use all your skill points before proceeding."; close; } return; } // addJobOptions is essentially the same like // setarray .@array[getarraysize(.@array)],opt1,opt2,...; // It's just easier to read, since we're using it very often function Job_Options { .@argcount = getargcount(); .@arr_size = getarraysize(getarg(0)); for( .@i = 1; .@i < .@argcount; .@i++) { setarray getelementofarray(getarg(0), .@arr_size++),getarg(.@i); } } // Begin of the NPC mes .NPCName$; Check_Riding(); Check_SkillPoints(); // initialisation deletearray .@job_opt[0],getarraysize(.@job_opt); .@eac = eaclass(); .@third_possible = Can_Change_Third(); .@rebirth_possible = Can_Rebirth(); .@first_eac = .@eac&EAJ_BASEMASK; .@second_eac = .@eac&EAJ_UPPERMASK; // Note: These are already set in pc.c // BaseClass = roclass(.@eac&EAJ_BASEMASK) which is the players First Class // BaseJob = roclass(.@eac&EAJ_UPPERMASK) which is the players Second Class //dispbottom "Debug: eac ("+.@eac+"), third ("+.@third_possible+"), rebirth("+.@rebirth_possible+"), BaseClass ("+BaseClass+"), BaseJob ("+BaseJob+")"; // From here on the jobmaster checks the current class // and fills the the array `.@job_opt` with possible // job options for the player. if( .@rebirth_possible ) { // Rebirth option (displayed on the top of the menu) Require_Level(.Req_Rebirth[0], .Req_Rebirth[1]); Job_Options(.@job_opt, Job_Novice_High); } if( .@third_possible ) { // Third Job change (displayed below rebirth) Require_Level(.Req_Third[0], .Req_Third[1]); Job_Options(.@job_opt, roclass(.@eac|EAJL_THIRD)); } if (.SecondExpanded && (.@eac&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE && // is Super Novice !(eaclass()&EAJL_THIRD) ) { // not already Expanded SN // (Baby) Super Novice to Expanded (Baby) Super Novice if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) { // .BabyClass & .BabyExpanded must be enabled if the is a baby Require_Level(.Req_Exp_SNOVI[0], .Req_Exp_SNOVI[1]); Job_Options(.@job_opt,roclass(.@eac|EAJL_THIRD)); // Expanded SN is "third" cls } } if (.SecondExpanded && ((.@eac&(~EAJL_BABY)) == EAJ_NINJA || // is (Baby) Ninja (.@eac&(~EAJL_BABY)) == EAJ_GUNSLINGER)) { // is (Baby) Gunslinger // (Baby) Ninja to (Baby) Kagerou / Oboro // (Baby) Gunslinger to (Baby) Rebellion if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) { // .BabyClass & .BabyExpanded must be enabled if the is a baby Require_Level(.Req_Exp_NJ_GS[0], .Req_Exp_NJ_GS[1]); // Kagerou, Oboro, Rebellion are considered as a 2-1 class Job_Options(.@job_opt, roclass(.@eac|EAJL_2_1)); } } // Player is Job_Novice, Job_Novice_High or Job_Baby if (.@first_eac == EAJ_NOVICE && .@second_eac != EAJ_SUPER_NOVICE) { // MAPID_NOVICE, MAPID_SUPER_NOVICE, MAPID_NOVICE_HIGH, MAPID_BABY Require_Level(.Req_First[0], .Req_First[1]); switch(Class) { case Job_Novice: // First job change Job_Options(.@job_opt,Job_Swordman, Job_Mage, Job_Archer, Job_Acolyte, Job_Merchant, Job_Thief, Job_Super_Novice, Job_Taekwon, Job_Gunslinger, Job_Ninja); if( .BabyNovice ) Job_Options(.@job_opt, Job_Baby); break; case Job_Novice_High: // Job change after rebirth if( .LastJob && lastJob ) Job_Options(.@job_opt, roclass((eaclass(lastJob)&EAJ_BASEMASK)|EAJL_UPPER)); else Job_Options(.@job_opt, Job_Swordman_High, Job_Mage_High, Job_Archer_High, Job_Acolyte_High, Job_Merchant_High, Job_Thief_High); break; case Job_Baby: if( !.BabyClass ) break; // First job change as a baby Job_Options(.@job_opt, Job_Baby_Swordman, Job_Baby_Mage, Job_Baby_Archer,Job_Baby_Acolyte, Job_Baby_Merchant, Job_Baby_Thief); if( .BabyExpanded ) Job_Options(.@job_opt, Job_Super_Baby, Job_Baby_Taekwon, Job_Baby_Gunslinger, Job_Baby_Ninja); if( .BabySummoner ) Job_Options(.@job_opt, Job_Baby_Summoner); break; default: mes "An error has occurred."; close; } } else if( Is_First_Cls(.@eac) || // First Class Is_First_Cls(.@eac&(~EAJL_UPPER)) || // Trans. First Cls (.BabyClass && Is_First_Cls(.@eac&(~EAJL_BABY))) ) { // Baby First Cls // Player is First Class (not Novice) // most jobs should have two options here (2-1 and 2-2) .@class1 = roclass(.@eac|EAJL_2_1); // 2-1 .@class2 = roclass(.@eac|EAJL_2_2); // 2-2 // dispbottom "Debug: Classes: class1 ("+.@class1+"), class2 ("+.@class2+")"; if(.LastJob && lastJob && (.@eac&EAJL_UPPER)) { // Player is rebirth Cls and linear class changes are enforced Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, lastJob + Job_Novice_High); } else { // Class is not enforced, player can decide. if( .@class1 > 0 ) { // 2-1 Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, .@class1); } if( .@class2 > 0 ) { // 2-2 Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, .@class2); } } } // Displaying the Job Menu defined by .@job_opt. // .@job_opt should not be changed below this line. function Job_Menu; Job_Menu(.@job_opt); close; // Displays the job menu function Job_Menu { // getarg(0) is the .@job_opt array holding all available job changes. function Confirm_Change; while(true) { .@opt_cnt = getarraysize(getarg(0)); if( .@opt_cnt <= 0 ) { mes "No more jobs are available."; close; } .@selected = 0; // Just a single job class given, no select needed if (.@opt_cnt > 1) { // Multiple job classes given. Select one and save it to .@class // After that confirm .@class mes "Select a job."; .@menu$ = ""; for (.@i = 0; .@i < .@opt_cnt; .@i++) { if( getelementofarray(getarg(0), .@i) == Job_Novice_High) .@jobname$ = "^0055FFRebirth^000000"; else .@jobname$ = jobname(getelementofarray(getarg(0), .@i)); .@menu$ = .@menu$ + " ~ " + .@jobname$ + ":"; } .@menu$ = .@menu$+" ~ ^777777Cancel^000000"; .@selected = select(.@menu$) - 1; if( .@selected < 0 || .@selected >= .@opt_cnt ) close; next; mes .NPCName$; } .@class = getelementofarray(getarg(0), .@selected); if ((.@class == Job_Super_Novice || .@class == Job_Super_Baby) && BaseLevel < .SNovice) { // Special Level Requirement because Super Novice and // Super Baby can both be selected in one of the first class // changes. That's why the Level Requirement is after and not before // the selection. mes "A base level of " + .SNovice + " is required to turn into a " + jobname(.@class) + "."; return; } // Confirm the Class Confirm_Change(.@class, .@opt_cnt > 1); next; mes .NPCName$; } return; } // Executes the actual jobchange and closes. function Job_Change { .@to_cls = getarg(0); next; mes .NPCName$; mes "You are now " + callfunc("F_InsertArticle", jobname(.@to_cls)) + "!"; if (.@to_cls == Job_Novice_High && .LastJob) lastJob = Class; // Saves the lastJob for rebirth jobchange .@to_cls; if (.@to_cls == Job_Novice_High) resetlvl(1); else if (.@to_cls == Job_Baby) { resetstatus; resetskill; set SkillPoint,0; } specialeffect2 EF_ANGEL2; specialeffect2 EF_ELECTRIC; if (.Platinum) callfunc "F_GetPlatinumSkills"; if (.GetJobEquip) Get_Job_Equip(); close; // Always closes after the change } function Confirm_Change { // Player confirms he want to change into .@class .@class = getarg(0, -1); .@back = getarg(1, false); if( .@class < 0 ) { mes "Unknown Class Error."; close; } mes "Do you want to change into ^0055FF"+jobname(.@class)+"^000000 class?"; .@job_option$ = " ~ Change into ^0055FF"+jobname(.@class)+"^000000 class"; if( .@class == Job_Novice_High) .@job_option$ = " ~ ^0055FFRebirth^000000"; if (select(.@job_option$+": ~ ^777777" + ((.@back) ?"Go back" : "Cancel") + "^000000") == 1) { Job_Change(.@class); } if (!.@back) close; // "Cancel" pressed return; } // Function which gives a job related item to the player // the items are the rewards from the original job change quests function Get_Job_Equip { // Note: The item is dropping, when the player can't hold it. // But that's better than not giving the item at all. .@eac = eaclass(); if( .@eac&EAJL_THIRD ) { // Third Class Items switch(BaseJob) { // BaseJob of Third Cls // For Normal Third, Baby Third and Transcended Third Cls case Job_Knight: getitem 5746,1; break; // Rune Circlet [1] case Job_Wizard: getitem 5753,1; break; // Magic Stone Hat [1] case Job_Hunter: getitem 5748,1; break; // Sniper Goggle [1] case Job_Priest: getitem 5747,1; break; // Mitra [1] case Job_Blacksmith: getitem 5749,1; break; // Driver Band [1] case Job_Assassin: getitem 5755,1; break; // Silent Executor [1] case Job_Crusader: getitem 5757,1; break; // Dip Schmidt Helm [1] case Job_Sage: getitem 5756,1; break; // Wind Whisper [1] case Job_Bard: getitem 5751,1; break; // Maestro Song's Hat [1] case Job_Dancer: getitem 5758,1; break; // Dying Swan [1] case Job_Monk: getitem 5754,1; break; // Blazing Soul [1] case Job_Alchemist: getitem 5752,1; break; // Midas Whisper[1] case Job_Rogue: getitem 5750,1; // Shadow Handicraft [1] } } else if (.@eac&EAJL_2) { // Second Class (And not Third Class) switch(BaseJob) { // Second Class case Job_Knight: getitem 1163,1; break; // Claymore [0] case Job_Priest: getitem 1522,1; break; // Stunner [0] case Job_Wizard: getitem 1617,1; break; // Survivor's Rod [0] case Job_Blacksmith: getitem 1360,1; break; // Two-Handed-Axe [1] case Job_Hunter: getitem 1718,1; break; // Hunter Bow [0] case Job_Assassin: getitem 1254,1; break; // Jamadhar [0] case Job_Crusader: getitem 1410,1; break; // Lance [0] case Job_Monk: getitem 1807,1; break; // Fist [0] case Job_Sage: getitem 1550,1; break; // Book [3] case Job_Rogue: getitem 1222,1; break; // Damascus [1] case Job_Alchemist: getitem 1126,1; break; // Saber [2] case Job_Bard: getitem 1907,1; break; // Guitar [0] case Job_Dancer: getitem 1960,1; break; // Whip [1] case Job_Super_Novice: getitem 1208,1; break; // Main Gauche [4] case Job_Gunslinger: getitem 13101,1; break; // Six Shooter [2] case Job_Ninja: getitem 13010,1; break; // Asura [2] case Job_Star_Gladiator: getitem 1550,1; break; // Book [3] case Job_Soul_Linker: getitem 1617,1; break; // Survivor's Rod [0] } } else { // Neither Second or Third Cls // => First Cls or not covered by the switch switch(BaseClass) { // First Class case Job_Swordman: getitem 1108,1; break; // Blade [4] case Job_Mage: getitem 1602,1; break; // Rod [4] case Job_Archer: getitem 1705,1; break; // Composite Bow [4] case Job_Acolyte: getitem 1505,1; break; // Mace [4] case Job_Merchant: getitem 1302,1; break; // Axe [4] case Job_Thief: getitem 1208,1; break; // Main Gauche [4] } } return; } OnInit: // Initialisation, do not edit these .NPCName$ = "[Job Master]"; // Settings .ThirdClass = false; // Enable third classes? .RebirthClass = true; // Enable rebirth classes? .SecondExpanded = false; // Enable new expanded second classes: Ex. Super Novice, Kagerou/Oboro, Rebellion? .BabyNovice = true; // Enable Baby novice classes? Disable it if you like player must have parent to get job baby. .BabyClass = true; // Enable Baby classes? .BabyThird = false; // Enable Baby third classes? .BabyExpanded = false; // Enable Baby Expanded classes: Ex. Baby Ninja, Baby Taekwon, etc. .BabySummoner = false; // Enable Baby Summoner? .LastJob = true; // Enforce linear class changes? .SkillPointCheck = true; // Force player to use up all skill points? .Platinum = false; // Get platinum skills automatically? .GetJobEquip = true; // Get job equipment (mostly weapons) on job change? // Level Requirements setarray .Req_First[0],1,10; // Minimum base level, job level to turn into 1st class setarray .Req_Second[0],1,40; // Minimum base level, job level to turn into 2nd class setarray .Req_Rebirth[0],99,50; // Minimum base level, job level to rebirth setarray .Req_Third[0],99,50; // Minimum base level, job level to change to third class setarray .Req_Exp_NJ_GS[0],99,70; // Minimum base level, job level to turn into Expanded Ninja and Gunslinger setarray .Req_Exp_SNOVI[0],99,99; // Minimum base level, job level to turn into Expanded Super Novice .SNovice = 45; // Minimum base level to turn into Super Novice // Setting adjustments by PACKETVER if( PACKETVER < 20161207 ) { if( .BabyExpanded ) debugmes "jobmaster: BabyExpanded is disabled due to outdated PACKETVER."; if( .BabySummoner ) debugmes "jobmaster: BabySummoner is disabled due to outdated PACKETVER."; .BabyExpanded = false; .BabySummoner = false; } end; } i would like rebirth cost 1 item + 2M zeny and when rebirth > player get item 40030 thx for your repply ^^
  17. Hi, have searching on forum but i dont have find any answer at my question. Im on Renewal version and i would like 150 agi = 190 aspd and 150 dex = no-cast . Can you explain me how change that ,thx for your repply.
  18. Hi rathena, i would like this script with menu when the player want Rebirth //===== rAthena Script ======================================= //= Job Master //===== Description: ========================================= //= A fully functional job changer. //===== Additional Comments: ================================= //= 1.0 Initial script. [Euphy] //= 1.1 Fixed reset on Baby job change. //= 1.2 Added Expanded Super Novice support and initial Kagerou/Oboro support. //= 1.3 Kagerou/Oboro added. //= 1.4 Rebellion added. //= 1.5 Added option to disable RebirthClass. [mazvi] //= 1.6 Added option to get job related equipment on change. [Braniff] //= 1.7 Readability changes. Also added BabyExpanded and BabySummoner classes. [Jey] //= 1.8 Added option to disable Baby Novice Only but Baby Class can be Enabled [mazvi] //= 1.9 Migrate/Integrate to Global Functions Platinum Skills. [mazvi] //============================================================ prontera,152,190,6 script Job Master 618,{ function Get_Job_Equip; // Checks if the Player has the required level. // closes if not, returns if yes function Require_Level { if (BaseLevel < getarg(0) || JobLevel < getarg(1)) { .@blvl = getarg(0) - BaseLevel; .@jlvl = getarg(1) - JobLevel; mes "Level requirement:"; mes ((getarg(0)>1)? "^bb0000"+getarg(0)+"^000000 (^bb0000Base^000000) / ":"")+"^00bb00"+ getarg(1)+"^000000 (^00bb00Job^000000)"; mes "You need " + ((.@blvl > 0) ? "^bb0000"+.@blvl+"^000000 more base levels " + ((.@jlvl > 0) ? "and " : "") : "") + ((.@jlvl > 0) ? "^00bb00"+.@jlvl+"^000000 more job levels " : "") + "to continue."; close; } return; } // Checks if the given eac is a baby class function Is_Baby { return ((getarg(0, eaclass())&EAJL_BABY)>0); } // Checks if the player can change to third class. // Note: This does not include the level checks. function Can_Change_Third { // To change to third class you either need to be: // * Second Class // * Transcendent Second Class // * Baby Second Class if( !.ThirdClass ) return false; // Third job change disabled if( !(eaclass()&EAJL_2) ) return false; // Not second Class if( eaclass()&EAJL_THIRD ) return false; // Already Third Class if( roclass(eaclass()|EAJL_THIRD) < 0 ) return false; // Job has no third Class if( (eaclass()&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE ) return false; // Exp. Super Novice equals 3rd Cls, but has it's own case if( Is_Baby() && (!.BabyClass || !.BabyThird) ) return false; // No Baby (Third) change allowed return true; } function Can_Rebirth { // To rebirth, you need to be: // * Second Class if( !.RebirthClass ) return false; // Rebirth disabled if( !(eaclass()&EAJL_2) ) return false; // Not second Class if( eaclass()&EAJL_UPPER ) return false; // Already Rebirthed if( roclass(eaclass()|EAJL_UPPER) < 0 ) return false; // Job has no transcended class if( Is_Baby() && !.BabyClass ) return false; // No Baby changes allowed return true; } // Checks if the given eac is a first class function Is_First_Cls { return (getarg(0) <= EAJ_TAEKWON); } function Check_Riding { // Note: Why we should always check for Riding: // Mounts are considered as another class, which // would make this NPC bigger just to handle with // those special cases. if (checkfalcon() || checkcart() || checkriding() || ismounting()) { mes "Please remove your " + ((checkfalcon()) ? "falcon" : "") + ((checkcart()) ? "cart" : "") + ((checkriding()) ? "Peco" : "") + ((ismounting()) ? "mount" : "") + " before proceeding."; close; } return; } function Check_SkillPoints { if (.SkillPointCheck && SkillPoint) { mes "Please use all your skill points before proceeding."; close; } return; } // addJobOptions is essentially the same like // setarray .@array[getarraysize(.@array)],opt1,opt2,...; // It's just easier to read, since we're using it very often function Job_Options { .@argcount = getargcount(); .@arr_size = getarraysize(getarg(0)); for( .@i = 1; .@i < .@argcount; .@i++) { setarray getelementofarray(getarg(0), .@arr_size++),getarg(.@i); } } // Begin of the NPC mes .NPCName$; Check_Riding(); Check_SkillPoints(); // initialisation deletearray .@job_opt[0],getarraysize(.@job_opt); .@eac = eaclass(); .@third_possible = Can_Change_Third(); .@rebirth_possible = Can_Rebirth(); .@first_eac = .@eac&EAJ_BASEMASK; .@second_eac = .@eac&EAJ_UPPERMASK; // Note: These are already set in pc.c // BaseClass = roclass(.@eac&EAJ_BASEMASK) which is the players First Class // BaseJob = roclass(.@eac&EAJ_UPPERMASK) which is the players Second Class //dispbottom "Debug: eac ("+.@eac+"), third ("+.@third_possible+"), rebirth("+.@rebirth_possible+"), BaseClass ("+BaseClass +"), BaseJob ("+BaseJob+")"; // From here on the jobmaster checks the current class // and fills the the array `.@job_opt` with possible // job options for the player. if( .@rebirth_possible ) { // Rebirth option (displayed on the top of the menu) Require_Level(.Req_Rebirth[0], .Req_Rebirth[1]); Job_Options(.@job_opt, Job_Novice_High); } if( .@third_possible ) { // Third Job change (displayed below rebirth) Require_Level(.Req_Third[0], .Req_Third[1]); Job_Options(.@job_opt, roclass(.@eac|EAJL_THIRD)); } if (.SecondExpanded && (.@eac&EAJ_UPPERMASK) == EAJ_SUPER_NOVICE && // is Super Novice !(eaclass()&EAJL_THIRD) ) { // not already Expanded SN // (Baby) Super Novice to Expanded (Baby) Super Novice if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) { // .BabyClass & .BabyExpanded must be enabled if the is a baby Require_Level(.Req_Exp_SNOVI[0], .Req_Exp_SNOVI[1]); Job_Options(.@job_opt,roclass(.@eac|EAJL_THIRD)); // Expanded SN is "third" cls } } if (.SecondExpanded && ((.@eac&(~EAJL_BABY)) == EAJ_NINJA || // is (Baby) Ninja (.@eac&(~EAJL_BABY)) == EAJ_GUNSLINGER)) { // is (Baby) Gunslinger // (Baby) Ninja to (Baby) Kagerou / Oboro // (Baby) Gunslinger to (Baby) Rebellion if( !Is_Baby(.@eac) || (.BabyClass && .BabyExpanded) ) { // .BabyClass & .BabyExpanded must be enabled if the is a baby Require_Level(.Req_Exp_NJ_GS[0], .Req_Exp_NJ_GS[1]); // Kagerou, Oboro, Rebellion are considered as a 2-1 class Job_Options(.@job_opt, roclass(.@eac|EAJL_2_1)); } } // Player is Job_Novice, Job_Novice_High or Job_Baby if (.@first_eac == EAJ_NOVICE && .@second_eac != EAJ_SUPER_NOVICE) { // MAPID_NOVICE, MAPID_SUPER_NOVICE, MAPID_NOVICE_HIGH, MAPID_BABY Require_Level(.Req_First[0], .Req_First[1]); switch(Class) { case Job_Novice: // First job change Job_Options(.@job_opt,Job_Swordman, Job_Mage, Job_Archer, Job_Acolyte, Job_Merchant, Job_Thief, Job_Super_Novice, Job_Taekwon, Job_Gunslinger, Job_Ninja); if( .BabyNovice ) Job_Options(.@job_opt, Job_Baby); break; case Job_Novice_High: // Job change after rebirth if( .LastJob && lastJob ) Job_Options(.@job_opt, roclass((eaclass(lastJob)&EAJ_BASEMASK)|EAJL_UPPER)); else Job_Options(.@job_opt, Job_Swordman_High, Job_Mage_High, Job_Archer_High, Job_Acolyte_High, Job_Merchant_High, Job_Thief_High); break; case Job_Baby: if( !.BabyClass ) break; // First job change as a baby Job_Options(.@job_opt, Job_Baby_Swordman, Job_Baby_Mage, Job_Baby_Archer,Job_Baby_Acolyte, Job_Baby_Merchant, Job_Baby_Thief); if( .BabyExpanded ) Job_Options(.@job_opt, Job_Super_Baby, Job_Baby_Taekwon, Job_Baby_Gunslinger, Job_Baby_Ninja); if( .BabySummoner ) Job_Options(.@job_opt, Job_Baby_Summoner); break; default: mes "An error has occurred."; close; } } else if( Is_First_Cls(.@eac) || // First Class Is_First_Cls(.@eac&(~EAJL_UPPER)) || // Trans. First Cls (.BabyClass && Is_First_Cls(.@eac&(~EAJL_BABY))) ) { // Baby First Cls // Player is First Class (not Novice) // most jobs should have two options here (2-1 and 2-2) .@class1 = roclass(.@eac|EAJL_2_1); // 2-1 .@class2 = roclass(.@eac|EAJL_2_2); // 2-2 // dispbottom "Debug: Classes: class1 ("+.@class1+"), class2 ("+.@class2+")"; if(.LastJob && lastJob && (.@eac&EAJL_UPPER)) { // Player is rebirth Cls and linear class changes are enforced Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, lastJob + Job_Novice_High); } else { // Class is not enforced, player can decide. if( .@class1 > 0 ) { // 2-1 Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, .@class1); } if( .@class2 > 0 ) { // 2-2 Require_Level(.Req_Second[0], .Req_Second[1]); Job_Options(.@job_opt, .@class2); } } } // Displaying the Job Menu defined by .@job_opt. // .@job_opt should not be changed below this line. function Job_Menu; Job_Menu(.@job_opt); close; // Displays the job menu function Job_Menu { // getarg(0) is the .@job_opt array holding all available job changes. function Confirm_Change; while(true) { .@opt_cnt = getarraysize(getarg(0)); if( .@opt_cnt <= 0 ) { mes "No more jobs are available."; close; } .@selected = 0; // Just a single job class given, no select needed if (.@opt_cnt > 1) { // Multiple job classes given. Select one and save it to .@class // After that confirm .@class mes "Select a job."; .@menu$ = ""; for (.@i = 0; .@i < .@opt_cnt; .@i++) { if( getelementofarray(getarg(0), .@i) == Job_Novice_High) .@jobname$ = "^0055FFRebirth^000000"; else .@jobname$ = jobname(getelementofarray(getarg(0), .@i)); .@menu$ = .@menu$ + " ~ " + .@jobname$ + ":"; } .@menu$ = .@menu$+" ~ ^777777Cancel^000000"; .@selected = select(.@menu$) - 1; if( .@selected < 0 || .@selected >= .@opt_cnt ) close; next; mes .NPCName$; } .@class = getelementofarray(getarg(0), .@selected); if ((.@class == Job_Super_Novice || .@class == Job_Super_Baby) && BaseLevel < .SNovice) { // Special Level Requirement because Super Novice and // Super Baby can both be selected in one of the first class // changes. That's why the Level Requirement is after and not before // the selection. mes "A base level of " + .SNovice + " is required to turn into a " + jobname(.@class) + "."; return; } // Confirm the Class Confirm_Change(.@class, .@opt_cnt > 1); next; mes .NPCName$; } return; } // Executes the actual jobchange and closes. function Job_Change { .@to_cls = getarg(0); next; mes .NPCName$; mes "You are now " + callfunc("F_InsertArticle", jobname(.@to_cls)) + "!"; if (.@to_cls == Job_Novice_High && .LastJob) lastJob = Class; // Saves the lastJob for rebirth jobchange .@to_cls; if (.@to_cls == Job_Novice_High) resetlvl(1); else if (.@to_cls == Job_Baby) { resetstatus; resetskill; set SkillPoint,0; } specialeffect2 EF_ANGEL2; specialeffect2 EF_ELECTRIC; if (.Platinum) callfunc "F_GetPlatinumSkills"; if (.GetJobEquip) Get_Job_Equip(); close; // Always closes after the change } function Confirm_Change { // Player confirms he want to change into .@class .@class = getarg(0, -1); .@back = getarg(1, false); if( .@class < 0 ) { mes "Unknown Class Error."; close; } mes "Do you want to change into ^0055FF"+jobname(.@class)+"^000000 class?"; .@job_option$ = " ~ Change into ^0055FF"+jobname(.@class)+"^000000 class"; if( .@class == Job_Novice_High) .@job_option$ = " ~ ^0055FFRebirth^000000"; if (select(.@job_option$+": ~ ^777777" + ((.@back) ?"Go back" : "Cancel") + "^000000") == 1) { Job_Change(.@class); } if (!.@back) close; // "Cancel" pressed return; } // Function which gives a job related item to the player // the items are the rewards from the original job change quests function Get_Job_Equip { // Note: The item is dropping, when the player can't hold it. // But that's better than not giving the item at all. .@eac = eaclass(); if( .@eac&EAJL_THIRD ) { // Third Class Items switch(BaseJob) { // BaseJob of Third Cls // For Normal Third, Baby Third and Transcended Third Cls case Job_Knight: getitem 5746,1; break; // Rune Circlet [1] case Job_Wizard: getitem 5753,1; break; // Magic Stone Hat [1] case Job_Hunter: getitem 5748,1; break; // Sniper Goggle [1] case Job_Priest: getitem 5747,1; break; // Mitra [1] case Job_Blacksmith: getitem 5749,1; break; // Driver Band [1] case Job_Assassin: getitem 5755,1; break; // Silent Executor [1] case Job_Crusader: getitem 5757,1; break; // Dip Schmidt Helm [1] case Job_Sage: getitem 5756,1; break; // Wind Whisper [1] case Job_Bard: getitem 5751,1; break; // Maestro Song's Hat [1] case Job_Dancer: getitem 5758,1; break; // Dying Swan [1] case Job_Monk: getitem 5754,1; break; // Blazing Soul [1] case Job_Alchemist: getitem 5752,1; break; // Midas Whisper[1] case Job_Rogue: getitem 5750,1; // Shadow Handicraft [1] } } else if (.@eac&EAJL_2) { // Second Class (And not Third Class) switch(BaseJob) { // Second Class case Job_Knight: getitem 1163,1; break; // Claymore [0] case Job_Priest: getitem 1522,1; break; // Stunner [0] case Job_Wizard: getitem 1617,1; break; // Survivor's Rod [0] case Job_Blacksmith: getitem 1360,1; break; // Two-Handed-Axe [1] case Job_Hunter: getitem 1718,1; break; // Hunter Bow [0] case Job_Assassin: getitem 1254,1; break; // Jamadhar [0] case Job_Crusader: getitem 1410,1; break; // Lance [0] case Job_Monk: getitem 1807,1; break; // Fist [0] case Job_Sage: getitem 1550,1; break; // Book [3] case Job_Rogue: getitem 1222,1; break; // Damascus [1] case Job_Alchemist: getitem 1126,1; break; // Saber [2] case Job_Bard: getitem 1907,1; break; // Guitar [0] case Job_Dancer: getitem 1960,1; break; // Whip [1] case Job_Super_Novice: getitem 1208,1; break; // Main Gauche [4] case Job_Gunslinger: getitem 13101,1; break; // Six Shooter [2] case Job_Ninja: getitem 13010,1; break; // Asura [2] case Job_Star_Gladiator: getitem 1550,1; break; // Book [3] case Job_Soul_Linker: getitem 1617,1; break; // Survivor's Rod [0] } } else { // Neither Second or Third Cls // => First Cls or not covered by the switch switch(BaseClass) { // First Class case Job_Swordman: getitem 1108,1; break; // Blade [4] case Job_Mage: getitem 1602,1; break; // Rod [4] case Job_Archer: getitem 1705,1; break; // Composite Bow [4] case Job_Acolyte: getitem 1505,1; break; // Mace [4] case Job_Merchant: getitem 1302,1; break; // Axe [4] case Job_Thief: getitem 1208,1; break; // Main Gauche [4] } } return; } OnInit: // Initialisation, do not edit these .NPCName$ = "[Job Master]"; // Settings .ThirdClass = false; // Enable third classes? .RebirthClass = true; // Enable rebirth classes? .SecondExpanded = true; // Enable new expanded second classes: Ex. Super Novice, Kagerou/Oboro, Rebellion? .BabyNovice = true; // Enable Baby novice classes? Disable it if you like player must have parent to get job baby. .BabyClass = true; // Enable Baby classes? .BabyThird = false; // Enable Baby third classes? .BabyExpanded = false; // Enable Baby Expanded classes: Ex. Baby Ninja, Baby Taekwon, etc. .BabySummoner = false; // Enable Baby Summoner? .LastJob = true; // Enforce linear class changes? .SkillPointCheck = true; // Force player to use up all skill points? .Platinum = true; // Get platinum skills automatically? .GetJobEquip = true; // Get job equipment (mostly weapons) on job change? // Level Requirements setarray .Req_First[0],1,10; // Minimum base level, job level to turn into 1st class setarray .Req_Second[0],1,40; // Minimum base level, job level to turn into 2nd class setarray .Req_Rebirth[0],99,50; // Minimum base level, job level to rebirth setarray .Req_Third[0],99,50; // Minimum base level, job level to change to third class setarray .Req_Exp_NJ_GS[0],99,70; // Minimum base level, job level to turn into Expanded Ninja and Gunslinger setarray .Req_Exp_SNOVI[0],99,99; // Minimum base level, job level to turn into Expanded Super Novice .SNovice = 45; // Minimum base level to turn into Super Novice // Setting adjustments by PACKETVER if( PACKETVER < 20161207 ) { if( .BabyExpanded ) debugmes "jobmaster: BabyExpanded is disabled due to outdated PACKETVER."; if( .BabySummoner ) debugmes "jobmaster: BabySummoner is disabled due to outdated PACKETVER."; .BabyExpanded = false; .BabySummoner = false; } end; } Rebirth => Do You prefere Race Or Equipements: result => if Equipement give random item (40020,40021,40022,40023,40024,40025) or if Race (40030,40031,40032,40033,40034,40035). Thx for your help ^^
×
×
  • Create New...