Jump to content
  • 0

adding announcement and ladder to TCG Drainer


uDe

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Interesting request and thanks to @Euphy for the script .

But I need some help..

No errors on map-server.. But the announcer is wrong.. I need the script announce any items below 50% chance..

   set .@i, rand(1,.Total);
   if (rand(1,100) > getd(".P"+.@i+"[0]")) {
     for(set .@j,0; .@j<getarraysize(.Default); set .@j,.@j+2) {
      getitem .Default[.@j], .Default[.@j+1];
      if (!.@k[0]) setarray .@k[0], .Default[.@j], .Default[.@j+1]; } }
   else {
     for(set .@j,1; .@j<getarraysize(getd(".P"+.@i)); set .@j,.@j+2) {
      getitem getd(".P"+.@i+"["+.@j+"]"), getd(".P"+.@i+"["+(.@j+1)+"]");
      if (!.@k[0]) setarray .@k[0], getd(".P"+.@i+"["+.@j+"]"), getd(".P"+.@i+"["+(.@j+1)+"]"); } }
          if (getd(".P"+.@i+"[0]")<=50 && .@k[0]!=.Default[0]) announce "Congratulations to "+strcharinfo(0)+" for getting "+.@k[1]+"x "+getitemname(.@k[0])+"!",0;

Cgqot.png

and @Euphy, can you add 1 more function for viewing who did got items below 10%? Something like PVP Ladder maybe?

Let say the list will show 20 players who did get the items on what day and time and the list will automatically update from time to time. So, it will overwrite previous winner.. (I hope you understand my cheap explanations)


original topic

Edited by AnnieRuru
split topic from http://rathena.org/board/topic/65196-tcg-drainer-very-useful-to-most-of-the-servers-just-like-lotti-girl-in-pro/
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

prontera,155,181,5    script    Lotti Girl    100,{
   mes "[Lotti Girl]";
   mes "It costs "+ .cost[1] +"x "+ getitemname( .cost[0] ) +" to play.";
   mes " ";
   for ( .@i = 0; .@i < 20; .@i++ )
       mes $lotti_girl_ladder$[.@i];
   if ( countitem( .cost[0] ) < .cost[1] ) close;
   next;
   if ( select( "Deal me in!", "No way..." ) == 2 ) close;
   mes "[Lotti Girl]";
   while (1) {
       mes "Here we go...";
       delitem .cost[0], .cost[1];
       .@rand = rand(.totalchance);
       .@r = 0; // <-- think you forgot to put this
       while ( ( .@rand = .@rand - getd( ".p"+ .@r +"[0]" ) ) >= 0 ) .@r++;
       .@size = getarraysize( getd(".p"+ .@r ) );
       for ( .@i = 1; .@i < .@size; .@i += 2 )
           getitem getd( ".p"+ .@r +"["+ .@i +"]" ), getd( ".p"+ .@r +"["+( .@i +1 )+"]" );
       if ( getd( ".p"+ .@r +"[0]" ) < 50 ) // announce if below 50% chance
           announce "Congratulations to "+strcharinfo(0)+" for getting "+ .ann$[.@r] +"!", 0;
       if ( getd( ".p"+ .@r +"[0]" ) < 10 ) { // score the ladder if below 10% chance
           copyarray $lotti_girl_ladder$[1], $lotti_girl_ladder$[0], 19;
           $lotti_girl_ladder$ = strcharinfo(0) +" gains "+ .ann$[.@r] +" at "+ gettimestr( "%d/%m/%Y %H:%M %p", 21 );
       }
       mes " ";
       mes "wanna try again ?";
       next;
       if ( select( "Yes", "No" ) == 2 ) close;
       mes "[Lotti Girl]";
       if ( countitem( .cost[0] ) < .cost[1] ) {
           mes "it seems you have ran out of "+ getitemname( .cost[0] );
           close;
       }
   }
   close;
OnInit:
//    setarray .p1, 70, 501,25; // debugging ...
//    setarray .p2, 70, 502,1;
//    setarray .p3, 40, 503,1;
//    setarray .p4, 40, 504,1;
//    setarray .p5, 40, 505,1;
//    setarray .p6, 50, 506,1, 507,1, 508,1, 509,1;
//    setarray .p7, 25, 512,1;
//    setarray .p8, 5, 513,1;

   setarray .p1, 70, 607,25;
   setarray .p2, 70, 13710,1;
   setarray .p3, 40, 5471,1;
   setarray .p4, 40, 5210,1;
   setarray .p5, 40, 5224,1;
   setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;
   setarray .p7, 25, 2701,1;
   setarray .p8, 5, 2394,1;
   setarray .p9, 30+30+60+60+60+50+75+95, 12214,1; // default ... the chance are added up by 100-n%
   setarray .cost, 7227,300;
   .total = 9;

   freeloop 1;
   .@i = 1;
   while ( .@i <= .total ) {
       .totalchance = .totalchance + getd(".p"+ .@i );
       .@j = 1;
       .@size = getarraysize( getd(".p"+ .@i ) );
       while ( .@j < .@size ) {
           .ann$[.@i] = .ann$[.@i] + getd( ".p"+ .@i +"["+( .@j +1 )+"]" ) +"x "+ getitemname( getd( ".p"+ .@i +"["+ .@j +"]" ) ) +( ( .@j == .@size -2 )? "":"," ); // I think Euphy forgotten to make announcement when configuration has set more than 1 items
           .@j += 2;
       }
       .@i++;
   }
   freeloop 0;
}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  737
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

