Jump to content
  • 0

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


Question

Posted

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~

Recommended Posts

Posted

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
Posted (edited)

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
Posted (edited)

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
Posted

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

Posted

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.

Posted (edited)

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
Posted

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

Posted

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;

Posted (edited)

@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
Posted

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

Posted

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 =)

Posted

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.

Posted

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;
}

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...