Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/15/24 in Posts

  1. 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;
    3 points
  2. Via color picker. So the code is 255 0 255.
    1 point
  3. Before I saw a few of servers having issue because of groups.yml that written incorrectly, which can makes server couldnt start (stuck at reading groups.yml), or account cannot login because of group ID didnt exist (cant be read by rathena emulator). So I hope this helps, Commands Generator. The list of commands are parsed directly from doc/atcommands.txt so if there is any updates of commands, it should be automatically added too. Let me know if you have any suggestion or improvement ideas for any of this generator.
    1 point
  4. Hello Racaae, thx for your help! i'm testing your script now, and he looks really clean and with more features than i expected! I noticed that some time when even if the player gets the right number of the raffle (win codition) he not get the grand prize istead the npc gives to the player the consolation prize. I've made some changes on my original code yesterday before read your post and here is what my actual raffle script is: prontera,161,188,4 script Ana da Rifa 4_F_PINKWOMAN,{ .@npc_name$ = "[^FF09FF Ana ^000000]"; mes .@npc_name$; if ((gettimetick(2) - .last_participation_time) <= 3) { mes "Você já comprou uma rifa recentemente, aguarde um instante..."; close; } mes "Olá, seja bem-vindo(a) ao nosso sistema de rifas!"; mes "Temos vários prêmios interessantes que podem te ajudar em sua jornada!"; next; mes "Gostaria de participar da rifa do momento?"; mes "O prêmio ^FFAF22 PRINCIPAL ^000000 será: "; mes "x"+.Grand_Prize_Amount[.index]+" ^477FEE"+ .Grand_Prize_T$[.index]; mes "-------------------------------------------"; mes "O prêmio de ^FF0000 consolação ^000000 será: "; mes "x"+.Consolation_Prize_Amount[.index]+" ^895818"+ .Consolation_Prize_T$[.index]; mes "O valor da rifa é de ^FF0000"+ .zeny_required[.index] +"^000000 Zenys"; next; switch( select("Tentar a sorte!", "Hoje não.") ) { case 1: if (Zeny <= .zeny_required[.index]) { mes "Você não tem ^FF0000"+ .zeny_required[.index] +"^000000 Zenys para participar da Rifa!"; close; } .@weight = 100 * Weight / MaxWeight; getinventorylist; if (.@weight > 50) || ((100 - @inventorylist_count ) < 6) { mes "Verifique se você esta sobrecarregado ou com o inventário próximo do limite!"; close; } .@p1 = (rand(1000)+1); mes "Sua chance de ganhar é de "+ (.odds[.index]/10) +"%"; next; mes "Sua sorte hoje é o número - ^FF9900"+ .@p1 +"."; if (.@p1 <= .odds[.index]) { mes "Parabéns voce ganhou o grande prêmio:"; mes "x"+ .Grand_Prize_Amount[.index] +" ^477FEE"+ .Grand_Prize_T$[.index]; Zeny -= .zeny_required[.index]; getitem .Grand_Prize$[.index], .Grand_Prize_Amount[.index]; mapannounce .map$, "O jogador "+ strcharinfo(0) +" foi o vencedor da atual rifa!", 0, 0xFCE516; close2; goto OnInit; } else{ .last_participation_time = gettimetick(2); mes "Infelizmente não foi desta vez, seu prêmio de consolação é: "; mes "x"+ .Consolation_Prize_Amount[.index] +" ^895818"+ .Consolation_Prize_T$[.index]; Zeny -= .zeny_required[.index]; getitem .Consolation_Prize$[.index], .Consolation_Prize_Amount[.index]; close; } } close; OnInit: OnTimer600000: initnpctimer; .map$ = "prontera"; hideonnpc "Ana da Rifa"; sleep 12000; hideoffnpc "Ana da Rifa"; setarray .raffle[0], 0, 1, 2, 3, 4; setarray .Grand_Prize$[0], "Red_Potion", "White_Potion", "Blue_Potion", "Tha_Maero_Card", "Poring_Card"; setarray .Grand_Prize_T$[0], "Poções Vermelhas", "Poções Brancas", "Poções Azuis", "Carta Memória de Thanatos", "Carta Poring"; setarray .Grand_Prize_Amount[0], 20, 30, 5, 50, 25; setarray .Consolation_Prize$[0], "Red_Potion", "White_Potion", "Blue_Potion", "Jellopy", "Stone_Fragments"; setarray .Consolation_Prize_T$[0], "Poção Vermelha", "Poção Branca", "Poção Azul", "Jellopys", "Fragmentos de Pedra"; setarray .Consolation_Prize_Amount[0], 1, 1, 1, 50, 5; setarray .zeny_required[0], 500, 1500, 10000, 2500000, 999; setarray .odds[0], 500, 350, 450, 30, 500; .index = rand(getarraysize(.raffle)); announce "Olá, uma nova rifa está disponível! O prêmio no momento para o ganhador é x"+ .Grand_Prize_Amount[.index]+ " " + .Grand_Prize_T$[.index] +", e para quem não conseguir, o prêmio de consolação será x"+ .Consolation_Prize_Amount[.index]+ " " + .Consolation_Prize_T$[.index] + ", a chance de ganhar o prêmio é de "+ (.odds[.index]/10) +"%." , 0, 0x7AF6EE; end; } Some of the changes: Yet i need to fix a problem when one player wins and the others are chatting with the NPC they also get one last chance to win, but i see in your code the solution (check if the npcs is cloaked before the prize results, if true, go to restarting label!) Thank you very much Racaae for coding my request and for the insights it gives me, I will try to understand the complete code to improve my scripting skills! I will make some changes based on Raccae's code and in a few days i will share it here.
    1 point
  5. I was reading this topic yesterday and discovered that most of the requests were not added. Therefore, I am making my debut here to share with you the updated @autoattack function. Added Commands: @autoattack - display all @autoattack commands. @autoattack on/off @autoattack list @autoattack +monsterID @autoattack -monsterID #Edit If you use [ @autoattack on ] without adding monster targets will attack all the monsters (DEFAULT setting.) Auto-attack can be toggled on or off using the @autoattack on/off command. Specific mobs can be added or removed from the target list using @autoattack +<mobID> or @autoattack -<mobID> respectively. Since I'm using the latest version, applying the patch shouldn't be a problem.(I also removed the struct warnings from the map_session_data). Attached(Updated): atcommand[remix]
    1 point
×
×
  • Create New...