Jump to content
  • 0

TCG Drainer - Very useful to most of the servers (just like Lotti Girl in pRO)


Dvrstle

Question


  • Group:  Members
  • Topic Count:  125
  • Topics Per Day:  0.03
  • Content Count:  361
  • Reputation:   10
  • Joined:  12/30/11
  • Last Seen:  

I want to request an npc that is almost the same with the Lotti Girl in Philippine Ragnarok Online.

In pRO, this Lotti Girl gives item randomly with the use of a ticket.

So this what I want,

My Tcg drainer npc goes like this, this needs 300 TCG to play the game. . .

The player will choose if he wants to Draw a prize.. . and then a random item will be given...

There's more, the prizes should be based on % chance . . . .

Here's the prizes

**This item will be get by the player if non of the items below was taken.

1 Convex Mirror

**Here are the items which the player can get randomly [With Chances]

25 Yggdrasil Berries - 70%

Gym Pass Box [10pcs of Gym pass] - 70%

Hairband of Reginleif - 40%

Flying Angel Wing - 40%

Evolved Orc Hero Helm - 40%

[Vset] with out the helm - 50%

Orleans Glove - 25%

Glorious Suit - 5%

** If the player got any one of these items which has % chance. . . they will not get the convex mirror. . . in short. . . convex mirror is just a replacement for not getting any rare items. . and another one, there will be a broadcast on the whole server which says that "Congratulations to [Name of the Char] for getting [Name of the item] !!"

I hope that there's a professional scripter here that can make this kind of NPC. . . . and i know that many server will benefit from this because this is also a way of controlling the economy of the server by reducing the items which they use as the medium of exchange. . . Thanks a lot!!

please help me =)

bump~

Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Well, since you didn't supply proper percentages, still, here's the best I could do:

<header> {
mes "[Lotti Girl]";
mes "It costs "+.Cost[1]+"x "+getitemname(.Cost[0])+" to play.";
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];
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)+"]"); } }
announce "Congratulations to "+strcharinfo(0)+" for getting "+.@k[1]+"x "+getitemname(.@k[0])+"!",0;
specialeffect2 248;
close;

OnInit:
// Format: <%>,<item ID>,<count>{,...};
setarray .P1[0],70,607,25;
setarray .P2[0],70,13710,1;
setarray .P3[0],40,5471,1;
setarray .P4[0],40,5210,1;
setarray .P5[0],40,5224,1;
setarray .P6[0],50,2357,1,2524,1,2421,1,2115,1;
setarray .P7[0],25,2701,1;
setarray .P8[0],5,2394,1;
setarray .Default[0],12214,1;
setarray .Cost[0],7227,300;
set .Total,8;
end;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

I'm pretty sure no one's writing this because your percentages don't add up to 100. o.o; (And while you're at it, include the item IDs!)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

I need this too. Prolly somebody could make it like

setarray .itemID[1],607,677,676,7711; //random item prizes
setarray .itemRates[1],80,80,10,1; //  1000 = 100% or something.. dunno lol

I really have no idea about how array works.

Edited by RaGERO
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

@RaGERO: It's a very simple script, but percentages would really only work if they added to 100... o.o;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

What if you just sell a custom obb box - containing of different type of items, it's easy -

- put the ID in the obb box custom -

putting the percentage

- then sell it on TCG -

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

maybe get the array value and then divide it by 100?

@GM Taku, it kills the point of gambling to an NPC, also with an NPC it's possible to make it announce like

'RaGERO got an apple from Lotti Gurl with a 20% chance'

OPB doesn't have it.

Edited by RaGERO
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  592
  • Reputation:   31
  • Joined:  11/14/11
  • Last Seen:  

do you know this fishing script?

http://rathena.org/board/topic/53647-fishing-script/

you can modify it -

- removing the needs of items

- or you can change the requirement items to gambling hat..

- changing the npc appearance

- changing the dialogs

- and viola a gambling npc

i can't modify it now im not in my house but you can use it..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

^ It has the same rate for all items. We would like it be able to configure the rates through an array of item ids and array of rates instead of modifying the whole NPC or several lines of the NPC.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  29
  • Topics Per Day:  0.01
  • Content Count:  566
  • Reputation:   34
  • Joined:  11/17/11
  • Last Seen:  

Hey bro, If I were you, just use an Egg like in PRO (Philippine Ragnarok Online) that cost TCG Ticket and if your player open it, it will get the item random on your list. Like on Old Purple Box.

Make sure to lower the percentage of RARES to convince them to play it again and again.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  341
  • Reputation:   43
  • Joined:  01/10/12
  • Last Seen:  

I'm pretty sure no one's writing this because your percentages don't add up to 100. o.o; (And while you're at it, include the item IDs!)