@AnnieRuru can you Add more ideas and Option Menu?

switch(select("Play","Lotti Ranking","Lotti Shop"))
  • Play Option 

Every Play of Lotti Girl you gain 1 Lotti Ladder Point and Lotti Shop Point 

  • Points System
10% = 10Points Lotti Ladder Points & Lotti Shop Points
9% = 20Points Lotti Ladder Points & Lotti Shop Points
8% = 30Points Lotti Ladder Points & Lotti Shop Points
7% = 40Points Lotti Ladder Points & Lotti Shop Points
6% = 50Points Lotti Ladder Points & Lotti Shop Points
5% = 60Points Lotti Ladder Points & Lotti Shop Points
4% = 70Points Lotti Ladder Points & Lotti Shop Points
3% = 80Points Lotti Ladder Points & Lotti Shop Points
2% = 90Points Lotti Ladder Points & Lotti Shop Points
1% = 100Points Lotti Ladder Points & Lotti Shop Points
  • Lotti Ladder System

1 > Name > Lotti Ladder Points

2 > Name > Lotti Ladder Points

3 > Name > Lotti Ladder Points

4 > Name > Lotti Ladder Points

5  > Name > Lotti Ladder Points

  • Lotti Shop

Players can  use there Lotti Shop Points to buy any items on Lotti Shop

Edited by Bringer
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

like I said before ... adding custom features to existing scripts means = open a new topic

because in request section, the request to based on 1st post ...

hmm ....

update that script ...

