donkeyg Posted November 24, 2012 Posted November 24, 2012 warp into a room and in when every one ready spawn a dozen of candy. in 10 second player who grab the most candy is the winner and wil receive Poring Coin Quote
Emistry Posted November 26, 2012 Posted November 26, 2012 try this.. http://pastebin.com/raw.php?i=WtY1MGqM 1 Quote
AnnieRuru Posted November 27, 2012 Posted November 27, 2012 1. its better to do delitem when the event about to start ... player might cheat to collect them from other means ( taken from previous round and drop on floor ... etc ) 2. you can just store the value of highest value candy user in strcharinfo(0) or getcharid(3) .. then no need to reloop for 2nd time .. 1 Quote
Emistry Posted November 27, 2012 Posted November 27, 2012 @Annie thx for remind to remove the candy before they enter the event... for the event .... there might be a small possibilities that several players might have same amount of candy when they "win" the event so i just loop through to find the highest amount of candy holder ... and the loop again and give reward for those player who gained most candy than others.... the second suggestion that store the winner that annie suggest only work for 1 winner...it would be unfair to give only 1 player reward while there is more than 1 winner... or maybe annie was refer another method for this ? currently didnt know if there is any other better method .... http://pastebin.com/raw.php?i=KRpvRfNE Quote
GmOcean Posted November 27, 2012 Posted November 27, 2012 Why not store the information into an array. While attaching each player, set array[0] as the highest. Then when someone has the same amount set it to array[1] and so on. And finally if someone has the highest, delete array and set at [0]. Lastly you can store the amount and players I'd in the same array slot so you can retrieve the information later using explode to reattach and give the prize. This way you wouldn't need to loop through all the players again, just the ones you know are winners. Quote
AnnieRuru Posted November 27, 2012 Posted November 27, 2012 (edited) hmm ... it seems I have complicated a little bit I used 2 dimension array to calculate the highest amount candy prontera,155,184,5 script kjdshfdkshf 100,{ if ( .start == 0 ) { dispbottom "no event atm"; end; } if ( .start == 2 ) { dispbottom "event is running"; end; } if ( checkcart() ) { // common sense, countitem/delitem couldn't search into a cart, and a blacksmith can use greed ... hmm greed can be use without cart dispbottom "you can't bring a cart into this event"; end; } if ( getarraysize( .register_aid ) >= 100 ) { dispbottom "limitation reach"; end; } warp "guild_vs2", 0,0; .register_aid[ getarraysize( .register_aid ) ] = getcharid(3); end; OnWhisperGlobal: if ( .start ) end; announce "pick up event registration start", 0; .start = 1; sleep 10000; announce "pick up event registration close", 0; .start = 2; sleep 3000; mapannounce "guild_vs2", "pick up as many items on floor as you can !", 0; sleep 1000; for ( .@i = 5; .@i >= 0; .@i-- ) { mapannounce "guild_vs2", "["+ .@i +"]", 0; sleep 1000; } .@drop_candy_amount = getarraysize( .register_aid ) * 12; freeloop 1; while ( .@i < .@drop_candy_amount ) { while ( checkcell( "guild_vs2", .@x = rand(150), .@y = rand(150), cell_chknopass ) ); makeitem "Candy",1,"guild_vs2", .@x, .@y; .@i++; } freeloop 0; sleep 10000; .@size = getarraysize( .register_aid ); for ( .@i = 0; .@i < .@size; .@i++ ) { if ( attachrid( .register_aid[.@i] ) ) { .@amount = countitem( "Candy" ); if ( .@amount >= .@highest ) { setd ".@count"+ .@amount +"["+ getarraysize( getd( ".@count"+ .@amount ) ) +"]", getcharid(3); .@highest = .@amount; } delitem "Candy", countitem( "Candy" ); } } atcommand "@cleanmap"; // randomly attach someone to @cleanmap .@size = getarraysize( getd( ".@count"+ .@highest ) ); for ( .@i = 0; .@i < .@size; .@i++ ) { attachrid getd( ".@count"+ .@highest +"["+ .@i +"]" ); getitem "Poring_Coin", 1; .@name$ = .@name$ +( ( .@i )? " , ":"" )+"["+ rid2name( getd( ".@count"+ .@highest +"["+ .@i +"]" ) ) +"]"; } mapannounce "guild_vs2", "event end, there are "+ .@size +" player having most candy ! "+ .@name$, 0; sleep 5000; getmapxy .@map$, .@x, .@y, 1; mapwarp "guild_vs2", .@map$, .@x, .@y; deletearray .register_aid; .start = 0; end; OnPCLogoutEvent: if ( .start ) { .@size = getarraysize( .register_aid ); while ( getcharid(3) != .register_aid[.@i] && .@size < .@i ) .@i++; if ( .@i < .@size ) deletearray .register_aid[.@i], 1; } end; } guild_vs2 mapflag nowarp guild_vs2 mapflag nowarpto guild_vs2 mapflag noteleport guild_vs2 mapflag nomemo guild_vs2 mapflag noicewall guild_vs2 mapflag nobranch guild_vs2 mapflag nosave SavePoint btw now compare to mine, I just find out ... emistry still need to learn more about how to use OnPCLogoutEvent / OnPCDieEvent / OnPCLoginEvent properly if you guys want to master an event script, has to utilize these OnPC***Event properly @GmOcean I think you are the same, I also just realize your script also didn't make use of them properly tomorrow I'll criticize your script EDIT: almost forgotten about @cleanmap Edited November 27, 2012 by AnnieRuru Quote
Omnipotent Posted November 27, 2012 Posted November 27, 2012 (edited) You will have to set mapflags because a player can get into the room with Warp Portal and then exchange candys. Or better solution, make a new item and put a new line in item_trade.txt (because some monsters drops candys), the only way to get that item will be on the event. And I dunno, but the items deletion is before the winner check, so he will not have the user amount=maxcandy. Edited November 27, 2012 by Omnipotent Quote
GmOcean Posted November 27, 2012 Posted November 27, 2012 O.o are you sure.. Well, I haven't tried making this script just suggested a method to store the information to reward all players who have the highest amount. Quote
Omnipotent Posted November 27, 2012 Posted November 27, 2012 I little detail I see in Ruru's script is that everyone can win if they all don't pick any candy, so that would be somewhat exploitable. I think a min amount to pick would be somewhat to prevent that exploit set .@min, 5; if ( .@amount > .@highest && .@amount > .@min ) { 1 Quote
donkeyg Posted November 28, 2012 Author Posted November 28, 2012 ahhhhh.. which event script shud i use?? Quote
AnnieRuru Posted November 28, 2012 Posted November 28, 2012 (edited) @GmOcean yeah, I felt like ... my way is more efficient and what I'm trying to tell, is because event script is unlike any other kind of scripts for algorithm or utility type scripts ... you can just keep testing in test server and once you get the correct result, its good to release but event script needs A LOT of experiences and many members feedback to know about the rare bugs and exploits and the fastest way to learn about event script is learn from criticize from other scripters just like Omnipotent doing atm @Omnipotent You will have to set mapflags because a player can get into the room with Warp Portal and then exchange candys.yes, I already set nomemo mapflagnowarp and nowarpto mapflag is also a common sense to set inside an event script Or better solution, make a new item and put a new line in item_trade.txt (because some monsters drops candys), the only way to get that item will be on the event. And I dunno, but the items deletion is before the winner check, so he will not have the user amount=maxcandy. I think, do another delitem at the time during player register might be better xD I little detail I see in Ruru's script is that everyone can win if they all don't pick any candy, so that would be somewhat exploitable. I think a min amount to pick would be somewhat to prevent that exploit set .@min, 5; if ( .@amount > .@highest && .@amount > .@min ) { WTF !! no wonder I already sense you are very high level scripter making this scriptpro ! glad to see someone like you in this forum ! thx for finding this bug gives you another rep up @donkeyg none of the above every previous script has flaw and is exploitable that's why we are discussing how to make a flawless event script for you try this candy_event_0.2.txt Edited November 28, 2012 by AnnieRuru Quote
Peopleperson49 Posted November 30, 2012 Posted November 30, 2012 I think I would have just made it say in the rules that incase of a tie the winner would be picked randomly, lol. Good job everybody. Peopleperson49 Quote
AnnieRuru Posted November 30, 2012 Posted November 30, 2012 change if ( .@size ) { for ( .@i = 0; .@i < .@size; .@i++ ) { attachrid getd( ".@count"+ .@highest +"["+ .@i +"]" ); getitem .reward_item_id, .reward_item_amount; .@name$ = .@name$ +( ( .@i )? " , ":"" )+"["+ rid2name( getd( ".@count"+ .@highest +"["+ .@i +"]" ) ) +"]"; } mapannounce "guild_vs2", "event end, there are "+ .@size +" player having most "+ getitemname( .candy_id ) +" ! "+ .@name$, 0; } into if ( .@size ) { .@winner_index = rand(.@size); attachrid getd( ".@count"+ .@highest +"["+ .@winner_index +"]" ); getitem .reward_item_id, .reward_item_amount; mapannounce "guild_vs2", "event end, the winner is ["+ strcharinfo(0) +"] !!";, 0; } Quote
AnnieRuru Posted January 16, 2013 Posted January 16, 2013 update this script candy_event_0.3.txt you can use Whisper to this npc npc:Grab the Candy ! or use OnClockxxxx: ... just uncomment it Quote
donkeyg Posted January 17, 2013 Author Posted January 17, 2013 update this script candy_event_0.3.txt you can use Whisper to this npc npc:Grab the Candy ! or use OnClockxxxx: ... just uncomment it i couldnt click the npc, nothing response after load the npc Quote
Peopleperson49 Posted January 17, 2013 Posted January 17, 2013 (edited) I may have missed something, but why not use bindatcmd instead of OnWhisperGlobal? Something like @grabcandy. Peopleperson49 Edited January 17, 2013 by Peopleperson49 Quote
Capuche Posted January 17, 2013 Posted January 17, 2013 (edited) update this script candy_event_0.3.txt you can use Whisper to this npc npc:Grab the Candy ! or use OnClockxxxx: ... just uncomment it i couldnt click the npc, nothing response after load the npc This uptade works with rAthena only (I guess you have eAthena) and it works perfectly. Edited January 17, 2013 by Capuche Quote
donkeyg Posted January 17, 2013 Author Posted January 17, 2013 lol, im using rathena=.=" 16815 version. and i use @loadnpc to load the npc Quote
Peopleperson49 Posted January 17, 2013 Posted January 17, 2013 I would just leave it loaded all the time and activate and deactivate it with bindatcmd. You can use one command and have it end if your not a gm. When it is used it will start the event if not running and end it if it is running. Very simple scripting! Peopleperson49 Quote
Capuche Posted January 17, 2013 Posted January 17, 2013 lol, im using rathena=.=" 16815 version. and i use @loadnpc to load the npc lol my apologies. Do you have used Whisper to activate the NPC like AnnieRuru said ? you can use Whisper to this npc npc:Grab the Candy ! Quote
AnnieRuru Posted January 17, 2013 Posted January 17, 2013 I've been making event scripts for 4 years, and this whisper system has been stuck into my scripting style =/ bindatcmd might be normal for you guys, but for me who have been scripting for 6 years, I need some time to adjust so here I rewrite again candy_event_0.4.txt activate this event by @candy if you are GM60 or above and damn ... now I got more scripts to update -.-" @Capuche I believe this script only works on recent SVN because I use *cleanmap script command which only added recently http://trac.rathena.org/changeset/16971/rathena Quote
Capuche Posted January 17, 2013 Posted January 17, 2013 @Capuche I believe this script only works on recent SVN because I use *cleanmap script command which only added recently http://trac.rathena....t/16971/rathena I see... I was wrong Quote
Erba Posted April 11, 2013 Posted April 11, 2013 I've been making event scripts for 4 years, and this whisper system has been stuck into my scripting style =/ bindatcmd might be normal for you guys, but for me who have been scripting for 6 years, I need some time to adjust so here I rewrite again candy_event_0.4.txt activate this event by @candy if you are GM60 or above and damn ... now I got more scripts to update -.-" @Capuche I believe this script only works on recent SVN because I use *cleanmap script command which only added recently http://trac.rathena.org/changeset/16971/rathena im using r16797 how can i make it work mam? Quote
Emistry Posted April 11, 2013 Posted April 11, 2013 @2834 update ur svn...or add the cleanmap script command. Quote
Question
donkeyg
warp into a room and in when every one ready spawn a dozen of candy. in 10 second player who grab the most candy is the winner and wil receive Poring Coin
25 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.