I guess something like this will work.

Actually, I thought of rates/total_rates*100 to get the percentage, but the emulator failed to calculate decimals. I know there are other ways to get the decimals, but will not be as efficient as the below one? O_O

setarray .@array, <item_id>,<rates>{...};
for ( set .@i, 0; .@i < getarraysize(.@array); set .@i, .@i + 2 )
.@t, .@t + .@array[.@i+1];
if ( .@t <= 0 || .@t >= 2147483647 ) // I think you won't go that high...
{
debugmes "O_O You really go that high...";
end;
}
set .@rnd, rand(1,.@t);
for ( set .@i, 0; .@i < getarraysize(.@array); set .@i, .@i + 2 )
{
.@sr, .@sr + .@array[.@i+1];
if ( .@sr >= .@rnd ) { //GetItem }
}

Edited by Joseph
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  125
  • Topics Per Day:  0.03
  • Content Count:  361
  • Reputation:   10
  • Joined:  12/30/11
  • Last Seen:  

i intended to do that thing. .. using an Egg item that will give you a random item . . . its quite easier . . . hmm . . . . but what i want is that ... i want to see them playing with the NPC. . . so that it will be more formal and looks good for my server =) . . . and for the other servers as well

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

you can just create a new item group that generate items randomly with different rate .. that work just like Old Blue Box / Old Violet Box / Cash Egg..

*groupranditem <group id>;

Returns the item_id of a random item picked from the group specified. The
different groups and their group number are specified in db/item_group_db.txt
When used in conjunction with other functions, you can get a random item. For
example, for a random pet lure:

to use it in npc...just add this

getitem groupranditem(<ItemGroupID>),1;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

@Euphy, tried the script, It's working. Can it be modified just announce the item that has lower than 10% chance?

I don't know if this was intended

I'm getting all items in this array

setarray .P6[0],50,2357,1,2524,1,2421,1,2115,1;

hrHUC.png

Edited by RaGERO
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

if (getd(".P"+.@i+"[0]")<=10 && .@k[0]!=.Default[0]) announce // ...

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

Thanks, it works.

Can I add more arrays like .P9[0], .P10[0] .....?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Yup, that's why I wrote the script with that format! Remember to change "Total" at the end to the total number of arrays, though. And about the problem with the VSets, yeah, I don't really know what you wanted to display there...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

Thanks. Works just the way I want it. Hope the Thread Starter would find it useful too :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  125
  • Topics Per Day:  0.03
  • Content Count:  361
  • Reputation:   10
  • Joined:  12/30/11
  • Last Seen:  

Tnx Euphy!! . . gonna try it. . . =)

sir euphy. . . i just got stocked when i did not got any item . . . xD i can use emotions that proves that im not lag. . .

here it is

screen_Blitz_RO152.jpg

just stocked with this. . . . randomly

Need reply sir =)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

You should always receive some reward, unless you configured something wrong. You can try deleting this line:

progressbar "",2;

But it's almost certainly a config problem.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  125
  • Topics Per Day:  0.03
  • Content Count:  361
  • Reputation:   10
  • Joined:  12/30/11
  • Last Seen:  

but sir Euphy, what i did is just inputting the header of the npc.. . . =) . . . hmmm . . .

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Dunno, it worked for me. Any mapserver errors?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  125
  • Topics Per Day:  0.03
  • Content Count:  361
  • Reputation:   10
  • Joined:  12/30/11
  • Last Seen:  

hmm got no map server error. . . xD. . . hmm . . . check again the script . . . please check if there are some things that i accidentally edited.

prontera,189,181,4 script Lotti Girl 123,{
mes "[Lotti Girl]";
mes "It costs "+.Cost[1]+"x "+getitemname(.Cost[0])+" to play.";
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];
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)+"]"); } }
announce "Congratulations to "+strcharinfo(0)+" for getting "+.@k[1]+"x "+getitemname(.@k[0])+"!",0;
specialeffect2 248;
close;
OnInit:
// Format: <%>,<item ID>,<count>{,...};
setarray .P1[0],70,607,25;
setarray .P2[0],70,13710,1;
setarray .P3[0],40,5471,1;
setarray .P4[0],40,5210,1;
setarray .P5[0],40,5224,1;
setarray .P6[0],50,2357,1,2524,1,2421,1,2115,1;
setarray .P7[0],25,2701,1;
setarray .P8[0],5,2394,1;
setarray .Default[0],12214,1;
setarray .Cost[0],7227,300;
set .Total,8;
end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  06/15/12
  • Last Seen:  

how to change the announcement, that announce only when you get the rare one?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

@manuel02xx: See post #15. Change the "10" to any percentage.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   0
  • Joined:  06/15/12
  • Last Seen:  

thx.. Euphy this script is great

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