ADM Ytallo Posted October 30, 2018 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 98 Reputation: 3 Joined: 09/02/18 Last Seen: May 29, 2020 Share Posted October 30, 2018 the player will put a ticket on the machine, and it will give 1 random iten Quote Link to comment Share on other sites More sharing options...
0 utofaery Posted February 9, 2019 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 228 Reputation: 19 Joined: 10/27/12 Last Seen: March 17, 2019 Share Posted February 9, 2019 (edited) prontera,141,226,4 script Maquina de Promoções 2_DROP_MACHINE,{ //debugonly dispbottom ( "debug :: .len_i " + .len_i + ".itm_a " + .itm_a + ".itm_p " + .itm_p + " ." ) ; mes .npc_n$; mes "It only cost " + .itm_a + " " + getitemname(.itm_p) + "to use this machine!"; mes "Would you like to use it?"; next; if(select("^0084ff[ • ]^000000 Yes:^CD3278[ • ]^000000 No:^0084ff[ • ]^000000 What can I earn??")&2) { if(@menu-2) { .@mes$ = "You can get: "; for( .@a = 1; .@a <=.len_i; .@a++ ) { .@itm$ = getitemname(.itm_l[(.@a-1)]); if(.@a%10&&.@a<=.len_i&&.@a!=.len_i) { .@mes$ = .@mes$+((!((.@a%10)-9)&&.@a<=.len_i)?"and "+.@itm$+".":.@itm$+", "); } else { mes .npc_n$; if(.@a<.len_i) { mes .@mes$; .@mes$ = "You can also get : "+.@itm$+", "; next; if(select("Continue:Cancel")&2) close; } else { mes .@mes$+"and "+.@itm$+"."; close; } } } } else close; } if (countitem(.itm_p) < .itm_a) { mes .npc_n$; mes "You do not have "+.itm_a+" "+getitemname(.itm_p); close; } .@rand = rand(.totalchance); .@i = 0; while ( ( .@rand -= .it_rates[.@i] ) >= 0 ) .@i++; mes .npc_n$; mes "Here it is!"; delitem .itm_p,.itm_a; getitem .itm_l[.@i], 1; .@gitem$ = getitemname(.itm_l[.@i]); // dispbottom ("debug :: .@gitem$ " + .@gitem$ + " .itm_l[.@i]" + .itm_l[.@i] ); announce strnpcinfo(0)+": "+strcharinfo(0)+" won ["+.@gitem$+"] da Máquina de Promoções!",bc_all|bc_yellow; //debugonly dispbottom ( " debug :: .it_rates " + .it_rates + " .totalchance :: " + .totalchance + " .@rand :: " + .@rand) ; close; OnInit: .npc_n$ = "[^ 4B0082 Promotion Kit ^ 000000]"; // NPC Name. setarray .itm_l , 502, 678, 607 ,608 ,2101 ,1505 ,609;// Item List setarray .it_rates, 15, 16, 17, 18, 19, 20, 21; // ?item?rates? .len_i = getarraysize(.itm_l); //item id array size .itm_a = 1; //per draw Item cost .itm_p = 512; //per draw item ID .@i = 0; while ( .itm_l[.@i] ) { .totalchance += .it_rates[.@i]; .@i++; } } /*choosing rates... prontera,157,180,5 script test item_reward#3 100,{ .@rand = rand(.totalchance); .@i = 0; while ( ( .@rand -= .itemchance[.@i] ) >= 0 ) .@i++; getitem .itemid[.@i], 1; end; OnInit: setarray .itemid, 501,502,503,504,505,506,507,508,509; setarray .itemchance, 10,10,10,10,3,10,10,10,10; .@i = 0; while ( .itemid[.@i] ) { .totalchance += .itemchance[.@i]; .@i++; } end; } */ Tidy up Updated per request. Edited February 9, 2019 by utofaery 1 Quote Link to comment Share on other sites More sharing options...
0 pajodex Posted October 30, 2018 Group: Members Topic Count: 79 Topics Per Day: 0.03 Content Count: 439 Reputation: 173 Joined: 12/12/17 Last Seen: April 14 Share Posted October 30, 2018 Here rAthena has very sophisticated functions. please use them. Quote Link to comment Share on other sites More sharing options...
0 ADM Ytallo Posted October 30, 2018 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 98 Reputation: 3 Joined: 09/02/18 Last Seen: May 29, 2020 Author Share Posted October 30, 2018 4 hours ago, pajodex said: Aqui A rena tem funções muito sofisticadas. por favor use-os. It does not fit the way I have there. Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted October 30, 2018 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Yesterday at 05:32 PM Share Posted October 30, 2018 prontera,155,181,5 script Sample 4_F_KAFRA1,{ .@ticket_id = 7539; .@amount = 1; if (countitem(.@ticket_id) >= .@amount) { delitem .@ticket_id, .@amount; getitem F_Rand(501, 502, 503, 504, 505, 506), 1; } end; } 1 Quote Link to comment Share on other sites More sharing options...
0 ADM Ytallo Posted October 30, 2018 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 98 Reputation: 3 Joined: 09/02/18 Last Seen: May 29, 2020 Author Share Posted October 30, 2018 (edited) 12 hours ago, Emistry said: prontera,155,181,5 script Sample 4_F_KAFRA1,{ .@ticket_id = 7539; .@amount = 1; if (countitem(.@ticket_id) >= .@amount) { delitem .@ticket_id, .@amount; getitem F_Rand(501, 502, 503, 504, 505, 506), 1; } end; } help me with this script I want this npc to randomly give me items and I want to set the rate..! https://pastebin.com/MaWCq2D5 Edited October 31, 2018 by Emistry Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted November 2, 2018 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Yesterday at 05:32 PM Share Posted November 2, 2018 https://pastebin.com/mXGBQhVz Quote Link to comment Share on other sites More sharing options...
0 ADM Ytallo Posted November 9, 2018 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 98 Reputation: 3 Joined: 09/02/18 Last Seen: May 29, 2020 Author Share Posted November 9, 2018 (edited) este NPC está dando itens aleatórios. Eu quero definir a taxa de cada item, é possível? Edited November 19, 2018 by YtalloNv Quote Link to comment Share on other sites More sharing options...
0 Chaos92 Posted November 9, 2018 Group: Members Topic Count: 49 Topics Per Day: 0.01 Content Count: 1826 Reputation: 288 Joined: 08/03/12 Last Seen: 5 hours ago Share Posted November 9, 2018 4 hours ago, YtalloNv said: this NPC is giving random items. I want to set the rate of each item, is it possible? maquina_surpresa.txt Hello, can you use code function ? Sorry but.. its better for us to see the codes clearly rather than download it as a MUST. Quote Link to comment Share on other sites More sharing options...
0 ADM Ytallo Posted January 21, 2019 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 98 Reputation: 3 Joined: 09/02/18 Last Seen: May 29, 2020 Author Share Posted January 21, 2019 On 11/10/2018 at 2:11 AM, Chaos92 said: Olá, você pode usar a função de código? Desculpe, mas .. é melhor para nós para ver os códigos claramente ao invés de baixá-lo como uma obrigação. I want to be able to control the rate of items on this NPC prontera,141,226,4 script Maquina de Promoções 2_DROP_MACHINE,{ mes .npc_n$; mes "Apenas "+.itm_a+" "+.itm_n$+" para usar essa maquina!"; mes "Você gostaria de usar?"; next; if(select("^0084ff[ • ]^000000 Sim:^CD3278[ • ]^000000 Não:^0084ff[ • ]^000000 O que posso ganhar?")&2) { if(@menu-2) { set .@mes$, "Pode ganhar: "; for(set(.@a,1);.@a<=.len_i;set(.@a,.@a+1)) { set .@itm$, getitemname(.itm_l[(.@a-1)]); if(.@a%10&&.@a<=.len_i&&.@a!=.len_i) { set .@mes$, .@mes$+((!((.@a%10)-9)&&.@a<=.len_i)? "and "+.@itm$+".":.@itm$+", "); } else { mes .npc_n$; if(.@a<.len_i) { mes .@mes$; set .@mes$, "Você também pode ganhar: "+.@itm$+", "; next; if(select("Seguir:Fechar")&2) close; } else { mes .@mes$+"and "+.@itm$+"."; close; } } } } else close; } if (countitem(.itm_p) < .itm_a) { mes .npc_n$; mes "Você não tem "+.itm_a+" "+.itm_n$; close; } mes .npc_n$; mes "Aqui está!"; delitem .itm_p,.itm_a; set .@get, .itm_l[rand(.len_i-1)]; if(compare(.itm_a$,""+.@get)) announce strnpcinfo(0)+": "+strcharinfo(0)+" Obteve ["+getitemname(.@get)+"] da Máquina de Promoções!",bc_all|bc_yellow; getitem .@get,1; close; OnInit: set .npc_n$, "[^4B0082Maquina de Promoções^000000]"; //Nome NPC. setarray .itm_l , 502, 678, 607 ,608 ,2101 ,1505 ,609;// Lista de Itens set .itm_a$, "1505";//IDs de item nesta cadeia são anunciados. set .len_i , getarraysize(.itm_l); //Comprimento da matriz. set .itm_a , 1; //Custo do NPC. set .itm_p , 7608; //Item usado como moeda. set .itm_n$, getitemname(.itm_p); //Nome do item. } up Quote Link to comment Share on other sites More sharing options...
0 AnnieRuru Posted February 10, 2019 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted February 10, 2019 (edited) prontera,157,180,5 script test item_reward#3 2_VENDING_MACHINE1,{ if ( !countitem(.itemuse) ) { mes "A "+ getitemname(.itemuse) +" is needed to use this machine"; close; } delitem .itemuse, 1; .@r = rand(.totalchance); for ( .@i = 0; ( .@r -= .itemchance[.@i] ) >= 0; ++.@i ); getitem .itemid[.@i], 1; end; OnInit: .itemuse = 7539; // poring coin setarray .itemid, 501,502,503,504,505,506,507,508,509; setarray .itemchance, 10,10,10,10,3,10,10,10,10; for ( .@i = 0; .itemid[.@i]; ++.@i ) .totalchance += .itemchance[.@i]; end; } btw this script is call "lotti girl"https://rathena.org/board/search/?&q=lotti&search_and_or=and&sortby=relevancy a lot of results return from it Edited February 10, 2019 by AnnieRuru 1 Quote Link to comment Share on other sites More sharing options...
0 ADM Ytallo Posted April 6, 2019 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 98 Reputation: 3 Joined: 09/02/18 Last Seen: May 29, 2020 Author Share Posted April 6, 2019 On 2/9/2019 at 8:17 PM, utofaery said: prontera,141,226,4 script Maquina de Promoções 2_DROP_MACHINE,{ //debugonly dispbottom ( "debug :: .len_i " + .len_i + ".itm_a " + .itm_a + ".itm_p " + .itm_p + " ." ) ; mes .npc_n$; mes "It only cost " + .itm_a + " " + getitemname(.itm_p) + "to use this machine!"; mes "Would you like to use it?"; next; if(select("^0084ff[ • ]^000000 Yes:^CD3278[ • ]^000000 No:^0084ff[ • ]^000000 What can I earn??")&2) { if(@menu-2) { .@mes$ = "You can get: "; for( .@a = 1; .@a <=.len_i; .@a++ ) { .@itm$ = getitemname(.itm_l[(.@a-1)]); if(.@a%10&&.@a<=.len_i&&.@a!=.len_i) { .@mes$ = .@mes$+((!((.@a%10)-9)&&.@a<=.len_i)?"and "+.@itm$+".":.@itm$+", "); } else { mes .npc_n$; if(.@a<.len_i) { mes .@mes$; .@mes$ = "You can also get : "+.@itm$+", "; next; if(select("Continue:Cancel")&2) close; } else { mes .@mes$+"and "+.@itm$+"."; close; } } } } else close; } if (countitem(.itm_p) < .itm_a) { mes .npc_n$; mes "You do not have "+.itm_a+" "+getitemname(.itm_p); close; } .@rand = rand(.totalchance); .@i = 0; while ( ( .@rand -= .it_rates[.@i] ) >= 0 ) .@i++; mes .npc_n$; mes "Here it is!"; delitem .itm_p,.itm_a; getitem .itm_l[.@i], 1; .@gitem$ = getitemname(.itm_l[.@i]); // dispbottom ("debug :: .@gitem$ " + .@gitem$ + " .itm_l[.@i]" + .itm_l[.@i] ); announce strnpcinfo(0)+": "+strcharinfo(0)+" won ["+.@gitem$+"] da Máquina de Promoções!",bc_all|bc_yellow; //debugonly dispbottom ( " debug :: .it_rates " + .it_rates + " .totalchance :: " + .totalchance + " .@rand :: " + .@rand) ; close; OnInit: .npc_n$ = "[^ 4B0082 Promotion Kit ^ 000000]"; // NPC Name. setarray .itm_l , 502, 678, 607 ,608 ,2101 ,1505 ,609;// Item List setarray .it_rates, 15, 16, 17, 18, 19, 20, 21; // ?item?rates? .len_i = getarraysize(.itm_l); //item id array size .itm_a = 1; //per draw Item cost .itm_p = 512; //per draw item ID .@i = 0; while ( .itm_l[.@i] ) { .totalchance += .it_rates[.@i]; .@i++; } } /*choosing rates... prontera,157,180,5 script test item_reward#3 100,{ .@rand = rand(.totalchance); .@i = 0; while ( ( .@rand -= .itemchance[.@i] ) >= 0 ) .@i++; getitem .itemid[.@i], 1; end; OnInit: setarray .itemid, 501,502,503,504,505,506,507,508,509; setarray .itemchance, 10,10,10,10,3,10,10,10,10; .@i = 0; while ( .itemid[.@i] ) { .totalchance += .itemchance[.@i]; .@i++; } end; } */ Tidy up Updated per request. Have you removed the control of items to be announced have to add dinovo and leave the control of fees! Quote Link to comment Share on other sites More sharing options...
Question
ADM Ytallo
the player will put a ticket on the machine, and it will give 1 random iten
Link to comment
Share on other sites
11 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.