

Racaae
Members-
Posts
269 -
Joined
-
Last visited
-
Days Won
42
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Everything posted by Racaae
-
Good evening yuno,157,83,3 script Portal Gatekeeper 4_M_PAY_SOLDIER,{ .@password$ = "luizinhomt"; //password .@portal$ = "Hidden Port0l#l"; //portal npc name npctalk "What is the password?", strnpcinfo(0), bc_self; input .@input$; unittalk getcharid(3), strcharinfo(0) + " : " + .@input$, bc_self; sleep2 500; if (!compare(.@input$,.@password$)) { npctalk "This is not the password.", strnpcinfo(0), bc_self; emotion ET_THINK, getnpcid(0); end; } npctalk "I will open a portal to another location.", strnpcinfo(0), bc_self; cloakoffnpcself .@portal$; specialeffect EF_BIG_PORTAL,SELF,.@portal$; end; } yuno,153,85,0 warp(CLOAKED) Hidden Port0l#l 1,1,yuno,0,0
-
Hi. please put scripts inside a code box next time, the indentation is all lost otherwise. //==== DarkRO Scripts ==================================== //= Credit Exchanger //===== By: ================================================== //= //===== Current Version: ===================================== //= 1.4 //===== Description: ========================================= //= Allow to Convert Zeny into a Ticket. //===== Changelog: =========================================== //= Not yet tested for bugs //= 1.0 Implementation //= 1.1 Re-script (added quest) //= 1.2 Automated zeny-to-credit exchange and vice-versa //= 1.3 Added @security checking. //= 1.4 Added Black Credit Exchange feature //============================================================ - script Credit Agent -1,{ set @header$,"[^FF8000 Credit Agent ^000000]"; .@credit_id = 40000; //Credit Item ID if (checksecurity()) { message strcharinfo(0), "You can't do this action, Protected by @security."; end; } if(#CREDITPASSPORT > gettimetick(2)) { disable_items; setpcblock(PCBLOCK_COMMANDS, true, getcharid(3)); getinventorylist(); mes @header$; mes "Hello, I can see that you still have your Intergalactical Passport."; mes " "; mes "What can I do for you?"; mes " "; mes "^FF0000Your current credit: " + F_InsertComma(countitem(.@credit_id)); next; switch(prompt("I want to change Zeny to Credit:I want to change Credit to Zeny.:Nothing, just passing by.")){ case 255: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); break; case 1: if (@inventorylist_count == MAX_INVENTORY && !countitem(.@credit_id)) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "You need to clear your inventory first."; close(); } mes @header$; mes "The exchange rate is fixed and its ^00008810,000,000^000000 Zeny = 1 ^FF0000Credit^000000."; mes " "; mes "How will you exchange your Zeny?"; next; .@i = prompt("Decide on how many Credits I need.:Exchange all my Zeny:Cancel"); if (.@i == 3) goto L_Cancel; else if (.@i == 255) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); break; } else if (.@i == 1) { mes @header$; mes "How much Credits do you need?"; mes " "; mes "^FF0000(Enter '0' to cancel the transaction)^000000"; next; input @ZTC; if (@ZTC <= 0) goto L_Cancel; else if (@ZTC > MAX_ZENY / 10000000) { L_Exceed: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "Sorry, but you have"; mes "exceeded from the limit."; close(); } else if (@ZTC > Zeny / 10000000) { L_LessZeny: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "You don't have enough zeny."; close(); } else { L_ConvertZTC: if (!checkweight(.@credit_id,@ZTC)) { mes @header$; mes "Sorry. You can't hold this amount of credit."; mes "Such amount would exceed your weight limit."; for(; @ZTC; @ZTC--) if (checkweight(.@credit_id,@ZTC)) break; if (@ZTC) { mes "You can only hold up to " + @ZTC + "."; mes "Would this amount do?"; next; if (select("Ok, " + @ZTC + " is acceptable", "No, just cancel") == 2) callsub L_Cancel; } else { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); close; } } mes @header$; mes "You will be receiving ^FF0000"+@ZTC+" Credit"+(@ZTC != 1 ? "s":"")+"^000000."; mes " "; mes "Proceed?"; next; .@menu = prompt("I changed my mind:Proceed!"); if (.@menu == 1) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); close(); break; } if (.@menu == 255) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); break; } setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); Zeny -= @ZTC * 10000000; getitem .@credit_id, @ZTC; mes @header$; mes "Here you go!"; mes "Thank you for using our service."; close(); } } else { @ZTC = Zeny / 10000000; if (@ZTC == 0) goto L_LessZeny; else goto L_ConvertZTC; } break; case 2: goto L_ConvertCTZ_Main; break; default: L_Cancel: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "Please do come back, Have a nice day!."; close; break; } end; } if(#CRED_Q == 1) { disable_items; setpcblock(PCBLOCK_COMMANDS, true, getcharid(3)); mes @header$; mes "Welcome back!, "+strcharinfo(0)+"."; mes "Do you have what I asked for?"; next; switch(prompt("Yes, here it is!:What do I need again?:I want to change Credit to Zeny.:Not yet.")){ case 255: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); break; case 1: if(Zeny < 100000000){ setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "I think you are missing something this is the list that i needed:"; mes "^FF0000100,000,000 Zeny^000000."; close; } next; mes @header$; mes "Congratulations, Enjoy your Intergalactical Passport."; mes " "; mes "You may now use Zeny to ^FF0000Credit^000000 services in a matter of time."; setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); Zeny -= 100000000; #CREDITPASSPORT = 1728000+ gettimetick(2); #CRED_Q = 0; close; break; case 2: mes @header$; mes "You will have to bring me the following:"; mes "^FF0000100,000,000 Zeny^000000."; next; setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "I suggest you look for Simon in Prontera. He is known as gumbling master that could provide you tickets."; mes " "; mes "I'll be waiting for you!"; close; break; case 3: goto L_ConvertCTZ_Main; break; case 4: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "Okay, Hurry up!"; close; break; } } mes @header$; mes "Hello, It looks like you don't have an Intergalactical Passport yet."; mes " "; mes "Would you like to have one?"; next; switch(prompt("Yes, I'd like to have one.:Intergalactical Passport? What is that?:I want to change Credit to Zeny.:No thanks!")){ case 1: mes @header$; mes "Very well. You will have to bring me the following:"; mes "^FF0000100,000,000 Zeny^000000."; next; mes @header$; mes "I suggest you look for Simon in Prontera. He is known as gumbling master that could provide you tickets."; mes " "; mes "I'll be waiting for you!"; #CRED_Q = 1; close; break; case 2: mes @header$; mes "An Intergalactical Passport is required to use the Intergalactical currency: ^FF0000Credit^000000."; mes " "; mes "The value of ^FF0000Credit^000000 is equivalent to ^00008810,000,000^000000 Zeny."; next; mes @header$; mes "Once you have this passport, You can exchange Zeny to ^FF0000Credit^000000 with any Credits Agents in major towns."; next; mes @header$; mes "^FF0000NOTE^000000: That the passport is not required when exchanging ^FF0000Credit^000000 to Zeny."; next; mes @header$; mes "That contract will last for 20 days. After that time, You will have to renew your passport."; close; break; case 3: disable_items; setpcblock(PCBLOCK_COMMANDS, true, getcharid(3)); L_ConvertCTZ_Main: mes @header$; mes "The exchange rate is fixed and its 1 ^FF0000Credit^000000 = ^00008810,000,000^000000 Zeny."; mes " "; mes "How will you exchange your ^FF0000Credits^000000?"; next; .@i = prompt("Decide how many Credits to exchange.:Exchange all my Credits:Cancel"); if (.@i == 3) goto L_Cancel; else if (.@i == 255) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); break; } else if (.@i == 1) { mes @header$; mes "How many ^FF0000Credits^000000 do you want to exchange?"; mes " "; mes "^FF0000(Enter '0' to cancel transaction)^000000"; next; input @CTZ; if (@CTZ <= 0) goto L_Cancel; else if (@CTZ > countitem(.@credit_id)) { L_LessCredit: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "You don't have enough Credits."; close(); } else { @CTZ_ = Zeny%10000000; if (@CTZ_ > 0) @CTZ_ = ((MAX_ZENY/10000000) - (Zeny/10000000)) - 1; else @CTZ_ = (MAX_ZENY/10000000) - (Zeny/10000000); if (@CTZ > (MAX_ZENY/10000000) || @CTZ_ < @CTZ ) goto L_Exceed; if (@CTZ > countitem(.@credit_id)) goto L_LessCredit; L_ConvertCTZ: mes @header$; mes "You will be exchanging your ^FF0000"+@CTZ+" Credit"+(@CTZ != 1 ? "s":"")+"^000000."; mes " "; mes "Proceed?"; next; .@menu = prompt("I changed my mind:Proceed!"); if (.@menu == 1) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); close(); break; } if (.@menu == 255) { setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); break; } delitem .@credit_id, @CTZ; Zeny += 10000000 * @CTZ; message(strcharinfo(0), "You have received "+F_InsertComma(10000000 * @CTZ)+" Z."); setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "Here you go!"; mes "Thank you for using our service."; close(); } close(); } else { @CTZ = countitem(.@credit_id); .@ZenyCap = (MAX_ZENY - Zeny) / 10000000; if (@CTZ == 0) goto L_LessCredit; if (@CTZ >= .@ZenyCap) @CTZ = .@ZenyCap; if (@CTZ == 0) goto L_Exceed; goto L_ConvertCTZ; } break; case 4: setpcblock(PCBLOCK_COMMANDS, false, getcharid(3)); mes @header$; mes "Please do come back, Have a nice day!."; close; break; } } // Duplicates //prontera,132,215,5 duplicate(Credit Agent) Credit Agent#prt 4_M_KHBOY market,99,53,6 duplicate(Credit Agent) Credit Agent#mall 4_M_KHBOY
-
Need to make this CashPoint Manager NPC work
Racaae replied to Heartfelt's question in Script Requests
Hi, I changed all acc_reg_num_db to acc_reg_num. This is the correct table name for rAthena. // --- //= Cash Point Manager v1.0 [Rokimoki] // * Add Cash Points // * Delete Cash Points // * Watch Cash Points // * Notify the player if an admin has added/deleted some cash to you. // * If the player is online it will tell which GM did. // * If the player is NOT online will show a notification when logged in but will not tell the GM who did it. // * Logs system. Must be 'log_npc: true' in conf/map/logs.con file. // -> If somebody put wrong password in whisp system. // -> If add/delete cash points. // --- //= This works if you are online or not, if online don't use SQL if offline use SQL. // --- //= v2.0 [Rokimoki] // * Recycled this old script and adapted to Hercules database // * Transtaled to English // --- - script donations -1,{ OnWhisperGlobal: .@p$ = "yourpassword"; //Leave empty ("") to disable staff password if (getgmlevel() < 90) { // If you are not admin just tell you how many cash you have. dispbottom "Your have: [" + #CASHPOINTS + "] CashPoints."; end; } // End if if (.@p$ != "" && strcmp(@whispervar0$,.@p$) != 0) { // Password system, change 'yourpassword' for any password you want message strcharinfo(0), "CashPoint Manager : Input the correct password."; logmes "User: " +strcharinfo(0) +" with account_id: " +getcharid(3) +" typed a wrong password, he wrote: " +@whispervar0$; // Just for watch if bruteforcing or something end; } // End if deletearray .@username$[0], 128; // Debug deletearray .@accid[0], 128; message strcharinfo(0), "CashPoint Manager : Welcome Staff member " + strcharinfo(0) + "!"; switch (select("Add Cash Points:Delete Cash Points:Watch Cash Points:End")) { case 1: // Add cash points callfunc("CashPoints",1); break; case 2: // Delete cash points callfunc("CashPoints",2); break; case 3: // Watch cash points callfunc("CashPoints",3); break; case 4: // Close } // End switch end; OnPCLoginEvent: // Offline notifications if (#CASHPOINTS < lastCash) dispbottom "Some administrator deleted some CashPoints, current balance: [" + #CASHPOINTS +"], before: [" + lastCash + "]"; else if (#CASHPOINTS > lastCash) dispbottom "Some administrator added some CashPoints, current balance: [" + #CASHPOINTS +"], before: [" + lastCash + "]"; set lastCash, #CASHPOINTS; end; OnInit: bindatcmd strnpcinfo(1),strnpcinfo(3)+"::OnWhisperGlobal"; end; } // End Script function script CashPoints { if (select("Select by character name:Select by login username") == 1) { mes "Input character name: "; next; input .@charName$; query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" +escape_sql(.@charName$) +"'", .@accid[0]; } else { mes "Input login username: "; next; input .@loginName$; query_sql "SELECT `account_id` FROM `login` WHERE `userid` = '" +escape_sql(.@loginName$) +"'", .@accid[0]; } // End if if (!.@accid[0]) { mes "Invalid information, error occurred: account or character not found."; close; } // End if if (getarg(0) == 3) { // Watch Cash Points if (isloggedin(.@accid[0])) { // If player is online // Save GM information set .@gm$, strcharinfo(0); set .@id, getcharid(3); detachrid; // Attach player in this script attachrid(.@accid[0]); set .@cash, #CASHPOINTS; // Save Cash Points amount detachrid; attachrid(.@id); mes .@npcName$; mes "This player has: [^FF0000" +.@cash +"^000000] Cash Points."; } else { // If offline query_sql "SELECT `value` FROM `acc_reg_num` WHERE `key` = '#CASHPOINTS' AND `account_id` = " +.@accid[0], .@value[0]; // Save Cash Points amount if (!.@value[0]) mes "He has [^FF00000^000000] Cash Points."; // 0 cash else mes "He has [^FF0000" +.@value[0] +"^000000] Cash Points."; // if he has cash } // End if close; } // End if mes .@npcName$; mes "Input Cash Point amount, range: 1~100"; // Change here too if you want to show proper information next; input .@amount, -1000, 1000; // Debug if (.@amount < 1 || .@amount > 100) { // Define in this if the amount you want to limit (just the right part) mes .@npcName$; mes "Invalid amount, input in the proper range told."; close; } // End if if (isloggedin(.@accid[0])) { // If player is online // Save GM information set .@gm$, strcharinfo(0); set .@id, getcharid(3); detachrid; // Attach player attachrid(.@accid[0]); set .@cash, #CASHPOINTS; // Save current cash if (getarg(0) == 1) { // Add cash set #CASHPOINTS, #CASHPOINTS + .@amount; // Add cash dispbottom "This admin: [" + .@gm$ +"] added: " +.@amount +" cash points, current balance: [" +#CASHPOINTS + "]"; // Online notification } else if (getarg(0) == 2) { // Delete cash if (.@cash <= 0) { detachrid; attachrid(.@id); mes .@npcName$; mes "You can not delete cash points, this player has no cash points."; close; } else if (.@cash - .@amount < 0) { detachrid; attachrid(.@id); mes .@npcName$; mes "You can not delete more cash than he already has, you are allowed to remove: [^FF0000" +.@cash +"^000000] cash points."; close; } // End if set #CASHPOINTS, #CASHPOINTS - .@amount; // Delete cash dispbottom "This admin [" + .@gm$ +"] deleted: " +.@amount +" cash points, current balance: " +#CASHPOINTS; // Online notification set .@action, 1; // Cash deleted flag } // End if detachrid; attachrid(.@id); } else { // If offline query_sql "SELECT `key` FROM `acc_reg_num` WHERE `account_id` = " + .@accid[0], .@username$[0]; // check current cash if (.@username$[0] != "#CASHPOINTS") { // If empty, never had Cash Points if (getarg(0) == 1) { // add cash query_sql "INSERT INTO `acc_reg_num`(`account_id`, `key`, `index`, `value`) VALUES ('" + .@accid[0] + "','#CASHPOINTS','0','" + .@amount + "')"; // create the data } else { // delete cash mes .@npcName$; mes "You can not delete cash points, this player has no cash points."; close; } // End if } else { // Player had or has Cash Points if (getarg(0) == 1) { // add cash query_sql "UPDATE `acc_reg_num` SET `value` = `value` + '" +.@amount +"' WHERE `key` = '#CASHPOINTS' and `account_id` = '" +.@accid[0] +"'"; // update cash } else { // delete cash query_sql "SELECT `value` FROM `acc_reg_num` WHERE `key` = '#CASHPOINTS' and `account_id` = " +.@accid[0], .@value[0]; // check current cash mes .@npcName$; if (.@value[0] <= 0) { mes "You can not delete cash points, this player has no cash points."; close; } else if (.@value[0] - .@amount < 0) { mes "You can not delete more cash than he already has, you are allowed to remove: [^FF0000" + .@value[0] + "^000000] cash points."; close; } // End if query_sql "UPDATE `acc_reg_num` SET `value` = `value` - '" + .@amount + "' WHERE `key` = '#CASHPOINTS' and `account_id` = '" + .@accid[0] + "'"; set .@action, 1; // Cash deleted flag } // End if } // End if } // End if // Saving logs if (!.@action) logmes "User: " + strcharinfo(0) + " with account_id: " + getcharid(3) + " added " + .@amount +" Cash Points to: " + .@accid[0]; else logmes "User: " + strcharinfo(0) + " with account_id: " + getcharid(3) + " removed " + .@amount +" Cash Points to: " + .@accid[0]; mes "Cash Points successfully sent, when the players log in will receive a notification, thanks for using this service."; return; } // End function -
Hello //============================================================ //= Last Standing (try your luck guessing O or X) by Racaae //============================================================ //= https://rathena.org/board/topic/141331-r-mini-game-last-man-standing/ //============================================================ prontera,147,150,0 script Evento Last Standing PORTAL,{ emotion F_Rand(ET_O,ET_X), getnpcid(0); mes "[" + strnpcinfo(1) + "]"; if ($@laststanding == 1) { mes "Quer participar do evento?"; if (select("Sim", "Não") == 2) { clear; if (checkweight(1119,3) == 0) { mes "- Você tem muitos itens."; mes "Organize seu inventário e tente novamente. -"; close; } mes "[" + strnpcinfo(1) + "]"; mes "Até mais."; close; } warp "quiz_02",249,385; end; } mes "O evento começa sempre aos 45 minutos de cada hora."; mes "Por exemplo, 10:45 12:45 18:45"; if (getgroupid() >= 99) mes " ", "^0000ffDigite @LastStanding para acessar o menu GM^000000"; close; OnMinute45: if ($@laststanding != 0) end; OnOpen: cloakonnpc "O#luckyevent"; cloakonnpc "X#luckyevent"; cloakonnpc "O#luckyevent2"; cloakonnpc "X#luckyevent2"; waitingroom "Venha Participar!", 0; announce "Last Standing : O portal para o evento se abriu em Prontera!! 5 minutos até que ele se feche!",0; $@laststanding = 1; sleep 120000; if ($@laststanding != 1) end; announce "Last Standing : O portal para o evento fechará em 3 minutos!",0; sleep 60000; if ($@laststanding != 1) end; announce "Last Standing : O portal para o evento fechará em 1 minuto!",0; sleep 60000; if ($@laststanding != 1) end; announce "Last Standing : O portal para o evento se fechou!",0; donpcevent strnpcinfo(0) + "::OnStart"; end; OnStart: $@laststanding = 2; delwaitingroom; sleep 3000; areaannounce "quiz_02",220,330,280,395,"Bem vindos ao evento Last Standing. O ou X será escolhido aleatoriamente.",bc_blue; sleep 4000; areaannounce "quiz_02",220,330,280,395,"Tudo que você precisa fazer é ir até a área que você acha que foi escolhida.",bc_blue; sleep 4000; areaannounce "quiz_02",220,330,280,395,"Exemplo, se eu escolher X, todos os aventureiros que estiverem em O perdem.",bc_blue; sleep 4000; areaannounce "quiz_02",220,330,280,395,"Faremos isso de novo e de novo até termos 1 aventureiro sobrevivente.",bc_blue; sleep 4000; areaannounce "quiz_02",220,330,280,395,"Antes que eu esqueça, você deve entrar em uma das áreas! Qualquer um do lado de fora será automaticamente desclassificado!",bc_blue; sleep 4000; areaannounce "quiz_02",220,330,280,395,"É isso... Agora vamos começar!",bc_blue; sleep 4000; .@num = getareaunits(BL_PC,"quiz_02",220,330,280,395,$@ls_players$[0]); if (.@num == 0) { $@laststanding = 0; end; } goto L_start; L_start: if ($@laststanding != 2) end; cloakoffnpc "O#luckyevent"; cloakoffnpc "X#luckyevent"; cloakoffnpc "O#luckyevent2"; cloakoffnpc "X#luckyevent2"; areaannounce "quiz_02",220,330,280,395,"Por favor, vá até uma das áreas desejadas Vai! Vai! Vai!",bc_blue; sleep 10000; if ($@laststanding != 2) end; areaannounce "quiz_02",220,330,280,395,"5",bc_blue; sleep 1500; if ($@laststanding != 2) end; areaannounce "quiz_02",220,330,280,395,"4",bc_blue; sleep 1500; if ($@laststanding != 2) end; areaannounce "quiz_02",220,330,280,395,"3",bc_blue; sleep 1500; if ($@laststanding != 2) end; areaannounce "quiz_02",220,330,280,395,"2",bc_blue; sleep 1500; if ($@laststanding != 2) end; areaannounce "quiz_02",220,330,280,395,"1",bc_blue; sleep 1000; if ($@laststanding != 2) end; cloakonnpc "O#luckyevent"; cloakonnpc "X#luckyevent"; cloakonnpc "O#luckyevent2"; cloakonnpc "X#luckyevent2"; sleep 500; .@w = rand(2); areaannounce "quiz_02",220,330,280,395,"E o escolhido foi " + (.@w?"X":"O") + "!",bc_blue; .@num_e = getareaunits(BL_PC,"quiz_02",220,330,280,395,.@emote[0]); for (.@i = 0; .@i < .@num_e; .@i++) emotion (.@w?ET_X:ET_O), .@emote[.@i]; sleep 1500; if ($@laststanding != 2) end; deletearray $@ls_players, getarraysize($@ls_players); if (.@w) { // X choosen areawarp "quiz_02",220,330,248,358,"quiz_02",241,364,258,375; .@num = getareaunits(BL_PC,"quiz_02",250,330,275,358,$@ls_players[0]); } else { // O choosen areawarp "quiz_02",250,330,275,358,"quiz_02",241,364,258,375; .@num = getareaunits(BL_PC,"quiz_02",220,330,248,358,$@ls_players[0]); } if (.@num == 0) { announce "Last Standing : Ninguém venceu o evento.",bc_all; sleep 3000; donpcevent strnpcinfo(0) + "::OnEnd"; } if (.@num == 1) { donpcevent strnpcinfo(0) + "::OnWinner"; end; } areaannounce "quiz_02",220,330,280,395,.@num + " aventureiros acertaram! Preparem-se para outra rodada.",bc_blue; sleep 4000; callsub L_start; OnWinner: announce "Last Standing : " + convertpcinfo($@ls_players[0],CPC_NAME) + " ganhou o evento!",bc_all; getitem 607,10,$@ls_players[0]; // prêmio do vencedor specialeffect2 EF_MVP, AREA, convertpcinfo($@ls_players[0],CPC_NAME); sleep 3000; if ($@laststanding != 2) end; areaannounce "quiz_02",220,330,280,395,"Obrigado por psrticipar! Você será teleportado em 10 segundos.",bc_blue; sleep 10000; if ($@laststanding != 2) end; donpcevent strnpcinfo(0) + "::OnEnd"; end; OnEnd: if ($@laststanding == 1) announce "Last Standing : O evento foi cancelado.",0; delwaitingroom; $@laststanding = 0; areawarp "quiz_02",220,330,280,395,"prontera",150,150; end; OnInit: bindatcmd "laststanding",strnpcinfo(3)+"::OnAtcommand",99,99; $@laststanding = 0; end; OnAtcommand: message strcharinfo(0), "Controle GM do evento Last Standing"; switch(select("Cancelar", "^0000FFComeçar evento^000000", "^0000FFTerminar evento^000000", "Ir para o mapa")) { case 1: end; case 2: if ($@laststanding == 0) { donpcevent strnpcinfo(0) + "::OnOpen"; message strcharinfo(0), "Ação confirmada!"; end; } if ($@laststanding == 1) { mes "O portal do evento já está aberto para jogadores irem entrando."; mes "Quer fechar o portal e iniciar o evento agora?"; if (select("Manter portal aberto", "^0000FFFechar portal e iniciar^000000") == 1) close; if ($@laststanding == 1) { donpcevent strnpcinfo(0) + "::OnStart"; message strcharinfo(0), "Ação confirmada!"; } close; } message strcharinfo(0), "Evento já está em andamento"; end; case 3: if ($@laststanding != 0) { donpcevent strnpcinfo(0) + "::OnEnd"; message strcharinfo(0), "Ação confirmada!"; end; } message strcharinfo(0), "Evento não foi iniciado."; end; case 4: warp "quiz_02",249,385; end; } end; } quiz_02,255,384,3 script SAÍDA#laststanding PORTAL,{ npctalk "Quer sair do evento?", strnpcinfo(0), bc_self; if (select("Ficar aqui", "^FF0000Sair do evento^000000") == 2) warp "prontera",150,150; end; } quiz_02,237,365,0 script O#luckyevent 1_SHADOW_NPC,14,7,{ if ($@ls_players[0] && inarray($@ls_players, getcharid(3)) == -1) npctalk "Você não está mais participando.", strnpcinfo(0), bc_self; else warp "quiz_02",237,345; end; OnTouch: npctalk "Clique aqui se escolhe O", strnpcinfo(0), bc_self; emotion ET_O, getnpcid(0); end; } quiz_02,262,365,0 script X#luckyevent 1_SHADOW_NPC,14,7,{ if ($@ls_players[0] && inarray($@ls_players, getcharid(3)) == -1) npctalk "Você não está mais participando.", strnpcinfo(0), bc_self; else warp "quiz_02",262,345; end; OnTouch: npctalk "Clique aqui se escolhe X", strnpcinfo(0), bc_self; emotion ET_X, getnpcid(0); end; } quiz_02,237,357,0 warp O#luckyevent2 1,1,quiz_02,250,366 quiz_02,262,357,0 warp X#luckyevent2 1,1,quiz_02,249,366 quiz_02 mapflag nowarp quiz_02 mapflag nowarpto quiz_02 mapflag noskill quiz_02 mapflag noteleport quiz_02 mapflag nomemo quiz_02 mapflag nosave SavePoint quiz_02 mapflag noicewall quiz_02 mapflag noloot
-
Error : script error on npc/custom/new_train_ground.txt line 402 need '('
Racaae replied to Dolphin86's question in Scripting Support
Hi. "cooking" is a script command. You can't use it as a variable name. Just rename the variable to something else. -
[Error] : script:op_2: invalid data for operator C_NE (Cashpoint on kill script)
Racaae replied to Necrosx's question in Scripting Support
Hello. Using getunitdata inside a if statement is causing the error. Don't know why. Try: - script cashpoints -1,{ OnInit: setarray .champions$,"Elusive","Furious","Ringleader","Solid","Swift"; end; OnNPCKillEvent: .@exists = getunitdata(killedgid, .@data); if ( .@exists != -1 ){ .@mode = .@data[UMOB_MODE]; if(.@mode & MD_MVP){ if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) #CASHPOINTS += rand( 5, 10 ); else #CASHPOINTS += rand( 10, 15 ); //MVP } else if(.@mode & MD_STATUSIMMUNE){ if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) #CASHPOINTS += rand( 3, 8 ); else #CASHPOINTS += rand( 8, 13 ); //miniboss }else { for(.@i = 0; .@i < getarraysize(.champions$); .@i++){ if(compare(.@mobname$,.champions$[.@i])){ if ( getmonsterinfo( killedrid, MOB_LV ) < 71 ) #CASHPOINTS += rand( 1, 3 ); else #CASHPOINTS += rand( 3, 6 ); //cashpoints break; } } //Champion tests } } end; } -
//===== rAthena Script ======================================= //= Reset NPC //===== Description: ========================================= //= Resets skills, stats, or both. //===== Additional Comments: ================================= //= 1.0 First Version //= 1.1 Optimized for the greater good. [Kisuka] //= 1.2 Cleaning [Euphy] //= 1.3 All statuses removed upon skill reset. [Euphy] //= 1.4 Compressed Script, Added limit use option [Stolao] //= Changed set -> setarray, Improved text with F_InsertPlural //= 1.5 Added sc_end_class to reset related status changes [sader1992] //============================================================ // https://rathena.org/board/topic/141328-requesting-for-custom-reset-girl/ //============================================================ prontera,150,193,4 script Custom Reset Girl 124,{ // 1st, 2nd, 3rd, Limit setarray .@Reset, 0, 3000000, 5000000, 0; mes "[Reset Girl]"; if(.@Reset[3] && reset_limit > .@Reset[3]) { mes "Sorry you can only reset "+callfunc("F_InsertPlural",.@Reset[3],"time")+" in your life."; close; } mes "I am the Reset Girl."; mes "Please select the service you want:"; if (.@Reset[3]) mes "You may only reset "+callfunc("F_InsertPlural",.@Reset[3],"time")+", so use "+((.@Reset[3]>1)?"them":"it")+" wisely."; mes " "; mes "1st reset: " + (.@Reset[0]?F_InsertComma(.@Reset[0])+"z":"free"); mes "2nd reset: " + F_InsertComma(.@Reset[1]) +"z"; mes "3rd onwards: " + F_InsertComma(.@Reset[2]) +"z"; next; set .@i,(select("^FF3355Reset Skills:Reset Stats:Reset Both^000000:Cancel")); if(.@i > 3) close; .@z = .@Reset[(reset_limit>2?2:reset_limit)]; mes "[Reset Girl]"; if (Zeny < .@z) { mes "Sorry, you don't have enough Zeny."; close; } if(.@Reset[3]){ mes "You can only reset "+callfunc("F_InsertPlural",.@Reset[3],"time")+" in your life, are you sure?"; if(select("Let me think:That's fine") == 1) close; } Zeny -= .@z; if(.@i&1){ sc_end_class; ResetSkill; } if(.@i&2) ResetStatus; mes "There you go!"; reset_limit++; close; }
-
Hi //===== rAthena Script ======================================= //= Reset NPC //===== Description: ========================================= //= Resets skills, stats, or both. //===== Additional Comments: ================================= //= 1.0 First Version //= 1.1 Optimized for the greater good. [Kisuka] //= 1.2 Cleaning [Euphy] //= 1.3 All statuses removed upon skill reset. [Euphy] //= 1.4 Compressed Script, Added limit use option [Stolao] //= Changed set -> setarray, Improved text with F_InsertPlural //= 1.5 Added sc_end_class to reset related status changes [sader1992] //============================================================ prontera,150,193,4 script Custom Reset Girl 124,{ // Skills, Stats, Both, Limit setarray .@Reset, 1000000, 1000000, 1000000, 0; mes "[Reset Girl]"; if(.@Reset[3] && reset_limit > .@Reset[3]) { mes "Sorry you can only reset "+callfunc("F_InsertPlural",.@Reset[3],"time")+" in your life."; close; } mes "I am the Reset Girl."; mes "Each time you reset the price of the next reset will increase by " + F_InsertComma(.@Reset[2]) + "z."; if (reset_limit) { .@Reset[0] *= reset_limit; .@Reset[1] *= reset_limit; .@Reset[2] *= reset_limit; mes "Reset Stats: "+ callfunc("F_InsertComma",.@Reset[1]) +"z"; mes "Reset Skills: "+ callfunc("F_InsertComma",.@Reset[0]) +"z"; mes "Reset Both: "+ callfunc("F_InsertComma",.@Reset[2]) +"z"; } else mes "Since it's your 1st time, the reset is free!"; if (.@Reset[3]) mes "You may only reset "+callfunc("F_InsertPlural",.@Reset[3],"time")+", so use "+((.@Reset[3]>1)?"them":"it")+" wisely."; mes "Please select the service you want:"; next; set .@i,(select("^FF3355Reset Skills:Reset Stats:Reset Both^000000:Cancel")); if(.@i > 3) close; if (!reset_limit) .@Reset[.@i-1] = 0; mes "[Reset Girl]"; if (Zeny < .@Reset[.@i-1]) { mes "Sorry, you don't have enough Zeny."; close; } if(.@Reset[3]){ mes "You can only reset "+callfunc("F_InsertPlural",.@Reset[3],"time")+" in your life, are you sure?"; if(select("Let me think:That's fine") == 1) close; } set Zeny, Zeny-.@Reset[.@i-1]; if(.@i&1){ sc_end_class; ResetSkill; } if(.@i&2) ResetStatus; mes "There you go!"; reset_limit++; close; }
-
EXAMPLE Open a text editor program and paste the whole card seller script. Click the save option, save it in your server folder /npc/ and name it carloscardseller.txt Now on npc/scripts_custom, add a empty new line at the end of the file and add: If you are using rAthena: npc: npc/carloscardseller.txt Just like this, if you are using Hercules: // Custom "npc/custom/support_me.txt", "npc/carloscardseller.txt", All NPCs in the server comes from txt files. Each line is a different file. So you're adding your file with your NPC so the server knows where it is, simple.
-
Hi. From rAthena wiki: New scripts must be saved as a text file first. The file may be located anywhere in the rAthena directory, but is in the npc folder by default. So create a .txt file and paste the script in it. For an NPC to be loaded, it needs to be added to a .conf file. This is typically npc/scripts_custom.conf. Add a line, and enter your NPC file in the following format: npc: npc/path/to/your_card_seller_script.txt After adding the script, it must be loaded before the script contents take effect in game. There are a few ways to do this. The map server can be rebooted. This is generally the safest route though not the most convenient for active servers. The GM command @reloadscript maybe used in game, though this may cause monster spawn bugs.
-
Hi. Update your rAthena or find all lines with enablenpc(); / disablenpc(); and add strnpcinfo(0) between the round brackets. Example: enablenpc(); disablenpc(); To: enablenpc(strnpcinfo(0)); disablenpc(strnpcinfo(0));
-
Hi. Yeah, giving custom points to things like Blacksmith' weapon forging, or Alchemist's potion creation is not possible with default scripting. But if it's "crafting" using NPCs, its simple using variables. "custom_points" is not the same as "@custom_points". @variables are lost when the player logout. Just remove the @ and the points will stay. More here: (from \doc\script_commands.txt) mes "Click me to gain points"; next; switch(select("- Get Points:- Cancel")){ case 1: mes "(script get points) +1 custom points"; // Increase the value by 1. Basically gives 1 point to the player custom_points += 1; close; case 2: mes "Cancel"; close; } More Examples: mes "You got 3 points"; custom_points += 3; mes "You made the potion You got 1 point"; custom_points++; mes "You crafted the armor. You got 98346 points"; custom_points += 98346; mes "You did my task. You got 100 temporary points."; mes "You will lose them when you logout"; mes "They are unrelated to others points."; @custom_points += 100; mes "You crafted all the armors."; mes "You got 50 account points. Every character you have can spend them."; mes "They are unrelated to others points."; #custom_points += 50; Spending means losing, so just decrease the variable. Examples: mes "Ok. I will give you the Emperium for 5 points"; custom_points -= 5; getitem "EMPELIUM", 1; mes "Ok. I will give you the 15 Apples for 1 point"; custom_points--; getitem "APPLE", 15; mes "Ok. I will give you the this special buff effect. You spent 8151 points for it."; custom_points -= 8151; sc_start SC_GLORIA,300000,5; mes "OK. You spent 100 points to unlock +10 DMG weapons chance."; weapon_points -= 100; unlocked_10_dmg = true;
-
Oi, acha essa linha: getmapxy(.M$,.x,.y,1,strnpcinfo(0)); E substitui por: getmapxy(.M$,.x,.y,BL_NPC);
-
Hello. Useable Item function example: - Id: 12000000 AegisName: Task_Book Name: Task Book Type: DelayConsume Script: | callfunc "F_custom_points_item"; function script F_custom_points_item { mes "You have ^0055FF" + @custom_points + "^000000 Points."; close; } //===== rAthena Script ======================================= //= Hunting Missions //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.4 //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Random hunting missions. //= Rewards are based on quest difficulty. //= //= NOTE: Requires SQL mob database. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.1 Small improvements and fixes. //= 1.2 Added party support and replaced blacklists with an //= SQL query, both thanks to AnnieRuru. //= 1.3 Re-added a blacklist adapted for the SQL query. //= 1.3a Added mission reset options. //= 1.3b Function updates. //= 1.4 Check for deleted characters, thanks to AnnieRuru. //= Syntax updates and style cleaning. //============================================================ yuno,160,85,3 script Hunting Tasks 4_F_EDEN_MASTER,{ function Chk; cutin "arquien_n_atnad01", 2; mes "[Hunting Tasks]"; mes "Hello, " + strcharinfo(0) + "!"; if (!#Task_Delay) { next; mes "[Hunting Tasks]"; mes "I can't find any records..."; mes "You must be new here!"; emotion ET_HUK; next; callsub Task_Info; emotion ET_GO; #Task_Delay = 1; close3; } mes F_Rand("Working hard, as always...", "Not slacking, I hope..."); mes "Is there anything I can help"; mes "you with?"; mes " "; mes "^777777~ You've completed " + F_InsertPlural(Task_Total,"task",0,"^0055FF%d^777777 %s") + ". ~^000000"; next; switch(select( ((!Task0) ? " ~ New Task::" : ": ~ Task Status: ~ Abandon Task") + ": ~ Information: ~ Task Shop: ~ View Top Hunters: ~ ^777777Cancel^000000" )) { case 1: mes "[Hunting Tasks]"; if (#Task_Count) { mes "You've started a task"; mes "on another character."; if (!@hm_char_del_check) { // check for deleted character query_sql("SELECT 1 FROM `char_reg_num` WHERE `key` = 'Task0' AND `char_id` IN(SELECT `char_id` FROM `char` WHERE `account_id` = " + getcharid(3) + ")", .@i); if (!.@i) { next; mes "[Hunting Tasks]"; mes "I can't seem to find any records"; mes "for that character, though..."; mes "One moment, please."; emotion ET_SCRATCH; #Task_Count = 0; } @hm_char_del_check = true; } close3; } if (#Task_Delay > gettimetick(2) && .Delay) { mes "I'm afraid you'll have to wait " + Time2Str(#Task_Delay) + " before taking another task."; close3; } mes "You must hunt:"; if (.no_sql) { for (.@i = 0; .@i < .Quests; .@i++) { do { .@id = getrandmobid(MOBG_BRANCH_OF_DEAD_TREE, RMF_ALL, BaseLevel+15); } while (countinarray(.@mob, .@id) || (BaseLevel<=99 && strmobinfo(3,.@id) < BaseLevel-20) || (BaseLevel>99 && strmobinfo(3,.@id) < 90)); setarray .@mob[.@i],.@id; } } else query_sql("SELECT ID FROM `" + .mob_db$ + "` WHERE left(name_aegis, 4) != 'meta' AND left(name_aegis, 2) != 'E_' AND base_exp > 0 AND job_exp > 0 AND (class != 'boss' OR class is null) AND (drop3_item like '%_card' OR drop4_item like '%_card' OR drop5_item like '%_card' OR drop6_item like '%_card' OR drop7_item like '%_card' OR drop8_item like '%_card' OR drop9_item like '%_card' OR drop10_item like '%_card') AND ID < 2000 AND instr('"+.Blacklist$+"',ID) = 0 ORDER BY rand() LIMIT " + .Quests, .@mob); for (.@i = 0; .@i < .Quests; .@i++) { setd "Task" + .@i, .@mob[.@i]; setd "Task" + .@i +"_", 0; } #Task_Count = rand(.Count[0], .Count[1]); callsub Task_Status; next; mes "[Hunting Tasks]"; mes "Report back when"; mes "you've finished."; mes "Good luck!"; close3; case 2: mes "[Hunting Tasks]"; mes "Task status:"; callsub Task_Status; close3; case 3: mes "[Hunting Tasks]"; mes "Do you really want to"; mes "abandon your task?"; if (.Reset < 0 && .Delay) mes "Your delay time will not be reset."; else if (.Reset > 0) mes "It will cost " + F_InsertComma(.Reset) + " Zeny."; next; switch(select(" ~ Abandon...: ~ ^777777Cancel^000000")) { case 1: if (.Reset > 0) { if (Zeny < .Reset) { mes "[Hunting Tasks]"; mes "You don't have enough"; mes "Zeny to drop this task."; emotion ET_SORRY; close3; } Zeny -= .Reset; emotion ET_MONEY; } mes "[Hunting Tasks]"; mes "Alright, I've dropped"; mes "your current task."; specialeffect2 EF_STORMKICK4; for (.@i = 0; .@i < .Quests; .@i++) { setd "Task"+.@i, 0; setd "Task"+.@i+"_", 0; } #Task_Count = 0; if (.Reset < 0 && .Delay) #Task_Delay = gettimetick(2) + (.Delay * 3600); close3; case 2: mes "[Hunting Tasks]"; mes "I knew you were kidding!"; mes "Keep up the good work."; emotion ET_SMILE; close3; } case 4: callsub Task_Info; close3; case 5: mes "[Hunting Tasks]"; mes "You have ^0055FF" + @custom_points + "^000000 Task Points."; mes "Use them well!"; callshop "task_shop",1; npcshopattach "task_shop"; end; case 6: mes "[Hunting Tasks]"; mes "The top hunters are:"; query_sql("SELECT char_id AS id, (SELECT `name` FROM `char` WHERE char_id = id),`value` FROM `char_reg_num` WHERE `key` = 'Task_Total' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5", .@id, .@name$, .@val); for (.@i = 0; .@i < 5; .@i++) mes " [Rank " + (.@i+1) + "] " + ((.@name$[.@i] == "") ? "^777777none" : "^0055FF" + .@name$[.@i]+"^000000 : ^FF0000" + .@val[.@i] + " pt.") + "^000000"; close3; case 7: mes "[Hunting Tasks]"; mes "Nothing? Okay..."; emotion ET_SCRATCH; close3; } end; Task_Status: @f = false; deletearray .@j[0], getarraysize(.@j); for (.@i = 0; .@i < .Quests; .@i++) { .@j[.@i] = getd("Task" + .@i); .@j[.Quests] = .@j[.Quests] + strmobinfo(3,.@j[.@i]); .@j[.Quests+1] = .@j[.Quests+1] + (strmobinfo(6,.@j[.@i]) / (getbattleflag("base_exp_rate") / 100) * .Modifier[0]); .@j[.Quests+2] = .@j[.Quests+2] + (strmobinfo(7,.@j[.@i]) / (getbattleflag("job_exp_rate") / 100) * .Modifier[1]); mes " > "+Chk(getd("Task"+.@i+"_"),#Task_Count) + strmobinfo(1,.@j[.@i]) + " (" + getd("Task"+.@i+"_") + "/" + #Task_Count + ")^000000"; } // Reward formulas: .@Task_Points = 3 + (.@j[.Quests] / .Quests / 6); .@Base_Exp = #Task_Count * .@j[.Quests+1] / 5; .@Job_Exp = #Task_Count * .@j[.Quests+2] / 5; .@Zeny = #Task_Count * .Quests * .@j[.@i] * .Modifier[2]; next; mes "[Hunting Tasks]"; mes "Task rewards:"; mes " > Task Points: ^0055FF" + .@Task_Points + "^000000"; if (.Modifier[0]) mes " > Base Experience: ^0055FF" + F_InsertComma(.@Base_Exp) + "^000000"; if (.Modifier[1]) mes " > Job Experience: ^0055FF" + F_InsertComma(.@Job_Exp) + "^000000"; if (.Modifier[2]) mes " > Zeny: ^0055FF" + F_InsertComma(.@Zeny) + "^000000"; if (@f) { @f = false; return; } next; mes "[Hunting Tasks]"; mes "Oh, you're done!"; mes "Good work."; mes "Here's your reward."; emotion ET_BEST; specialeffect2 EF_ANGEL; specialeffect2 EF_TRUESIGHT; @custom_points += .@Task_Points; BaseExp += .@Base_Exp; JobExp += .@Job_Exp; Zeny += .@Zeny; for (.@i = 0; .@i < .Quests; .@i++) { setd "Task" + .@i, 0; setd "Task" + .@i+"_", 0; } #Task_Count = 0; if (.Delay) #Task_Delay = gettimetick(2) + (.Delay * 3600); Task_Total++; if (Task_Total == 1) query_sql("INSERT INTO `char_reg_num` (`char_id`,`key`,`index`,`value`) VALUES (" + getcharid(0) + ",'Task_Total','0',1)"); else query_sql("UPDATE `char_reg_num` SET `value` = " + Task_Total + " WHERE `char_id` = " + getcharid(0) + " AND `key` = 'Task_Total'"); close3; Task_Info: mes "[Hunting Tasks]"; 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 Tasks]"; mes "Tasks points are shared"; mes "amongst all your characters."; if (.Delay) mes "Delay time is, too."; mes "You can't take tasks on"; mes "multiple characters at once."; next; mes "[Hunting Tasks]"; mes "You can start a quest"; mes (.Delay ? "every " + ((.Delay == 1) ? "hour." : .Delay + " hours.") : "whenever you want."); mes "That's everything~"; return; function Chk { if (getarg(0) < getarg(1)) { @f = true; return "^FF0000"; } else return "^00FF00"; } OnBuyItem: .@size = getarraysize(@bought_nameid); for (.@i = 0; .@i < .@size; .@i++) { .@j = inarray(.Shop, @bought_nameid[.@i]); .@cost += (.Shop[.@j+1] * @bought_quantity[.@i]); } mes "[Hunting Tasks]"; if (.@cost > @custom_points) mes "You don't have enough Task Points."; else { for (.@i = 0; .@i < .@size; .@i++) { getitem @bought_nameid[.@i], @bought_quantity[.@i]; dispbottom "Purchased " + @bought_quantity[.@i] + "x " + getitemname(@bought_nameid[.@i]) + "."; } @custom_points -= .@cost; mes "Deal completed."; emotion ET_MONEY; } deletearray @bought_nameid[0], .@size; deletearray @bought_quantity[0], .@size; close3; OnNPCKillEvent: if (!getcharid(1) || !.Party) { if (!#Task_Count || !Task0) end; for (.@i = 0; .@i < .Quests; .@i++) { if (strmobinfo(1,killedrid) == strmobinfo(1,getd("Task" + .@i))) { if (getd("Task" + .@i + "_") < #Task_Count) { dispbottom "[Hunting Task] Killed " + (set(getd("Task" + .@i + "_"),getd("Task" + .@i + "_") + 1)) + " of " + #Task_Count + " " + strmobinfo(1,killedrid) + "."; end; } } } } else if (.Party) { .@mob = killedrid; getmapxy(.@map1$,.@x1,.@y1); getpartymember getcharid(1),1; getpartymember getcharid(1),2; for (.@i = 0; .@i < $@partymembercount; .@i++) { if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i])) { set .@Task_Count, getvar(#Task_Count, $@partymembercid[.@i]); set .@Task0, getvar(Task0, $@partymembercid[.@i]); set .@HP, readparam(HP, $@partymembercid[.@i]); if (.@Task_Count && .@Task0 && .@HP > 0) { getmapxy(.@map2$,.@x2,.@y2,BL_PC,rid2name($@partymemberaid[.@i])); if ((.@map1$ == .@map2$ || .Party == 1) && (distance(.@x1,.@y1,.@x2,.@y2) <= 30 || .Party < 3)) { for (.@j = 0; .@j < .Quests; .@j++) { .@my_mob_id = getvar( getd("Task"+.@j),$@partymembercid[.@i] ); .@my_count = getvar( getd("Task"+.@j+"_"), $@partymembercid[.@i] ); if (strmobinfo(1,.@mob) == strmobinfo(1,.@my_mob_id)) { if (.@my_count < .@Task_Count) { setd "Task"+.@j+"_", (.@my_count+1), $@partymembercid[.@i]; dispbottom "[Hunting Task] Killed " + (.@my_count+1) + " of " + .@Task_Count + " " + strmobinfo(1,.@mob) + ".", 0x777777, $@partymembercid[.@i]; break; } } } } } } } } end; OnInit: .Delay = 1; // Quest delay, in hours (0 to disable). .Quests = 3; // Number of subquests per task (increases rewards). .Party = 3; // Party options: 0 (exclude party kills), 1 (include party kills), 2 (same map only), 3 (screen area only) .Reset = 0; // Reset options: -1 (abandoning task sets delay time), 0 (no delay time), [Zeny] (cost to abandon task, no delay time) setarray .Count[0], // Min and max monsters per subquest (increases rewards). 20,50; setarray .Modifier[0], // Multipliers for Base Exp, Job Exp, and Zeny rewards. 0,0,0; .mob_db$ = // Table name of SQL mob database (checkre(0))?"mob_db_re":"mob_db"; setarray .Shop[0], // Reward items: <ID>,<point cost> (about 10~20 points per hunt). 512,1,513,1,514,1,538,5,539,5,558,10,561,10; .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"; .no_sql = 1; // Ignore sql mob database npcshopdelitem "task_shop",512; for (.@i = 0; .@i < getarraysize(.Shop); .@i += 2) npcshopadditem "task_shop", .Shop[.@i], .Shop[.@i+1]; end; } - shop task_shop -1,no,512:-1
-
Npc that consume custom coins to generate items to players.
Racaae replied to Kenex's question in Script Requests
Hi yuno,160,80,3 script 3D Printer 4_MACHINE_DEVICE,{ .@custom_coin_ID = 675451; .@custom_coin_qty = 3; if (countitem(.@custom_coin_ID) < .@custom_coin_qty) { npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self; end; } npctalk "Type the ID of the item to generate.", strnpcinfo(0), bc_self; input .@item_id; if (getitemname(.@item_id) == "null") { npctalk "ID is invalid / item not found.", strnpcinfo(0), bc_self; end; } mes "[" + strnpcinfo(1) + "]"; mes "Confirm generation of"; mes "<ITEM>" + getitemname(.@item_id) + "<INFO>" + .@item_id + "</INFO></ITEM>?"; next; if (select("Cancel", "Confirm") == 1) close; mes "[" + strnpcinfo(1) + "]"; mes "Starting..."; close2; if (countitem(.@custom_coin_ID) < .@custom_coin_qty) { npctalk "You need " + .@custom_coin_qty + " " + getitemname(.@custom_coin_ID) + " to generate a item.", strnpcinfo(0), bc_self; end; } if (checkweight(.@item_id,1) == 0) { npctalk "Overweight detected. You cannot proceed.", strnpcinfo(0), bc_self; end; } delitem .@custom_coin_ID, .@custom_coin_qty; getitem .@item_id, 1; npctalk "Generated.", strnpcinfo(0), bc_self; specialeffect EF_OVERTHRUST; end; } -
Npc register guild and allow guild member access to map
Racaae replied to MyNoobScriptz's question in Script Requests
yuno,165,80,3 script Entrance Guard#guild 4_M_UNCLEKNIGHT,{ if (getgroupid() >= 90) callsub S_Control; mes "[" + strnpcinfo(1) + "]"; mes "I can take you to the area if you're in a registered guild."; next; switch(select("Enter area", "Finish conversation")) { case 1: if (!getcharid(2)) { mes "[" + strnpcinfo(1) + "]"; mes "You are not in a guild."; close; } if (inarray($registered_guilds, getcharid(2)) < 0) { mes "[" + strnpcinfo(1) + "]"; mes "Your guild did not register."; close; } mes "[" + strnpcinfo(1) + "]"; mes "You're with the ^895818" + strcharinfo(2) + "^000000, correct?"; mes "I will send you there."; close2; warp "que_qsch05",346,32; end; case 2: mes "[" + strnpcinfo(1) + "]"; mes F_Bye; close; } S_Control: if(select("Default NPC", "^0000FFGM Control^000000") == 1) return; switch(select("Register guild", "Remove all guilds", "Cancel")) { case 1: switch(select("Enter guild member name", "Enter guild name")) { case 1: input .@playername$; query_sql "SELECT `name`,`guild_id` FROM `char` WHERE `name` like '%"+.@playername$+"%'",.@p_name$,.@GID; query_sql "SELECT `name`,`guild_lv` FROM `guild` WHERE `guild_id` = "+.@GID,.@NAME$,.@GLVL; if (getarraysize(.@p_name$) > 1) { mes "[" + strnpcinfo(1) + "]"; mes "More than one player with this name was found."; mes "Type again. Be more specific, please!"; close; } if (.@p_name$ == "") { mes "[" + strnpcinfo(1) + "]"; mes "I didn't find anything. Check for typos. You don't need to input the whole name."; close; } if (!.@GID) { mes "[" + strnpcinfo(1) + "]"; mes "" + .@p_name$ + " does not have a guild."; close; } break; case 2: input .@guildname$; query_sql "SELECT `guild_id`,`name`,`guild_lv` FROM `guild` WHERE `name` like '%"+.@guildname$+"%'",.@GID,.@NAME$,.@GLVL; if (getarraysize(.@GID) > 1) { mes "[" + strnpcinfo(1) + "]"; mes "More than one guild with this name was found."; mes "Type again. Be more specific, please!"; close; } if (!.@GID) { mes "[" + strnpcinfo(1) + "]"; mes "I didn't find anything. Check for typos. You don't need to input the whole name."; close; } break; } getguildmember .@GID, 1; getguildmember .@GID, 2; .@QTM = $@guildmembercount; for(.@i=0; .@i < $@guildmembercount; .@i++) if (isloggedin($@guildmemberaid[.@i],$@guildmembercid[.@i])) .@online++; mes "[" + strnpcinfo(1) + "]"; if (.@p_name$ != "" && .@p_name$ != getguildmaster(.@GID)) mes "" + .@p_name$ + "'s guild"; mes "Name: ^0000FF" + .@NAME$ + "^000000 (Lv " + .@GLVL + ")"; mes "Master: " + getguildmaster(.@GID); mes "Members: "+.@QTM+" / Online: "+.@online; mes " "; if (inarray($registered_guilds, .@GID) >= 0) { mes "Guild registered already."; close; } mes "Are you sure you want to register this guild?"; next; if(select("No", "Yes, register guild") == 1) close; .@i = getarraysize($registered_guilds); setarray $registered_guilds[.@i], .@GID; mes "[" + strnpcinfo(1) + "]"; mes "Guild ^895818" + getguildname(.@GID) + "^000000 registered!"; mes "Guild members can now enter."; close; case 2: mes "[" + strnpcinfo(1) + "]"; mes "Are you sure you want to remove all registered guilds?"; mes "^FF0000THIS CANNOT BE UNDONE.^000000"; next; if(select("On second thought, no.", "I'm aware, go on.") == 1) close; deletearray $registered_guilds, getarraysize($registered_guilds); mes "[" + strnpcinfo(1) + "]"; mes "Done."; close; case 3: end; } } -
Hello. There's a missing ; (semicolon) Find: .@reussite = 100; .@prix = 50000} Change to: .@reussite = 100; .@prix = 50000;}
-
Hey new_1-3,114,64,6 script Stone Pile 1_JOURNEY_STONE_D,{ mes "I need to stay put for 60 seconds so that the stones can activate."; next; if (select("Start", "Cancel") == 2) { close; } mes "Let's start."; close2; progressbar "3131FF",60; getitem 720, 1; specialeffect EF_FLOWERCAST; end; }
-
Npc register guild and allow guild member access to map
Racaae replied to MyNoobScriptz's question in Script Requests
Hi yuno,165,80,3 script Entrance Guard#guild 4_M_UNCLEKNIGHT,{ mes "[" + strnpcinfo(1) + "]"; mes "What do you want?"; next; switch(select("Register guild", "Enter area", "Finish conversation")) { case 1: if (!getcharid(2)) { mes "[" + strnpcinfo(1) + "]"; mes "You are not in a guild."; close; } if (inarray($registered_guilds, getcharid(2)) >= 0) { mes "[" + strnpcinfo(1) + "]"; mes "Your guild registered already."; close; } .@i = getarraysize($registered_guilds); setarray $registered_guilds[.@i], getcharid(2); mes "[" + strnpcinfo(1) + "]"; mes "Guild " + strcharinfo(2) + " registered!"; mes "Guild members can now enter."; close; case 2: if (inarray($registered_guilds, getcharid(2)) < 0) { mes "[" + strnpcinfo(1) + "]"; mes "Your guild did not register."; close; } mes "[" + strnpcinfo(1) + "]"; mes "You're with the guild " + strcharinfo(2) + ", correct?"; mes "I will send you there."; close2; warp "que_qsch05",346,32; end; case 3: mes "[" + strnpcinfo(1) + "]"; mes F_Bye; close; } } -
How to reduce Hp player if out of safe zone ?
Racaae replied to MyNoobScriptz's question in Script Requests
Hello. Use getareaunits to get everyone who is in the "safe zone". Then use getmapunits to get everyone on the map. Compare the two lists and attach the players who aren't on both arrays since this means they are out the area. //REDUCE HP PLAYER OUT OF ZONE prontera,1,1,1 script AutoReduceHP HIDDEN_NPC,{ end; OnTimer2000: .@percent = -30; .@SafeArea = getareaunits(BL_PC,"prontera",145,83,164,69,.@safe_aid); .@size = getmapunits(BL_PC,"prontera",.@aid); if (.@size > 0) { for (.@i = 0; .@i < .@size; .@i++) { if (inarray(.@safe_aid, .@aid[.@i]) < 0) { if (attachrid(.@aid[.@i])) { if (Hp <= MaxHp) { specialeffect2 107; percentheal .@percent, .@percent; if (Hp < 5) { warp "SavePoint",0,0; } } detachrid; } } } } initnpctimer; end; OnInit: initnpctimer; end; } -
Hello. Your script is looking good, great start. You can test this one, maybe you learn something, I tried doing what you requested. //Converts ratio to return actual number with decimals. //10000=100% 1000=10% 100=1% 10=0,1% 1=0,01% function script F_ConvertRatio { .@n = getarg(0); if (.@n%100 && .@n > 100 && .@n < 1000 && atoi(charat(""+.@n, 1)) == 0 || .@n < 10) .@n2$ = .@n/100 + (.@n%100?",0"+.@n%100:""); else if (.@n%100 && .@n > 9 && .@n < 1000 && atoi(charat(""+.@n, getstrlen(""+.@n)-1)) == 0) .@n2$ = .@n/100 + "," + (.@n%100)/10; else .@n2$ = .@n/100 + (.@n%100?","+.@n%100:""); return .@n2$; } prontera,113,246,5 script Rafa da Rifa 1_F_PUBGIRL,{ cutin "job_dancer_eir01", 0; mes "[" + strnpcinfo(1) + "]"; mes "Você quer participar da minha rifa?"; mes "Ai, que pergunta, né? É claro que quer!"; mes "Pelo generosíssimo valor de ^0000FF" + F_InsertComma($@raffle_cost) + "z^000000, você concorre a"; mes "" + $@raffle_prize_qty + " [<ITEM>" + getitemname($@raffle_prize_id) + "<INFO>" + $@raffle_prize_id + "</INFO></ITEM>]."; next; if (isnpccloaked()) goto S_Restarting; .@i = rand(20,40); mes "[" + strnpcinfo(1) + "]"; mes "Você precisa tirar o número ^FF0000" + .@i + "^000000 pra ganhar ^00FF00" + getitemname($@raffle_prize_id) + "^000000."; mes "Mas primeiro, preciso dos ^0000FF" + F_InsertComma($@raffle_cost) + "z^000000."; mes "O que me diz?"; next; if(select("Tá OK! Lá vamos nós...", "Não, obrigad" + (Sex?"o":"a") + ".") == 2) { mes "[" + strnpcinfo(1) + "]"; mes "Não tá confiante?"; close3; } if (Zeny < $@raffle_cost) { mes "[" + strnpcinfo(1) + "]"; mes "Você não tem o zeny para participar?"; close3; } if (checkweight(1301,1) == 0) { mes "[" + strnpcinfo(1) + "]"; mes "Você tá com uma mochila bem pesada em..."; mes "Como você vai receber o prêmio desse jeito?"; close3; } if (isnpccloaked()) goto S_Restarting; Zeny -= $@raffle_cost; mes "[" + strnpcinfo(1) + "]"; mes "O número do prêmio é ^FF0000" + .@i + "^000000."; if (rand(10000) > $@raffle_chance) { .@l = rand(.@i-19,.@i+19); showdigit .@l; mes "Você tirou o número ^0000FF" + .@l + "^000000."; mes "Não foi dessa vez. Mas e se você tentar de novo?"; mes "Aliás, aqui está o seu prêmio de consolação!"; getitem $@raffle_consol_id, rand($@raffle_consol_min,$@raffle_consol_max); close3; } showdigit .@i; mes "Você tirou o número ^0000FF" + .@i + "^000000."; mes "... Peraí, você ganhou? É isso mesmo, produção?"; mes "Hoje é o seu dia!"; getitem $@raffle_prize_id, $@raffle_prize_qty; announce "" + strnpcinfo(1) + " : Parabéns! " + strcharinfo(0) + " recebeu " + $@raffle_prize_qty + " " + itemlink($@raffle_prize_id) + " na Rifa!", bc_all; specialeffect2 EF_PROVIDENCE; donpcevent strnpcinfo(3)+"::OnStart"; close3; S_Restarting: mes "[" + strnpcinfo(1) + "]"; mes "Nossa, essa rifa acabou bem quando estávamos conversando."; mes "Você vai ter que tentar a sorte na nova rifa."; close3; OnInit: bindatcmd "rifa",strnpcinfo(3)+"::OnGM", 99, 99; setarray .rifas, //Cada linha é uma rifa diferente //<grand prize>,<grand prize amount>,<consolation prize>,<consolation min amount>,<consolation max amount>,<cost>,<win chance 1~10000>, 970 , 30 , 7136 , 1, 20, 40000 , 100, 12264, 5 , 7135 , 1, 20, 100000, 100, 12928, 5 , 678 , 1, 10, 100000, 200, 7938 , 100, 7939 , 1, 50, 100000, 100, 6962 , 1 , 7139 , 1, 20, 150000, 125, 7620 , 10 , 984 , 1, 15, 150000, 125, 7619 , 10 , 985 , 1, 15, 200000, 200, 12412, 1 , 6259 , 1, 40, 300000, 40, 23546, 1 , 1061 , 1, 400, 500000, 200, 6635 , 1 , 23044, 1, 10, 600000, 50; // 1200000 = 20 minutos OnTimer1200000: OnStart: stopnpctimer; cloakonnpc strnpcinfo(0); sleep 10000; .@r = rand(getarraysize(.rifas)/7) *7; $@raffle_prize_id = .rifas[.@r]; $@raffle_prize_qty = .rifas[.@r+1]; $@raffle_consol_id = .rifas[.@r+2]; $@raffle_consol_min = .rifas[.@r+3]; $@raffle_consol_max = .rifas[.@r+4]; $@raffle_cost = .rifas[.@r+5]; $@raffle_chance = .rifas[.@r+6]; announce "A Rafa gostaria de convidar a todos a participarem de sua Rifa, na biblioteca ao oeste de Prontera!", bc_all; cloakoffnpc strnpcinfo(0); initnpctimer; sleep 5000; announce "" + strnpcinfo(1) + " : O grande prêmio é " + ($@raffle_prize_qty>1?$@raffle_prize_qty+"x ":"") + itemlink($@raffle_prize_id) + "! E o prêmio de consolação é " + itemlink($@raffle_consol_id) + " " + $@raffle_consol_min + "~" + $@raffle_consol_max + "x!", bc_all; npctalk "Este aqui é um prêmio especial que aparece só de vez em quando, então se eu fosse você, eu participaria!"; end; OnGM: message strcharinfo(0), "Esses são comandos especiais que apenas você ADMs e GMs podem usar."; switch(select("Cancelar", "^0000FFVer rifa atual^000000", "^0000FFVer rifas^000000", "^0000FFIniciar nova rifa^000000")) { case 1: end; case 2: if (isnpccloaked()) { message strcharinfo(0), "RIFA EM PROCESSO DE REINICIAR"; end; } mes "^0000FFPrêmio:^000000"; mes "^0000FF[<ITEM>" + getitemname($@raffle_prize_id) + "<INFO>" + $@raffle_prize_id + "</INFO></ITEM>] " + $@raffle_prize_qty + "x^000000"; mes "^FF0000Consolação:^000000"; mes "^FF0000[<ITEM>" + getitemname($@raffle_consol_id) + "<INFO>" + $@raffle_consol_id + "</INFO></ITEM>] " + $@raffle_consol_min + "~" + $@raffle_consol_max +"x^000000"; mes "Preço: " + F_InsertComma($@raffle_cost) + "z"; mes "Chance do prêmio: " + F_ConvertRatio($@raffle_chance) + "%"; mes "Iniciada faz " + (getnpctimer(0)/1000) + " segundos."; close; case 3: .@size = getarraysize(.rifas)/7; for( .@i = 0; .@i < .@size; .@i++ ) { .@r = .@i * 7; mes "^0000FFRifa " + (.@i+1) + " - Prêmio:^000000"; mes "^0000FF[<ITEM>" + getitemname(.rifas[.@r]) + "<INFO>" + .rifas[.@r] + "</INFO></ITEM>] " + .rifas[.@r+1] + "x^000000"; mes "^FF0000Consolação:^000000"; mes "^FF0000[<ITEM>" + getitemname(.rifas[.@r+2]) + "<INFO>" + .rifas[.@r+2] + "</INFO></ITEM>] " + .rifas[.@r+3] + "~" + .rifas[.@r+4] +"x^000000"; mes "Preço: " + F_InsertComma(.rifas[.@r+5]) + "z"; mes "Chance do prêmio: " + F_ConvertRatio(.rifas[.@r+6]) + "%"; if (.@i < .@size-1) { if(select("Ver outra rifa","Fechar") == 1) clear; else break; } } close; case 4: donpcevent strnpcinfo(3)+"::OnStart"; end; } } prontera,115,246,3 script Rifa#raffle_board 2_BULLETIN_BOARD,{ mes "^0000FFGrande prêmio da Rifa:^000000"; mes "^0000FF[<ITEM>" + getitemname($@raffle_prize_id) + "<INFO>" + $@raffle_prize_id + "</INFO></ITEM>] " + $@raffle_prize_qty + "x^000000"; mes " "; mes "^FF0000Prêmio de Consolação:^000000"; mes "^FF0000[<ITEM>" + getitemname($@raffle_consol_id) + "<INFO>" + $@raffle_consol_id + "</INFO></ITEM>] " + $@raffle_consol_min + "~" + $@raffle_consol_max +"x^000000"; mes " "; mes "Preço: " + F_InsertComma($@raffle_cost) + "z"; close; } Using initnpctimer and stopnpctimer you can automate the raffle change. Example: OnInit: // set the first raffle when the server starts. initnpctimer; //start the timer end; OnTimer60000: //after 60 seconds this part will trigger //change the raffle array to new values. stopnpctimer; //erase the old timer initnpctimer; //start the timer again from 0 end;
-
Hi. Change 100 to 10000, and 0.01 to 1. You can't use decimal numbers in scripting. - script Poring_Coin -1,{ OnNPCKillEvent: if ( rand( 10000 ) <= 1 ) { .@item_id = F_Rand( 7539 ); getitem .@item_id,1; } end; } 10000 = 100 % 1000 = 10 % 100 = 1 % 10 = 0.1 % 1 = 0.01 %
- 1 reply
-
- 1
-
-
The player chooses one of the items? Or the NPC chooses one? The player receives multiple items? geffen,151,48,5 script First Person 1_M_LIBRARYMASTER,{ //Put the IDs of the item below. setarray .@items, 909, 910, 911, 912, 913, 914, 915; if (isnpccloaked("Second Person") == 0) { npctalk "You can talk to him.", strnpcinfo(0), bc_self; end; } mes "[First Person]"; mes "Hi, do you have all the items with you?"; next; for (.@i=0;.@i< getarraysize(.@items);.@i++) { if (countitem(.@items[.@i]) < 1) { mes "[First Person]"; mes "You don't have <ITEM>" + getitemname(.@items[.@i]) + "<INFO>" + .@items[.@i] + "</INFO></ITEM>."; close; } } mes "[First Person]"; mes "You have everything. I will call him."; close2; cutin "war_y1", 2; cloakoffnpcself( "Second Person" ); npctalk "Hello.", "Second Person", bc_self; end; } geffen,155,49,3 script Second Person 4_M_FAIRYKID5,{ //Put the IDs of the item below. setarray .@items, 909, 910, 911, 912, 913, 914, 915; //Put here the item IDs of the selection the player can choose from setarray .@reward, 714, 607, 12103; disable_items; mes "[Second Person]"; mes "Hi, the first person told me you have the items."; if (getarraysize(.@reward) > 1) { mes "You can exchange them for one of these:"; for (.@i=0;.@i< getarraysize(.@reward);.@i++) mes "- <ITEM>" + getitemname(.@reward[.@i]) + "<INFO>" + .@reward[.@i] + "</INFO></ITEM>"; next; .@menu$ = ""; for (.@i=0;.@i< getarraysize(.@reward);.@i++) .@menu$ += "- " + getitemname(.@reward[.@i]) + ":"; .@s = select(.@menu$) - 1; mes "[Second Person]"; } mes "Are you sure you want"; mes "<ITEM>" + getitemname(.@reward[.@s]) + "<INFO>" + .@reward[.@s] + "</INFO></ITEM>?"; next; if (select("No", "Yes, let's do this") == 1) { mes "[Second Person]"; mes "I see."; close2; cutin "", 255; cloakonnpcself; end; } for (.@i=0;.@i< getarraysize(.@items);.@i++) { if (countitem(.@items[.@i]) < 1) { mes "[Second Person]"; mes "You don't have <ITEM>" + getitemname(.@items[.@i]) + "<INFO>" + .@items[.@i] + "</INFO></ITEM>."; close2; cutin "", 255; cloakonnpcself; end; } } if ((MaxWeight - Weight) < 1000 || checkweight("Knife",1) == 0) { mes "^0000FF- You cannot continue due to your heavy weight. -^000000"; close2; cutin "", 255; cloakonnpcself; end; } for (.@i=0;.@i < getarraysize(.@items);.@i++) delitem .@items[.@i], 1; getitem .@reward[.@s], 1; mes "[Second Person]"; mes "Done."; close2; cutin "", 255; cloakonnpcself; end; OnInit: cloakonnpc; end; }
-
Good evening