Jump to content

Lion

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Brazil
  • Server
    RagnaTactics
  • Discord: l9421

Lion's Achievements

Poring

Poring (1/15)

  • One Month Later
  • Week One Done
  • Reacting Well
  • First Post
  • Conversation Starter

Recent Badges

1

Reputation

  1. Lion

    Raffle Event NPC

    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.
  2. Lion

    Raffle Event NPC

    Good night guys, i'm working on the script since yesterday and got some good results that i would like to share with you. At the moment, i think i done some of the main part of the script, added some securities checks for Zeny, weight and inventory space. Yet i need to learn about npc events, how to set a timer and a condition to restart the npc event. At the moment i want to give a special thanks to @GmOcean for the excellent beginners guide who helped me out and give me some directions to how start my scripting. Second for all other users who made/answer questions that somehow helped me out with my issues of how do or declare things etc. Below is the code i've made so far, it's not complete or optimized, but it express part of my initial request. prontera,128,200,6 script Testinho 94,{ .@npc_name$ = "[^FF0000 Testinho ^000000]"; mes .@npc_name$; mes "Olá, seja bem vindo ao senhor das rifas"; .@index = rand(getarraysize(.raffle)); next; mes "Gostaria de participar da rifa de hoje?"; mes "O prêmio principal será:"; mes "x"+.Grand_Prize_Amount[.@index]+" ^228B22"+ .Grand_Prize_T$[.@index]; mes ""; mes "O prêmio de ^FF0000 Consolação ^000000 será:"; mes "x"+.Consolation_Prize_Amount[.@index]+" "+ .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 Juvenal") ) { case 1: if (Zeny <= .zeny_required[.@index]) { mes "Você nao 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 voce esta sobrecarregado ou com o inventário próximo do limite!"; close; } .@p1 = (rand(1000)+1); mes "Sua chance de ganhar e 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 premio:"; mes "x"+ .Grand_Prize_Amount[.@index] +" ^228B22"+ .Grand_Prize_T$[.@index]; Zeny -= .zeny_required[.@index]; getitem .Grand_Prize$[.@index], .Grand_Prize_Amount[.@index]; close; } else{ mes "Infelizmente nao foi dessa vez, seu premio de consolacao e:"; mes "x"+ .Consolation_Prize_Amount[.@index] +" ^0000FF"+ .Consolation_Prize_T$; Zeny -= .zeny_required[.@index]; getitem .Consolation_Prize$[.@index], .Consolation_Prize_Amount[.@index]; close; } } close; OnInit: 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ções Vermelhas", "Poções Brancas", "Poções Azuis", "Jellopy", "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], 150, 350, 450, 30, 500; end; } I'll keep updating this thread until the script is finished the way i envisioned. Please point out any gross errors you find in the code, as it is the first version, there is certainly a lot to be added and improved. There are also some parts of the code written in my native language, since the server i intend to develop will be in it, I need to adapt the texts to my language. For anyone who needs learn some basics/intermediate knowledge of scripting, i recommend take a look in the GM Ocean Tutorial for Beginners: https://rathena.org/board/topic/98856-scripting-techniques-tutorialsguides/
  3. Hello Guys, firstly I would like to thank anyone for support, tips or help in resolving this issue. I'm a newbie in this matter of scripting NPC's, i made some searchs but not found something similar. I need help to create an NPC with these conditions: I will have a list of grand prizes and consolation prizes, the price for attempt and the odds. like: Raffle Grand Prize Consolation Prize Price to try Chance to get the grand prize 01 Item ID X1 Item ID Y1 V1 zeny %W1 02 Item ID X2 Item ID Y2 V2 zeny %W2 . . . . . . . . . . . . . . . XX Item ID Xn Item ID Yn Vn zeny %Wn The NPC will randomly choose one of the options from the list (Raffle column) , and then, the raffle will be available with the respectives attributes for the players to try to win the grand prize under the following conditions: If someone wins, a new raffle will be chosen randomly, if no one wins the grand prize in the last x minutes, a new raffle will be randomly chosen, and may even be the same. If possible I would like to announce to the entire server when a new raffle is available, and what the grand prize and consolation prize are. Any help or guidance is greatly appreciated!
×
×
  • Create New...