Scofield Posted December 19, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Share Posted December 19, 2013 Hello I have a custom map that has a space which has 5 lanes to make poring race, I tried to adapt the current race poring script to my map more not work, it seems to me that the race takes place on the original map in the straight X and in my custom map it can only occur in a straight line Y, anyway after much tinkering could make the race work, however the Porings run and catch on arrival and did not return to the place of beginning and not delivering premium, if anyone can help me thank you very ... follows the npc. //===== Athena Script ======================================== //= Poring Race System //===== By: ================================================== //= Zell_ff8 //= -Made for Daegaladh, www.gatsuro.tk Admin //= -and RUNE, http://ro-enhanced.net //= Some Rights Reserved //= http://creativecommons.org/licenses/by-nc-sa/2.5/ar/ //===== Current Version: ===================================== //= 0.78 //===== Compatible With: ===================================== //= eAthena SVN 9991+ && Cronus SVN 1268+ //===== Description: ========================================= //= Poring Race //===== Additional Comments: ================================= //= Tested, eA SVN Stable r10128 working 100% //= Need a lot of clean up... but, WORKS!! WTH xD //= Sorry to C&P the position check after a selection, it's a //= fast fix and don't have time to make it a function. //====== Checker: ============================================== cydonia,99,44,0 script Checker#prace0 -1,{ end; OnChequeo: set .@prace_prize, 17006; // ID do prêmio para quem vencer.[Padrão: ????] set .@prace_prize_quantity, 1; // Quantidade do prêmio. [Padrão: 1] set $prace_gate,0; for(set .@i,0; .@i < (getarraysize($prace_bidders)); set .@i, .@i + 1){ if(attachrid($prace_bidders[.@i])){ if (@prace_playing!=1) end; set @z, rand(150000,400000); dispbottom "O vencedor é o "+$prace_winner$+" e você apostou em "+@prace_winner$+"."; if (@prace_winner$==$prace_winner$ && @prace_winner$!=""){ dispbottom "Você venceu! Prêmio: 1 "+getitemname(@id); mapannounce "cydonia"," Parabéns! "+strcharinfo(0)+" venceu!",1,0xFFAB54; getitem .@prace_prize,1; emotion 21,1; } else { dispbottom "Você perdeu."; emotion 28,1; } set @prace_winner$,"";set @prace_playing,0; } //else { announce .@i+" || "+$prace_bidders[.@i],bc_all; } //debug } for(set .@i,0; .@i < (getarraysize($prace_bidders)); set .@i, .@i + 1) set $prace_bidders[.@i],0; } - script Timers#prace0 -1,{ OnClock0000: callsub OnCalll; OnClock0200: callsub OnCalll; OnClock0400: callsub OnCalll; OnClock0600: callsub OnCalll; OnClock0816: callsub OnCalll; OnClock1000: callsub OnCalll; OnClock1200: callsub OnCalll; OnClock1400: callsub OnCalll; OnClock1600: callsub OnCalll; OnClock1800: callsub OnCalll; OnClock2000: callsub OnCalll; OnClock2200: callsub OnCalll; OnCalll: set $prace_gate,1; announce "A 'Corrida dos Porings' irá começar em breve, façam suas apostas!",bc_all|bc_yellow; end; } //====== Principal: ============================================ cydonia,104,59,3 script Bidder#prace0 765,{ set .@prace_zeny,20000000; // Preço para apostar. [Padrão: 20000000] if ($prace_random < 1) callsub OnInit; if (@prace_playing==1) callsub AlreadyPlaying; if($prace_gate == 0){ mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; } getmapxy(.@mapname$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@mapname$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@mapname$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@mapname$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@mapname$,.@x5,.@y,1,"Poring Noel#prace5"); if (.@x1 != 103 || .@x2 != 106 || .@x3 != 109 || .@x4 != 112 || .@x5 != 115){ mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; } mes "[Bidder]"; mes "Escolha o poring em que deseja apostar:";mes "Irá custar "+.@prace_zeny+" Zeny.";next; switch(select("Poring","Angeling","Metaling","Deviling","Poring Noel")){ case 1: callfunc "OnBid","Poring"; case 2: callfunc "OnBid","Angeling"; case 3: callfunc "OnBid","Metaling"; case 4: callfunc "OnBid","Deviling"; case 5: callfunc "OnBid","Poring Noel"; } OnReady: set $prace_bets,$prace_bets+1; set $prace_bidders[$prace_bets],getcharid(3); set @prace_playing,1; mes "[Bidder]"; mes "Eu tenho "+$prace_bets+" apostas."; setnpctimer 60000; startnpctimer; npctalk strcharinfo(0)+" fez sua aposta!"; close; Start1: setnpctimer 0; startnpctimer; end; AlreadyPlaying: mes "[Bidder]"; mes "Você apostou em ^00bb00"+@prace_winner$+"^000000."; close; StartRace: donpcevent "Metaling#prace3::OnRace"; donpcevent "Poring#prace1::OnRace"; donpcevent "Angeling#prace2::OnRace"; donpcevent "Poring Noel#prace5::OnRace"; donpcevent "Deviling#prace4::OnRace"; end; OnStopRace: donpcevent "Poring#prace1::OnStop"; donpcevent "Angeling#prace2::OnStop"; donpcevent "Metaling#prace3::OnStop"; donpcevent "Deviling#prace4::OnStop"; donpcevent "Poring Noel#prace5::OnStop"; if ($prace_winner$!="") callsub WinRace; end; ReturnRace: donpcevent "Poring#prace1::OnReturn"; donpcevent "Angeling#prace2::OnReturn"; donpcevent "Metaling#prace3::OnReturn"; donpcevent "Deviling#prace4::OnReturn"; donpcevent "Poring Noel#prace5::OnReturn"; end; WinRace: set $prace_gate,0; mapannounce "cydonia","O vencedor é o "+$prace_winner$+".",1,0xFFAB54; donpcevent "Checker#prace0::OnChequeo"; setnpctimer 30000;startnpctimer; end; OnInit: set $prace_random,70; set $prace_random2,600; set $prace_winner$,""; set $prace_bets,0; set $prace_bidders,0; end; OnTimer500: mapannounce "cydonia","Porings, em suas marcas...",1,0xFFAB54; end; OnTimer3000: mapannounce "cydonia","...3...",1,0xFFAB54; end; OnTimer4000: mapannounce "cydonia","...2...",1,0xFFAB54; end; OnTimer5000: mapannounce "cydonia","...1...",1,0xFFAB54; callsub StartRace; end; OnTimer6000: stopnpctimer; mapannounce "cydonia","Gooo!!!",1,0xFFAB54; end; OnTimer35000: set $prace_winner$,""; set $prace_bets,0; stopnpctimer; callsub ReturnRace; OnTimer90000: npctalk "Eu tenho "+$prace_bets+" aposta(s). Alguém mais?"; end; OnTimer110000: npctalk "A corrida irá começar em breve. Última chance."; end; OnTimer120000: callsub Start1; } //====== Função Apostar: ======================================= function script OnBid { getmapxy(.@mapname$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@mapname$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@mapname$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@mapname$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@mapname$,.@x5,.@y,1,"Poring Noel#prace5"); if (.@x1 == 103 || .@x2 == 106 || .@x3 == 109 || .@x4 == 112 || .@x5 == 115){ if (Zeny < .@prace_zeny) { callsub OnZeny; } else { set Zeny,Zeny-.@prace_zeny; } set @prace_winner$,getarg(0); callsub OnReady; } mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; OnZeny: set @prace_winner$,""; mes "[Bidder]"; mes "Você não tem Zeny suficiente."; close; OnReady: set $prace_bets,$prace_bets+1; set $prace_bidders[$prace_bets],getcharid(3); set @prace_playing,1; mes "[Bidder]"; mes "Eu tenho "+$prace_bets+" apostas."; setnpctimer 60000; startnpctimer; npctalk strcharinfo(0)+" fez sua aposta!"; close; } //====== Monstros: ============================================== cydonia,103,54,4 script Poring#prace1 1002,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 103,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Poring#prace1"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 20) { set $prace_winner$,"Poring"; emotion 20; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,106,54,4 script Angeling#prace2 1096,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 106,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Angeling#prace2"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 20) { set $prace_winner$,"Angeling"; emotion 20; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,109,54,4 script Metaling#prace3 1613,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 109,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Metaling#prace3"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 20) { set $prace_winner$,"Metaling"; emotion 20; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,112,54,4 script Deviling#prace4 1582,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 112,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Deviling#prace4"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 20) { set $prace_winner$,"Deviling"; emotion 20; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,115,54,4 script Poring Noel#prace5 1062,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 115,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Poring Noel#prace5"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 20) { set $prace_winner$,"Poring Noel"; emotion 20; donpcevent "Bidder#prace0::OnStopRace"; } } Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 19, 2013 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 December 19, 2013 (edited) OnReturn: npcwalkto 112,54; end;I'm pretty sure a npc can only move within area_size ... which is 14 by default http://rathena.org/board/topic/75836-unitwalk-destination-out-of-sight/?p=171835 change all those npcwalkto into movenpc for the OnReturn: label, that should fix the bug Edited December 19, 2013 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Scofield Posted December 19, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted December 19, 2013 Hello good afternoon I entedi not very good, could be clearer? if you can help me thank you very muchI will post a print error, showing Porings are locked at the finish line and npc not give prizes nor return. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 20, 2013 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 December 20, 2013 now I get what you mean ... your script is based on http://www.eathena.ws/board/index.php?s=&showtopic=162107&view=findpost&p=1064448 but I recommend http://www.eathena.ws/board/index.php?showtopic=251477&hl= I think its better to use the later one ... that npcwalkto used to walk all over the map with full map sight range back in 2007 .. but sometime after .. our svn changed it to only walk within area_size try to rewrite your script Quote Link to comment Share on other sites More sharing options...
Scofield Posted December 20, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted December 20, 2013 (edited) Ok, my problem is that mainline map p_track01 the race takes place in the horizontal (x) and in my cydonia map it occurs in the vertical (y), then failing to make the adjustment because I'm not very good at scripter. ex: p_track01 <------ x Cydonia downw y Cydonia p_track01 the original script and the race line and X on my map and the Y line, I can not edit the script right. Edited December 20, 2013 by cumbe11 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 20, 2013 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 December 20, 2013 poring_race_portugese.txt if this doesn't work, send the cydonia map into my pm ... Quote Link to comment Share on other sites More sharing options...
Scofield Posted December 20, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted December 20, 2013 I will send you the map. Quote Link to comment Share on other sites More sharing options...
Scofield Posted January 2, 2014 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted January 2, 2014 I made the following change and now the race begins and ends perfectly, the npc poring announces the winner and they return to the place of departure, only that is not being announced the winner's name nor the awards: fixed: if ((.@y-1) == 31) { set $prace_winner$,"Metaling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } Quote Link to comment Share on other sites More sharing options...
Scofield Posted January 14, 2014 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted January 14, 2014 (edited) what is the meaning of this line? cydonia,100,42,0 script Checker#prace0 -1,{ end; Edited January 15, 2014 by cumbe11 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted January 15, 2014 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 January 15, 2014 //====== Checker: ============================================== cydonia,99,44,0 script Checker#prace0 -1,{hecker or Checker ? O_O WinRace: set $prace_gate,0; mapannounce "cydonia","O vencedor é o "+$prace_winner$+".",1,0xFFAB54; donpcevent "Checker#prace0::OnChequeo";apparently, when the a mob npc reaches the finish linewill trigger this npc ripped from eathena topic //NPC Checker - script Checker#prace0 -1,{ end; OnChequeo: for(set .@tmp1,0;.@tmp1<(getarraysize($prace_bidders));set .@tmp1,.@tmp1+1) { if(attachrid($prace_bidders[.@tmp1])) { if( prace_playing != 1) end; dispbottom "The winner is "+$prace_winner$+" and you have bet for "+prace_winner$+"."; if( prace_winner$ == $prace_winner$ && prace_winner$ != "") { dispbottom "You have won!"; mapannounce "p_track01"," Congratulations! "+strcharinfo(0)+" has won!",1,0xFFAB54; getitem 7199,2; emotion 21,1; } else dispbottom "You have lost."; emotion 28,1; set prace_winner$,""; set prace_playing,0; } //else { announce .@tmp1+" || "+$prace_bidders[.@tmp1],bc_all; } //debug } for( set .@tmp1,0; .@tmp1 < (getarraysize( $prace_bidders )); set .@tmp1,.@tmp1 + 1 ) { set $prace_bidders[.@tmp1],0; } }seems like, this script will attachrid on all account with $prace_bidders arraythen attachrid to check the permanent player variable again with a string variable (?) prace_winner$ if ( $prace_winner$ == "poring" ) then its true and getitem for the attached player ... hell ... the way this script use to check a variable is extremely unoptimized... 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted January 15, 2014 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted January 15, 2014 My race is going normally, the Porings drop out and then return to the start, the winner is announced poring over the player does not win the prize Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted January 15, 2014 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 January 15, 2014 seems like you have edited the script, post it Quote Link to comment Share on other sites More sharing options...
Scofield Posted January 15, 2014 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted January 15, 2014 the race is nearly 100%, she is starting and ending normally, just do not be giving the prize to the player, //NPC Checker - script Checker#prace0 -1,{ end; OnChequeo: for(set .@tmp1,0;.@tmp1<(getarraysize($prace_bidders));set .@tmp1,.@tmp1+1) { if(attachrid($prace_bidders[.@tmp1])) { if( prace_playing != 1) end; dispbottom "The winner is "+$prace_winner$+" and you have bet for "+prace_winner$+"."; if( prace_winner$ == $prace_winner$ && prace_winner$ != "") { dispbottom "You have won!"; mapannounce "cydonia"," Congratulations! "+strcharinfo(0)+" has won!",1,0xFFAB54; getitem 7199,2; emotion 21,1; } else dispbottom "You have lost."; emotion 28,1; set prace_winner$,""; set prace_playing,0; } //else { announce .@tmp1+" || "+$prace_bidders[.@tmp1],bc_all; } //debug } for( set .@tmp1,0; .@tmp1 < (getarraysize( $prace_bidders )); set .@tmp1,.@tmp1 + 1 ) { set $prace_bidders[.@tmp1],0; } } - script Timers#prace0 -1,{ OnClock0000: callsub OnCalll; OnClock0200: callsub OnCalll; OnClock0400: callsub OnCalll; OnClock0600: callsub OnCalll; OnClock0816: callsub OnCalll; OnClock1023: callsub OnCalll; OnClock1200: callsub OnCalll; OnClock1400: callsub OnCalll; OnClock1600: callsub OnCalll; OnClock1800: callsub OnCalll; OnClock2000: callsub OnCalll; OnClock2200: callsub OnCalll; OnCalll: set $prace_gate,1; announce "A 'Corrida dos Porings' irá começar em breve, façam suas apostas!",bc_all|bc_yellow; end; } //====== Principal: ============================================ cydonia,100,59,3 script Bidder#prace0 765,{ set .@prace_zeny,20000000; // Preço para apostar. [Padrão: 20000000] if ($prace_random < 1) callsub OnInit; if (@prace_playing==1) callsub AlreadyPlaying; if($prace_gate == 0){ mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; } getmapxy(.@mapname$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@mapname$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@mapname$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@mapname$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@mapname$,.@x5,.@y,1,"Poring Noel#prace5"); if (.@x1 != 103 || .@x2 != 106 || .@x3 != 109 || .@x4 != 112 || .@x5 != 115){ mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; } mes "[Bidder]"; mes "Escolha o poring em que deseja apostar:";mes "Irá custar "+.@prace_zeny+" Zeny.";next; switch(select("Poring","Angeling","Metaling","Deviling","Poring Noel","Poporing")){ case 1: callfunc "OnBid","Poring"; case 2: callfunc "OnBid","Angeling"; case 3: callfunc "OnBid","Metaling"; case 4: callfunc "OnBid","Deviling"; case 5: callfunc "OnBid","Poring Noel"; } OnReady: set $prace_bets,$prace_bets+1; set $prace_bidders[$prace_bets],getcharid(3); set @prace_playing,1; mes "[Bidder]"; mes "Eu tenho "+$prace_bets+" apostas."; setnpctimer 60000; startnpctimer; npctalk strcharinfo(0)+" fez sua aposta!"; close; Start1: setnpctimer 0; startnpctimer; end; AlreadyPlaying: mes "[Bidder]"; mes "Você apostou em ^00bb00"+@prace_winner$+"^000000."; close; StartRace: donpcevent "Metaling#prace3::OnRace"; donpcevent "Poring#prace1::OnRace"; donpcevent "Angeling#prace2::OnRace"; donpcevent "Poring Noel#prace5::OnRace"; donpcevent "Deviling#prace4::OnRace"; end; OnStopRace: donpcevent "Poring#prace1::OnStop"; donpcevent "Angeling#prace2::OnStop"; donpcevent "Metaling#prace3::OnStop"; donpcevent "Deviling#prace4::OnStop"; donpcevent "Poring Noel#prace5::OnStop"; if ($prace_winner$!="") callsub WinRace; end; ReturnRace: donpcevent "Poring#prace1::OnReturn"; donpcevent "Angeling#prace2::OnReturn"; donpcevent "Metaling#prace3::OnReturn"; donpcevent "Deviling#prace4::OnReturn"; donpcevent "Poring Noel#prace5::OnReturn"; end; WinRace: set $prace_gate,0; mapannounce "cydonia","O vencedor é o "+$prace_winner$+".",1,0xFFAB54; donpcevent "Checker#prace0::OnChequeo"; setnpctimer 30000;startnpctimer; end; OnInit: set $prace_random,70; set $prace_random2,600; set $prace_winner$,""; set $prace_bets,0; set $prace_bidders,0; end; OnTimer500: mapannounce "cydonia","Porings, em suas marcas...",1,0xFFAB54; end; OnTimer3000: mapannounce "cydonia","...3...",1,0xFFAB54; end; OnTimer4000: mapannounce "cydonia","...2...",1,0xFFAB54; end; OnTimer5000: mapannounce "cydonia","...1...",1,0xFFAB54; callsub StartRace; end; OnTimer6000: stopnpctimer; mapannounce "cydonia","Gooo!!!",1,0xFFAB54; end; OnTimer35000: set $prace_winner$,""; set $prace_bets,0; stopnpctimer; callsub ReturnRace; OnTimer90000: npctalk "Eu tenho "+$prace_bets+" aposta(s). Alguém mais?"; end; OnTimer110000: npctalk "A corrida irá começar em breve. Última chance."; end; OnTimer120000: callsub Start1; } //====== Função Apostar: ======================================= function script OnBid { getmapxy(.@mapname$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@mapname$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@mapname$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@mapname$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@mapname$,.@x5,.@y,1,"Poring Noel#prace5"); if (.@x1 == 103 || .@x2 == 106 || .@x3 == 109 || .@x4 == 112 || .@x5 == 115){ if (Zeny < .@prace_zeny) { callsub OnZeny; } else { set Zeny,Zeny-.@prace_zeny; } set @prace_winner$,getarg(0); callsub OnReady; } mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; OnZeny: set @prace_winner$,""; mes "[Bidder]"; mes "Você não tem Zeny suficiente."; close; OnReady: set $prace_bets,$prace_bets+1; set $prace_bidders[$prace_bets],getcharid(3); set @prace_playing,1; mes "[Bidder]"; mes "Eu tenho "+$prace_bets+" apostas."; setnpctimer 60000; startnpctimer; npctalk strcharinfo(0)+" fez sua aposta!"; close; } //====== Monstros: ============================================== cydonia,103,54,4 script Poring#prace1 1002,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 103,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Poring#prace1"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Poring"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,106,54,4 script Angeling#prace2 1096,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 106,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Angeling#prace2"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Angeling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,109,54,4 script Metaling#prace3 1613,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 109,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Metaling#prace3"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Metaling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,112,54,4 script Deviling#prace4 1582,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 112,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Deviling#prace4"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Deviling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,115,54,4 script Poring Noel#prace5 1062,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 115,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Poring Noel#prace5"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Poring Noel"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted January 15, 2014 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 January 15, 2014 there is a typo with your @prace_winner$ ... or issit prace_winner$ ?inside Checker#prace0 npcthe variable is prace_winner$but inside Bidder#prace0 npcthe variable become @prace_winner$ ? Quote Link to comment Share on other sites More sharing options...
Scofield Posted January 15, 2014 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted January 15, 2014 is that I used your example to see if it worked. before it was so cydonia,99,44,0 script Checker#prace0 -1,{ end; OnChequeo: set .@prace_prize, 17006; // ID do prêmio para quem vencer.[Padrão: ????] set .@prace_prize_quantity, 1; // Quantidade do prêmio. [Padrão: 1] set $prace_gate,0; for(set .@i,0; .@i < (getarraysize($prace_bidders)); set .@i, .@i + 1){ if(attachrid($prace_bidders[.@i])){ if (@prace_playing!=1) end; set @z, rand(150000,400000); dispbottom "O vencedor é o "+$prace_winner$+" e você apostou em "+@prace_winner$+"."; if (@prace_winner$==$prace_winner$ && @prace_winner$!=""){ dispbottom "Você venceu! Prêmio: 1 "+getitemname(@id); mapannounce "cydonia"," Parabéns! "+strcharinfo(0)+" venceu!",1,0xFFAB54; getitem .@prace_prize,1; emotion 21,1; warp "prontera",150,170; } else { dispbottom "Você perdeu."; emotion 28,1; warp "prontera",150,170; } set @prace_winner$,"";set @prace_playing,0; } //else { announce .@i+" || "+$prace_bidders[.@i],bc_all; } //debug } for(set .@i,0; .@i < (getarraysize($prace_bidders)); set .@i, .@i + 1) set $prace_bidders[.@i],0; } Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted January 15, 2014 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 January 15, 2014 (edited) no.1 bug I found is $prace_bidders is actually an array inside the OnInit: do deletearray $prace_bidders instead of set it 0 .. no.2 bug is you changed prace_playing into @prace_playing means if the one who 1st placed the betting log out, the rest won't get the price for(set .@i,0; .@i < (getarraysize($prace_bidders)); set .@i, .@i + 1){ if(attachrid($prace_bidders[.@i])){ if (@prace_playing!=1) end; ....... }it ends the script immediatelymaybe change it to continue; might work no.3 have you try login 2 accounts and start the bet with both of them ? it seems this script start the npc timer THE MOMENT ANY PLAYER placed their bets I thought, an event script like this, the npc timer shouldn't be controlled by the players, but from OnClock something ... even if you want to do it that way, you should use a npc variable .start or something and check if the event has already started or not... haiz ... I don't understand why the timer is set to 60000 for registration and set to 0 when the race going to start ... really made me misunderstood that part, I don't think any normal scripter will want to script it this way ... hmm .. too unoptimized ... to read ... nvm ... reading this script seriously hurting my eyes ... how come you can get the race started ? the startnpctimer is located inside a function, and I thought npc timer has to be on the npc itself ? <-- not tested tested ... can ... wtf ... I just know about this ... I used *sleep too much <.< prontera,159,184,5 script jsfkjsfs2 100,{ callfunc "asdfgh"; sleep2 1000; dispbottom getnpctimer(0); end; OnTimer10000: end; } function script asdfgh { startnpctimer; return; } seriously ... I would rather rewrite the whole script than just keep guessing where the bug come from the labels jump here and there makes this script seriously hard to read I getting this error after finally get the race started [Error]: script:run_func: C_ARG not found. please report this!!! [Debug]: Source (NPC): Poring#prace1 at cydonia (103,54)dunno what kind of error is thisbut don't feel like debug this script anymore I would prefer that you translate the script made by Masao instead of using this hard to read script Edited January 15, 2014 by AnnieRuru 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted January 15, 2014 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: 16 hours ago Author Share Posted January 15, 2014 (edited) I will try to correct the correct part @ prace_playing to see if the end of the event the npc sends the prize, Yes, the race takes place and ends normally, the only problem is that the npc does the prize at the end. Good *-* Now the race seems to be 100%, be sending the prize at the end of the race.. Trx.. =) fix //NPC Checker - script Checker#prace0 -1,{ end; OnChequeo: for(set .@tmp1,0;.@tmp1<(getarraysize($prace_bidders));set .@tmp1,.@tmp1+1) { if(attachrid($prace_bidders[.@tmp1])) { if( @prace_playing != 1) end; dispbottom "The winner is "+$prace_winner$+" and you have bet for "+prace_winner$+"."; if( prace_winner$ == $prace_winner$ && prace_winner$ != "") { dispbottom "You have won!"; mapannounce "cydonia"," Congratulations! "+strcharinfo(0)+" has won!",1,0xFFAB54; getitem 7199,2; emotion 21,1; } else dispbottom "You have lost."; emotion 28,1; set prace_winner$,""; set @prace_playing,0; } //else { announce .@tmp1+" || "+$prace_bidders[.@tmp1],bc_all; } //debug } for( set .@tmp1,0; .@tmp1 < (getarraysize( $prace_bidders )); set .@tmp1,.@tmp1 + 1 ) { set $prace_bidders[.@tmp1],0; } } - script Timers#prace0 -1,{ OnClock0000: callsub OnCalll; OnClock0200: callsub OnCalll; OnClock0400: callsub OnCalll; OnClock0600: callsub OnCalll; OnClock0816: callsub OnCalll; OnClock1023: callsub OnCalll; OnClock1200: callsub OnCalll; OnClock1400: callsub OnCalll; OnClock1600: callsub OnCalll; OnClock1800: callsub OnCalll; OnClock2000: callsub OnCalll; OnClock2200: callsub OnCalll; OnCalll: set $prace_gate,1; announce "A 'Corrida dos Porings' irá começar em breve, façam suas apostas!",bc_all|bc_yellow; end; } //====== Principal: ============================================ cydonia,100,59,3 script Bidder#prace0 765,{ set .@prace_zeny,20000000; // Preço para apostar. [Padrão: 20000000] if ($prace_random < 1) callsub OnInit; if (@prace_playing==1) callsub AlreadyPlaying; if($prace_gate == 0){ mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; } getmapxy(.@mapname$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@mapname$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@mapname$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@mapname$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@mapname$,.@x5,.@y,1,"Poring Noel#prace5"); if (.@x1 != 103 || .@x2 != 106 || .@x3 != 109 || .@x4 != 112 || .@x5 != 115){ mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; } mes "[Bidder]"; mes "Escolha o poring em que deseja apostar:";mes "Irá custar "+.@prace_zeny+" Zeny.";next; switch(select("Poring","Angeling","Metaling","Deviling","Poring Noel","Poporing")){ case 1: callfunc "OnBid","Poring"; case 2: callfunc "OnBid","Angeling"; case 3: callfunc "OnBid","Metaling"; case 4: callfunc "OnBid","Deviling"; case 5: callfunc "OnBid","Poring Noel"; } OnReady: set $prace_bets,$prace_bets+1; set $prace_bidders[$prace_bets],getcharid(3); set @prace_playing,1; mes "[Bidder]"; mes "Eu tenho "+$prace_bets+" apostas."; setnpctimer 60000; startnpctimer; npctalk strcharinfo(0)+" fez sua aposta!"; close; Start1: setnpctimer 0; startnpctimer; end; AlreadyPlaying: mes "[Bidder]"; mes "Você apostou em ^00bb00"+prace_winner$+"^000000."; close; StartRace: donpcevent "Metaling#prace3::OnRace"; donpcevent "Poring#prace1::OnRace"; donpcevent "Angeling#prace2::OnRace"; donpcevent "Poring Noel#prace5::OnRace"; donpcevent "Deviling#prace4::OnRace"; end; OnStopRace: donpcevent "Poring#prace1::OnStop"; donpcevent "Angeling#prace2::OnStop"; donpcevent "Metaling#prace3::OnStop"; donpcevent "Deviling#prace4::OnStop"; donpcevent "Poring Noel#prace5::OnStop"; if ($prace_winner$!="") callsub WinRace; end; ReturnRace: donpcevent "Poring#prace1::OnReturn"; donpcevent "Angeling#prace2::OnReturn"; donpcevent "Metaling#prace3::OnReturn"; donpcevent "Deviling#prace4::OnReturn"; donpcevent "Poring Noel#prace5::OnReturn"; end; WinRace: set $prace_gate,0; mapannounce "cydonia","O vencedor é o "+$prace_winner$+".",1,0xFFAB54; donpcevent "Checker#prace0::OnChequeo"; setnpctimer 30000;startnpctimer; end; OnInit: set $prace_random,70; set $prace_random2,600; set $prace_winner$,""; set $prace_bets,0; set $prace_bidders,0; end; OnTimer500: mapannounce "cydonia","Porings, em suas marcas...",1,0xFFAB54; end; OnTimer3000: mapannounce "cydonia","...3...",1,0xFFAB54; end; OnTimer4000: mapannounce "cydonia","...2...",1,0xFFAB54; end; OnTimer5000: mapannounce "cydonia","...1...",1,0xFFAB54; callsub StartRace; end; OnTimer6000: stopnpctimer; mapannounce "cydonia","Gooo!!!",1,0xFFAB54; end; OnTimer35000: set $prace_winner$,""; set $prace_bets,0; stopnpctimer; callsub ReturnRace; OnTimer90000: npctalk "Eu tenho "+$prace_bets+" aposta(s). Alguém mais?"; end; OnTimer110000: npctalk "A corrida irá começar em breve. Última chance."; end; OnTimer120000: callsub Start1; } //====== Função Apostar: ======================================= function script OnBid { getmapxy(.@mapname$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@mapname$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@mapname$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@mapname$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@mapname$,.@x5,.@y,1,"Poring Noel#prace5"); if (.@x1 == 103 || .@x2 == 106 || .@x3 == 109 || .@x4 == 112 || .@x5 == 115){ if (Zeny < .@prace_zeny) { callsub OnZeny; } else { set Zeny,Zeny-.@prace_zeny; } set prace_winner$,getarg(0); callsub OnReady; } mes "[Bidder]"; mes "Uma corrida está em andamento..."; close; OnZeny: set prace_winner$,""; mes "[Bidder]"; mes "Você não tem Zeny suficiente."; close; OnReady: set $prace_bets,$prace_bets+1; set $prace_bidders[$prace_bets],getcharid(3); set @prace_playing,1; mes "[Bidder]"; mes "Eu tenho "+$prace_bets+" apostas."; setnpctimer 60000; startnpctimer; npctalk strcharinfo(0)+" fez sua aposta!"; close; } //====== Monstros: ============================================== cydonia,103,54,4 script Poring#prace1 1002,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 103,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Poring#prace1"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Poring"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,106,54,4 script Angeling#prace2 1096,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 106,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Angeling#prace2"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Angeling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,109,54,4 script Metaling#prace3 1613,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 109,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Metaling#prace3"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Metaling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,112,54,4 script Deviling#prace4 1582,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 112,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Deviling#prace4"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Deviling"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } cydonia,115,54,4 script Poring Noel#prace5 1062,{ end; OnRace: initnpctimer; startnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 115,54; end; OnTimer1100: getmapxy(.@mapname$,.@x,.@y,1,"Poring Noel#prace5"); if(rand(100) < $prace_random) npcwalkto .@x,.@y-1; setnpctimer rand($prace_random2); startnpctimer; if ((.@y-1) == 31) { set $prace_winner$,"Poring Noel"; emotion 29; donpcevent "Bidder#prace0::OnStopRace"; } } Edited January 16, 2014 by cumbe11 Quote Link to comment Share on other sites More sharing options...
Question
Scofield
Hello I have a custom map that has a space which has 5 lanes to make poring race, I tried to adapt the current race poring script to my map more not work, it seems to me that the race takes place on the original map in the straight X and in my custom map it can only occur in a straight line Y, anyway after much tinkering could make the race work, however the Porings run and catch on arrival and did not return to the place of beginning and not delivering premium, if anyone can help me thank you very ... follows the npc.
Link to comment
Share on other sites
16 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.