prontera,158,183,5	script	dusifjdfkjq	100,{
.@rand = rand(.totalchance);
while ( ( .@rand = .@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;
.itemsize = getarraysize(.itemid);
while ( .@i < .itemsize ) {
	.totalchance = .totalchance + .itemchance[.@i];
	.@i++;
}
end;
}

I use different formula than Euphy ...

I dislike to make too much calculation when its possible to set everything on server startup

prontera,155,181,5    script    Lotti Girl    100,{
   mes "[Lotti Girl]";
   mes "It costs "+ .cost[1] +"x "+getitemname( .cost[0] )+" to play.";
   mes " ";
   for ( .@i = 0; .@i < 20; .@i++ )
       mes $lotti_girl_ladder$[.@i];
   if ( countitem( .cost[0] ) < .cost[1] ) close;
   next;
   if ( select( "Deal me in!", "No way..." ) == 2 ) close;
   mes "[Lotti Girl]";
   mes "Here we go...";
   progressbar "", 2;
   delitem .cost[0], .cost[1];
   .@rand = rand(.totalchance);
   while ( ( .@rand = .@rand - getd( ".p"+ .@r +"[0]" ) ) >= 0 ) .@r++;
   .@size = getarraysize( getd(".p"+ .@r ) );
   for ( .@i = 1; .@i < .@size; .@i += 2 )
       getitem getd( ".p"+ .@r +"["+ .@i +"]" ), getd( ".p"+ .@r +"["+( .@i +1 )+"]" );
   if ( getd( ".p"+ .@r +"[0]" ) < 50 ) // announce if below 50% chance
       announce "Congratulations to "+strcharinfo(0)+" for getting "+ .ann$[.@r] +"!", 0;
   if ( getd( ".p"+ .@r +"[0]" ) < 10 ) { // score the ladder if below 10% chance
       copyarray $lotti_girl_ladder$[1], $lotti_girl_ladder$[0], 19;
       $lotti_girl_ladder$ = strcharinfo(0) +" gains "+ .ann$[.@r] +" at "+ gettimestr( "%d/%m/%Y %H:%M %p", 21 );
   }
   close;
OnInit:
//    setarray .p1, 70, 501,25; // debugging ...
//    setarray .p2, 70, 502,1;
//    setarray .p3, 40, 503,1;
//    setarray .p4, 40, 504,1;
//    setarray .p5, 40, 505,1;
//    setarray .p6, 50, 506,1, 507,1, 508,1, 509,1;
//    setarray .p7, 25, 512,1;
//    setarray .p8, 5, 513,1;

   setarray .p1, 70, 607,25;
   setarray .p2, 70, 13710,1;
   setarray .p3, 40, 5471,1;
   setarray .p4, 40, 5210,1;
   setarray .p5, 40, 5224,1;
   setarray .p6, 50, 2357,1, 2524,1, 2421,1, 2115,1;
   setarray .p7, 25, 2701,1;
   setarray .p8, 5, 2394,1;
   setarray .p9, 30+30+60+60+60+50+75+95, 12214,1; // default ... the chance are added up by 100-n%
   setarray .cost, 7227,300;
   .total = 9;

   freeloop 1;
   .@i = 1;
   while ( .@i <= .total ) {
       .totalchance = .totalchance + getd(".p"+ .@i );
       .@j = 1;
       .@size = getarraysize( getd(".p"+ .@i ) );
       while ( .@j < .@size ) {
           .ann$[.@i] = .ann$[.@i] + getd( ".p"+ .@i +"["+( .@j +1 )+"]" ) +"x "+ getitemname( getd( ".p"+ .@i +"["+ .@j +"]" ) ) +( ( .@j == .@size -2 )? "":"," ); // I think Euphy forgotten to make announcement when configuration has set more than 1 items
           .@j += 2;
       }
       .@i++;
   }
   freeloop 0;
}

EDITING ... wait a moment .. I think this script is bugged...

ok fixed

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

like I said before ... adding custom features to existing scripts means = open a new topic

because in request section, the request to based on 1st post ...

I'm so sorry for that.. /ok

Thanks for helping @AnnieRuru..

I've edit my script according to yours..

I think 1 problem here if I'm trying to adding repeat function (so players don't need to click the npc again and again).

when I use


do{

}while( select("Yeah! Play again!!:Nevermind, I need more Poring Coin. T_T") == 1 );

An error shows on map-server.

run_script: infinity loop !
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Thanks @AnnieRuru /ok

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

prontera,139,229,5 script Lotti Girl 864,{
mes "[Lotti Girl]";
mes "It costs "+ .cost[1] +"x "+ getitemname( .cost[0] ) +" to play.";
mes " ";
for ( .@i = 0; .@i < 20; .@i++ )
mes $lotti_girl_ladder$[.@i];
if ( countitem( .cost[0] ) < .cost[1] ) close;
next;
if ( select( "Deal me in!", "No way..." ) == 2 ) close;
mes "[Lotti Girl]";
while (1) {
mes "Here we go...";
delitem .cost[0], .cost[1];
.@rand = rand(.totalchance);
.@r = 0; // <-- think you forgot to put this
while ( ( .@rand = .@rand - getd( ".p"+ .@r +"[0]" ) ) >= 0 ) .@r++;
.@size = getarraysize( getd(".p"+ .@r ) );
for ( .@i = 1; .@i < .@size; .@i += 2 )
getitem getd( ".p"+ .@r +"["+ .@i +"]" ), getd( ".p"+ .@r +"["+( .@i +1 )+"]" );
if ( getd( ".p"+ .@r +"[0]" ) < 50 ) // announce if below 50% chance
announce "Congratulations to "+strcharinfo(0)+" for getting "+ .ann$[.@r] +"!", 0;
if ( getd( ".p"+ .@r +"[0]" ) < 10 ) { // score the ladder if below 10% chance
copyarray $lotti_girl_ladder$[1], $lotti_girl_ladder$[0], 19;
$lotti_girl_ladder$ = strcharinfo(0) +" gains "+ .ann$[.@r] +" at "+ gettimestr( "%d/%m/%Y %H:%M %p", 21 );
}
mes " ";
mes "wanna try again ?";
next;
if ( select( "Yes", "No" ) == 2 ) close;
mes "[Lotti Girl]";
if ( countitem( .cost[0] ) < .cost[1] ) {
mes "it seems you have ran out of "+ getitemname( .cost[0] );
close;
}
}
close;
OnInit:
// setarray .p1, 70, 501,25; // debugging ...
// setarray .p2, 70, 502,1;
// setarray .p3, 40, 503,1;
// setarray .p4, 40, 504,1;
// setarray .p5, 40, 505,1;
// setarray .p6, 50, 506,1, 507,1, 508,1, 509,1;
// setarray .p7, 25, 512,1;
// setarray .p8, 5, 513,1;

setarray .p1, 70, 14232,1;
setarray .p2, 10, 2115,1;
setarray .p3, 50, 13582,1;
setarray .p4, 40, 5210,1;
setarray .p5, 10, 2421,1;
setarray .p6, 5, 2524,1;
setarray .p7, 5, 2357,1;
setarray .p8, 5, 2729,1;
setarray .p9, 30+30+60+60+60+50+75+95, 7040,1; // default ... the chance are added up by 100-n%
setarray .cost, 7227,1;
.total = 9;

freeloop 1;
.@i = 1;
while ( .@i <= .total ) {
.totalchance = .totalchance + getd(".p"+ .@i );
.@j = 1;
.@size = getarraysize( getd(".p"+ .@i ) );
while ( .@j < .@size ) {
.ann$[.@i] = .ann$[.@i] + getd( ".p"+ .@i +"["+( .@j +1 )+"]" ) +"x "+ getitemname( getd( ".p"+ .@i +"["+ .@j +"]" ) ) +( ( .@j == .@size -2 )? "":"," ); // I think Euphy forgotten to make announcement when configuration has set more than 1 items
.@j += 2;
}
.@i++;
}
freeloop 0;
}

Can this script can be use in eathena version?

lottiNPC.txt

lottiNPC.txt

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents. Removed Duplicated Contents.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Nope, eAthena doesn't have the freeloop command for example.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  01/25/13
  • Last Seen:  

so i cannot run it on eathena server?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...