Jump to content

Emistry

Forum Moderator
  • Posts

    10015
  • Joined

  • Days Won

    396

Community Answers

  1. Emistry's post in how do I get this npc to remove 20% of the value on conversion was marked as the answer   
    the NPC script doesn't support decimal.
    the script need to be changed to accept stacks of items instead of 1 by 1 exchange to support the tax on conversion.
    prontera,155,155,4 script Converter 83,{ .@name$ ="[^FF0000Converter^000000]"; mes .@name$; mes "Hello, 1 cashpoints is equals to 1 Pass."; mes "What would you like to do?"; next; switch( select("Cash to Pass","Pass to Cash") ) { case 1: mes .@name$; mes "How many pass(s) do you want?"; input .@num; next; mes .@name$; mes "This will cost ^FF0000" +.@num+ " cashpoints^000000."; next; if( select("Proceed:Nevermind") -1 ) { mes .@name$; mes "Goodbye!"; close; } if( .@num <= 0 || #CASHPOINTS < .@num ) { mes .@name$; mes "Sorry, you don't have enough cashpoints!"; close; } set #CASHPOINTS, #CASHPOINTS - .@num; dispbottom "Lost: " +.@num+ " cashpoints. Total: " +#CASHPOINTS+" cashpoints."; getitem 7350, .@num; break; case 2: mes .@name$; mes "How many Pass(s) will you give? Multiple of 10"; input .@num; next; .@num = ((.@num / 10) * 10); mes .@name$; mes "I can give you ^FF0000" +((.@num * 8) / 10)+ " cashpoints^000000 for this."; next; if( select("Proceed:Nevermind") -1 ) { mes .@name$; mes "Goodbye!"; close; } if( .@num < 10 || countitem(7350) < .@num) { mes .@name$; mes "Sorry, you don't have enough Pass ! Minimum of 10 "+getitemname(7350)+" are required."; close; } delitem 7350, .@num; .@num = ((.@num * 8) / 10); set #CASHPOINTS, #CASHPOINTS + ((.@num * 8) / 10); dispbottom "Gained: " +.@num+ " cashpoints. Total: " +#CASHPOINTS+" cashpoints."; break; } close; }  
  2. Emistry's post in NPC don't insert words was marked as the answer   
    use apostrophe to envelope the string, else the SQL engine treat it as column name instead of text.
    query_sql("UPDATE login SET nome = '"+escape_sql(.@nome$)+"' WHERE account_id = "+ getcharid(3)); query_sql("UPDATE login SET cpf = '"+escape_sql(.@cpf$)+"' WHERE account_id = "+ getcharid(3)); query_sql("UPDATE login SET chave= '"+escape_sql(.@chave$)+"' WHERE account_id = "+ getcharid(3)); and all string that insert into SQL database should use escape_sql(...) to escape any special characters
  3. Emistry's post in How to check item count. was marked as the answer   
    1. if you are checking for total of item count in current inventory
    getinventorylist; dispbottom "Your inventory has "+ @inventorylist_count +" items"; 2. if you are checking whether the player can hold the upcoming rewards
    if (checkweight(512, 100)) { getitem 512, 100; } else { dispbottom "You cant hold 100x Apple."; }  
  4. Emistry's post in trying to use emistry refine callfunc item/NPC was marked as the answer   
    may try this
    //--- Bitmasks ---- // 1 - Accessory 1 // 2 - Accessory 2 // 4 - Footgear(shoes, boots) // 8 - Garment(mufflers, hoods, manteaux) // 16 - Lower Headgear(beards, some masks) // 32 - Middle Headgear(masks, glasses) // 64 - Upper Headgear // 128 - Armor(jackets, robes) // 256 - Left hand(weapons, shields) // 512 - Right hand(weapons) function script RefineFunc { for (set .@i,EQI_ACC_L; .@i <= EQI_HAND_R; set .@i,.@i + 1) set .@Menu$,.@Menu$ +((getarg(2) & pow(2,(.@i-1)) && getequiprefinerycnt(.@i) >= getarg(3) && getequiprefinerycnt(.@i) < getarg(4) && getequipisequiped(.@i))?"^FF0000+"+getequiprefinerycnt(.@i)+" ^0000FF"+getequipname(.@i)+" "+(getitemslots(getequipid(.@i))?"["+getitemslots(getequipid(.@i))+"]":"")+"^000000":"")+":"; set .@Refine,select(.@Menu$); mes "Required ^FF0000"+getarg(1)+" x "+getitemname(getarg(0))+"^000000"; if (getarg(5) == 1 && !getequipisenableref(.@Refine)) mes "I cant refine this items. Because it is ^FF0000Un-Refineable^000000."; else{ if (select("^FF0000Refine^000000:Cancel") == 2) close; if (countitem(getarg(0)) < getarg(1)) close; delitem getarg(0),getarg(1); if (rand(100) < getarg(7)){ if (getarg(6)) while(getequiprefinerycnt(.@Refine) < getarg(4)) successrefitem (.@Refine); else successrefitem (.@Refine); mes "You have refined : "; mes "^FF0000+"+getequiprefinerycnt(.@Refine)+" ^0000FF"+getequipname(.@Refine)+"^000000"; } else { failedrefitem (.@Refine); mes "Sorry, Failed in Refine and Equipment...Destroyed."; } } close; }  
  5. Emistry's post in Quest Shop 1.6c Preview not working was marked as the answer   
    use the updated version which allow non-equip to bulk purchase depend on your max stack setting.
    https://github.com/rathena/rathena/blob/master/npc/custom/quests/quest_shop.txt
  6. Emistry's post in Modified Questitem npc by Euphy was marked as the answer   
    since its just one item as currency/requirement. just use itemshop instead.
    https://rathena.org/board/topic/90173-item-and-point-shop/
  7. Emistry's post in Specific script for the following was marked as the answer   
    *getequiprandomoption(<equipment index>,<index>,<type>{,<char id>}); Returns value of an attribute of a random option on an equipped item. See 'getequipid' for a full list of valid equipment slots. index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4). For valid attribute types, see `getrandomoptinfo` command reference. or
    *getinventorylist {<char_id>}; This command sets a bunch of arrays with a complete list of whatever the invoking character has in their inventory, including all the data needed to recreate these items perfectly if they are destroyed. Here's what you get: @inventorylist_option_id1[] - first array of random option IDs @inventorylist_option_value1[] - first array of random option values @inventorylist_option_parameter1[] - first array of random option parameters @inventorylist_option_id2[] - second array of random option IDs @inventorylist_option_value2[] - second array of random option values @inventorylist_option_parameter2[] - second array of random option parameters @inventorylist_option_id3[] - third array of random option IDs @inventorylist_option_value3[] - third array of random option values @inventorylist_option_parameter3[] - third array of random option parameters @inventorylist_option_id4[] - fourth array of random option IDs @inventorylist_option_value4[] - fourth array of random option values @inventorylist_option_parameter4[] - fourth array of random option parameters @inventorylist_option_id5[] - fifth array of random option IDs @inventorylist_option_value5[] - fifth array of random option values @inventorylist_option_parameter5[] - fifth array of random option parameters  
    not available
     
    check for card id instead.
    *getequipcardid(<equipment slot>,<card slot>) Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3). This function returns CARD ID, CARD0_FORGE, CARD0_CREATE, or CARD0_PET (for card 0, if the item is produced). It's useful for when you want to check whether an item contains cards or if it's signed. or getinventorylist
  8. Emistry's post in Lotti / Gacha script Req was marked as the answer   
    if (rand(1,100) > getd(".@P"+.@i+"[0]")) { for(set .@j,0; .@j<getarraysize(.@Default); set .@j,.@j+2) { getitem .@Default[.@j], .@Default[.@j+1]; if(!.@k[0]) setarray .@k[0], .@Default[.@j], .@Default[.@j+1]; } } else{ for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2) { getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]"); if (!.@k[0]) { set .@gz,.@i; setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]"); break; } } } change to
    if (rand(1,100) < getd(".@P"+.@i+"[0]")) { for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2) { getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]"); if (!.@k[0]) { set .@gz,.@i; setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]"); break; } } }  
  9. Emistry's post in Need some timer help. was marked as the answer   
    change
    if(Hunter) { mes "You have killed ^880000"+HuntCount+"^000000/^0000FF"+Amt+"^000000 "+getmonsterinfo(Hunt,0)+"s, keep it up!"; close; } into
    if(Hunter && gettimetick(2) < HuntDelay) { mes "You have killed ^880000"+HuntCount+"^000000/^0000FF"+Amt+"^000000 "+getmonsterinfo(Hunt,0)+"s, keep it up!"; close; }  
  10. Emistry's post in Erro event Tarot was marked as the answer   
    /* .___ ___. __ __ ___ | \/ | | | | |/ / | \ / | | | | ' / | |\/| | | | | < | | | | | | | . \ |__| |__| |__| |__|\__\ = Tarot Event v2016 = by Mik閕as = brAthena = User: http://forum.brathena.org/index.php/user/11630-mikeias/ */ prontera,128,329,4 script Evento do Destino 4_M_BARD,{ mes "[Evento do Destino]"; mes "Ol?"+strcharinfo(0); mes "Est?afim de testar sua sorte nas cartas? Fique atento quando anunciar o in韈io do evento."; next; switch(select("Participar do evento", ( getgroupid() >= $@lvminGM ? ( !$tarot_status ? "Ligar":"Desligar")+" Evento":"") , "Premia玢o", "N鉶 quero participar")){ case 1: // = Se evento n鉶 ativo if (!$tarot_status){ mes "[Evento do Destino]"; mes "Senhor"+(Sex? "":"a")+", no momento o evento n鉶 est?at韛o! N髎 avisaremos quando o evento come鏰r."; close; } // = Verifica se o nome do personagem j?est?no array for (set .@i,0; .@i < getarraysize($@tarot_participantes$); set .@i,.@i + 1) { if ( $@tarot_participantes$[.@i] == strcharinfo(0) ) { mes "[Evento do Destino]"; mes "Tenha calma "+strcharinfo(0)+"! N髎 ainda n鉶 estamos prontos para voc? aguarde um momento."; next; warp "force_1-1",100,100; close; } } mes "[Evento do Destino]"; mes "Tudo certo, anotei a sua participa玢o aqui! Em breve voc?ser?chamado para que o evento seja iniciado."; // = Adiciona o nome do personagem ao array set $@tarot_participantes$[getarraysize($@tarot_participantes$)], strcharinfo(0); //message strcharinfo(0), strnpcinfo(1)+" Meus parab閚s! Voc?se registrou com 陎ito para participar do evento."; announce strnpcinfo(1)+" <"+strcharinfo(0)+"> registrou-se para participar do evento!",bc_all; next; warp "force_1-1",100,100; close; case 2: if( agitcheck() || agitcheck2() ){ mes "[Evento do Destino]"; mes "Neste momento a Guerra do Emperium est?at韛a e n鉶 ?poss韛el dar in韈io ao evento!"; close; } mes "[Evento do Destino]"; mes "Ol? Game-Master! Voc?tem certeza que deseja "+( !$tarot_status ? "Ligar":"Desligar")+" o evento?"; if(select("N鉶:Tenho certeza") == 1) close; if ( !$tarot_status ){ donpcevent "Tarot Event::OnStart"; }else donpcevent "Tarot Event::OnStop"; close; end; case 3: mes "[Evento do Destino]"; mes "O participante que n鉶 for atingido pela carta 'Coma' receber?pontos de evento e recompensas aleat髍ias."; close; case 4: close; } OnInit: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //set "[Evento do Destino]", "^800000"+strnpcinfo(1)+"^000000"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - setarray $@mapeventtarot$, "poring_w01", 102, 71; // = Configura玢o do mapa do evento // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - set $@mintarot_participantes,2; // = N鷐ero m韓imo de participantes para iniciar o evento // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - set $@lvminGM, 60; // = Level m韓imo de GM para ligar/desligar o evento // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // = ATEN敲O: CADA ITEM TEM SUA QUANTIDADE // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - callfunc ("resetEventoTarot", $@tarot_participantes$, $@mapeventtarot$[0]); setarray .mapflag,0,1,7,8,13,22,33,34,12; for (set .@m,0; .@m < getarraysize(.mapflag); set .@m, .@m + 1){ setmapflag $@mapeventtarot$[0], .mapflag[.@m]; } end; } - script Tarot Event -1,{ // = In韈io autom醫ico OnClock0500: OnClock1700: // = In韈io manual OnStart: set $tarot_status,1; announce "[NPC] Evento do Destino: As inscri珲es para o evento est鉶 abertas! Voc阺 tem 5 minutos para participar. Digite @evt para participar.",bc_all; sleep 60000; announce "[NPC] Evento do Destino: As inscri珲es para o evento est鉶 abertas! Voc阺 tem 4 minutos para participar. Digite @evt para participar.",bc_all; sleep 60000; announce "[NPC] Evento do Destino: As inscri珲es para o evento est鉶 abertas! Voc阺 tem 3 minutos para participar. Digite @evt para participar.",bc_all; sleep 60000; announce "[NPC] Evento do Destino: As inscri珲es para o evento est鉶 abertas! Voc阺 tem 2 minutos para participar. Digite @evt para participar.",bc_all; sleep 60000; announce "[NPC] Evento do Destino: As inscri珲es para o evento est鉶 abertas! Voc阺 tem 1 minuto para participar. Digite @evt para participar.",bc_all; sleep 60000; if ( getarraysize($@tarot_participantes$) < $@mintarot_participantes ){ announce "As inscri珲es para o Evento do Destino n鉶 foram suficientes para iniciar.",bc_all; callfunc ("resetEventoTarot", $@tarot_participantes$, $@mapeventtarot$[0]); end; } announce "[NPC] Evento do Destino: As inscri珲es para o evento foram encerradas. Boa sorte a todos os participantes!",bc_all; set $tarot_status,0; for(set .@p, 0; .@p < getarraysize($@tarot_participantes$); set .@p, .@p + 1){ if ( isloggedin(getcharid(3, $@tarot_participantes$[.@p])) ){ warpchar $@mapeventtarot$[0], atoi($@mapeventtarot$[1]), atoi($@mapeventtarot$[2]), getcharid(0, $@tarot_participantes$[.@p]); }else{ deletearray $@tarot_participantes$[.@p], 1; } } sleep 8000; donpcevent "[GM]Tyr::OnSpeak"; end; OnReturn: while( getarraysize($@tarot_participantes$) > 1){ // = Enquanto o total de participantes for maior que 1 // sleep 1000; for(set .@p,0;.@p<getarraysize($@tarot_participantes$);set .@p,.@p+1){ sleep 1000; if(getmapusers("poring_w01") == 1){goto Vencer;} attachrid(getcharid(3,$@tarot_participantes$[.@p])); if( strcharinfo(3) == $@mapeventtarot$[0] ){ set .@CARDs,522+rand(1,14); specialeffect2 .@CARDs, strcharinfo(0); if( .@CARDs == 531 ){ deletearray $@tarot_participantes$[.@p], 1; percentheal -99,-99; sleep2 1500; warp "SavePoint",0,0; } } detachrid; } } sleep 2000; Vencer: if ( getarraysize($@tarot_participantes$)){ attachrid(getcharid(3, $@tarot_participantes$[0])); // = Atacha o account_id apartir do nome if ( strcharinfo(3) == $@mapeventtarot$[0] ){ announce "[NPC] Evento do Destino: O vencedor do evento ?o jogador '"+$@tarot_participantes$[0]+"' parab閚s!",bc_all; getitem 7227,1; set #evento,#evento+10; } detachrid; } callfunc ("resetEventoTarot", $@tarot_participantes$, $@mapeventtarot$[0]); end; // = Encerra o Evento OnStop: //announce "["+strnpcinfo(1)+"] Evento encerrado!",bc_all; callfunc ("resetEventoTarot", $@tarot_participantes$, $@mapeventtarot$[0]); end; } - script tarot_events -1,{ // = Se o participante que deslogou ou morreu estiver no mapa do evento, seu nome ser?retirado do array de tarot_participantes OnPCLogoutEvent: if ( strcharinfo(3) == $@mapeventtarot$[0] ){ for (set .@i,0; .@i < getarraysize($@tarot_participantes$); set .@i,.@i + 1) { if ( $@tarot_participantes$[.@i] == strcharinfo(0) ){ deletearray $@tarot_participantes$[.@i], 1; break; } } } end; } poring_w01,102,73,1 script [GM]Tyr 871,{ mes "[Organizadora de Eventos]"; mes "Jogadores na disputa..."; for (set .@i,0; .@i < getarraysize($@tarot_participantes$); set .@i,.@i + 1) { mes (.@i+1)+" - "+$@tarot_participantes$[.@i]; } close; end; OnSpeak: setarray .msgs$, "Usarei a habilidade 'Destino nas Cartas' em cada um de voc阺.", "As rodadas ser鉶 de acordo com a ordem de inscri玢o no evento.", "O vencedor ser?o 鷏timo a sobreviver!", "Boa sorte a todos os participantes!", "TAROOOW!"; for ( set .@i,0; .@i < getarraysize(.msgs$); set .@i, .@i+1 ){ npctalk .msgs$[.@i]; sleep 3000; } donpcevent "Tarot Event::OnReturn"; end; OnInit: setarray .x[0],94,105,99,110; setarray .y[0],68; npcspeed 195; initnpctimer; end; OnTimer1000: emotion rand(34,45); for(set .c,0;.c<getarraysize(.x); set .c,.c+1){ npcwalkto .x[.c],.y[0]; sleep 3500; } initnpctimer; end; } // = Reseta par鈓etros function script resetEventoTarot { // @param0 = array dos tarot_participantes // @param1 = map event deletearray getarg(0); set $tarot_status,0; mapwarp getarg(1), "prontera",156,183; return; } not all sleep2 could be changed into sleep, you need to identity which part of the script execution doesnt attach to players and which part does.
  11. Emistry's post in Nydhogur quest doesnt go thru was marked as the answer   
    nyd_dun02,100,201,3 script Yggdrasil Gatekeeper 111,8,8,{ if (ins_nyd < 200) ins_nyd = 200; ....... ....... ....... ....... } may try add these 2 lines, it should help you escape most of the quests.
    or you can just remove all the related quest dialogs and validation.
  12. Emistry's post in Connecting two npc was marked as the answer   
    *disablenpc "<NPC object name>"; *enablenpc "<NPC object name>"; These two commands will disable and enable, respectively, an NPC object specified by name. The disabled NPC will disappear from sight and will no longer be triggerable in the normal way. It is not clear whether it will still be accessible through 'donpcevent' and other triggering commands, but it probably will be. You can disable even warp NPCs if you know their object names, which is an easy way to make a map only accessible through walking half the time. Then you 'enablenpc' them back. You can also use these commands to create the illusion of an NPC switching between several locations, which is often better than actually moving the NPC - create one NPC object with a visible and a hidden part to their name, make a few copies, and then disable all except one. this will help you enable/disable your npc
  13. Emistry's post in Server Donate for Floating Rates was marked as the answer   
    if ($DONATE_EXP_ZENY >= $DONATE_EXP_ZENY_AIM && $DONATE_EXP_ZENY_AIM > 0) { $DONATE_EXP_RATE = rand(.rate_range[0], .rate_range[1]); $DONATE_EXP_DURATION = gettimetick(2) + .duration; callsub(L_rate, $DONATE_EXP_RATE); // <------------ THIS LINE donpcevent strnpcinfo(3)+"::OnStart"; }  
  14. Emistry's post in Success rate information for enchanter was marked as the answer   
    if (rand(100) < 10) { 10% } if (rand(100) < 20) { 20% }  
     
  15. Emistry's post in Lucky pick was marked as the answer   
    try
    byako,83,154,4 script Who's Online Event 99,{ mes "[Who's Online Event]"; if (getgroupid() < 99) { mes "Only GM's are allowed to use this NPC."; } else { mes "Enable event?"; if (select("Yes", "No") == 1) { mes "Event started."; donpcevent strnpcinfo(3)+"::OnStart"; } } close; OnHour00: OnHour03: OnHour06: OnHour09: OnHour12: OnHour15: OnHour18: OnHour21: OnStart: do { query_sql "select `account_id`, `name` from `char` where online = 1 order by rand() limit 1", .@aid, .@name$; attachrid .@aid; } while (checkvending() || getgroupid() >= 2 || inarray(.map$, strcharinfo(3)) == -1); announce strcharinfo(0) +" won 1 Lucky Pick Box in Exiled Lucky Pick", bc_all, 0x00FF00; getitem 50043,1; end; OnInit: setarray .map$, "prontera", "izlude", "payon"; end; }  
  16. Emistry's post in Clarification on Mapflag Restricted items on PVP maps was marked as the answer   
    your Event_LMS script only assign mapflag, doesn't support assigning extra parameter for mapflag. Hence it wont work with the way you doing it.
    setmapflag "sec_pri", MF_RESTRICTED, 2; setmapflag "06guild_01", MF_RESTRICTED, 2; or sec_pri mapflag restricted 2 06guild_01 mapflag restricted 2 these would work.
  17. Emistry's post in +10 Checker on F_RefineSystem by Emistry was marked as the answer   
    set the max refine value to 9 instead of 10.
     
     
  18. Emistry's post in +10 Checker on F_RefineSystem by Emistry was marked as the answer   
    set the max refine value to 9 instead of 10.
     
     
  19. Emistry's post in +10 Checker on F_RefineSystem by Emistry was marked as the answer   
    set the max refine value to 9 instead of 10.
     
     
  20. Emistry's post in +10 Checker on F_RefineSystem by Emistry was marked as the answer   
    set the max refine value to 9 instead of 10.
     
     
  21. Emistry's post in +10 Checker on F_RefineSystem by Emistry was marked as the answer   
    set the max refine value to 9 instead of 10.
     
     
  22. Emistry's post in ADD Refine Items was marked as the answer   
    setarray .@grace_item_list, 450086, 450087, 45088; if (inarray(.@grace_item_list, getequipid(.@part)) == -1) { emotion ET_OTL; mes "[Refine Master]"; mes "Oh, I'm sorry."; mes "This item is impossible to refine."; close; }  
  23. Emistry's post in Pet and Homunculus rename npc was marked as the answer   
    atcommand "@petrename "+.@name$; use this instead.
     
    if you are using the SQL method above, your char need to be disconnected from server before the SQL query is executed to update the server, otherwise your current character data will override the changes when it saved into database upon logout.
  24. Emistry's post in Check party member if within the cell and in the map was marked as the answer   
    OnNPCKillEvent: getmapxy(.@map$, .@x, .@y, BL_PC); // <----- YOU MISSED OUT THIS LINE  
  25. Emistry's post in Skip High Novice and High Job 1st Job Classes was marked as the answer   
    https://rathena.org/board/topic/105789-utility-sql-job-changer/
×
×
  • Create New...