Jump to content
  • 0

scroll that gives 10 random items


Natsu Dragneel

Question


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  138
  • Reputation:   1
  • Joined:  12/27/11
  • Last Seen:  

I saw itemdb script for this but I can't find it. I want to make scroll like obb but it gives only 10 items with chances to get it. For example my prices are kiel card, hankie, teardrop, tao card, and so on. the chances are 10% for kiel and tao and the other is 90%.

Thank you in advance!

Link to comment
Share on other sites

21 answers to this question

Recommended Posts

  • -1

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

..........{    SCRIPTS  },{},{}

  • 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:  

if (rand(100) < 10) setarray .@i[0],4403,4302; // 10% chance
else setarray .@i[0],512,...; // 90% chance
getitem .@i[rand(getarraysize(.@i))],1;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  06/21/12
  • Last Seen:  

can i have the actual script for the scroll and script?

Link to comment
Share on other sites


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

can i have the actual script for the scroll and script?

have you read post#2 ??

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  138
  • Reputation:   1
  • Joined:  12/27/11
  • Last Seen:  

can you please give me an example of that script.

for example this is my item

200000,rainbow scroll,rainbow scroll???

I don't know what's next. hehe

Link to comment
Share on other sites


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

just put the same thing posted by Euphy...but in 1 LINE

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  138
  • Reputation:   1
  • Joined:  12/27/11
  • Last Seen:  

200000,rainbow scroll,rainbow scroll,if (rand(100) < 10) setarray .@i[0],4403,4302; // 10% chance else setarray .@i[0],512,...; // 90% chance getitem .@i[rand(getarraysize(.@i))],1;

like this?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  73
  • Reputation:   2
  • Joined:  12/19/11
  • Last Seen:  

thanks for the script Euphy. can this have an announce script when u got items with 10% chance?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Natsu if you put // inside of a line it ignores the rest of the line so this entry wouldn't work:

200000,rainbow scroll,rainbow scroll,if (rand(100) < 10) setarray .@i[0],4403,4302; // 10% chance else setarray .@i[0],512,...; // 90% chance getitem .@i[rand(getarraysize(.@i))],1;

Here you go Natsu. I think this format will be easier for you since you don't seem very familiar with it yet. This is set up for you to give a way 10 items in each catigory. If you get the 10% it will also announce the item obtained. Just change each ITEM# to the itemID that you wish and remove any ITEM#s after that you didn't use. At the end of each set of ITEM#s theres is a .@RainbowArray[rand(1,10)]. Change to rand(1,10) sections to however many items you have in that array. Let me know if you need anymore assistance.

Peopleperson49

ItemDB2:
200000,Rainbow Scroll,Rainbow Scroll,{ if(rand(100)<10) { setarray .@RainbowArray[1],ITEM1,ITEM2,ITEM3,ITEM4,ITEM5,ITEM6,ITEM7,ITEM8,ITEM9,ITEM10; set RainbowItem,.@RainbowArray[rand(1,10)]; announce ""+strcharinfo(0)+" has won "+getitemname(RainbowItem)+" from a Rainbow Scroll.",bc_all; } else { setarray .@RainbowArray[1],ITEM1,ITEM2,ITEM3,ITEM4,ITEM5,ITEM6,ITEM7,ITEM8,ITEM9,ITEM10; set RainbowItem,.@RainbowArray[rand(1,10)]; } getitem RainbowItem,1; },{},{}

Edited by peopleperson49
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  73
  • Reputation:   2
  • Joined:  12/19/11
  • Last Seen:  

wow. that's what i'm talking about paopleperson49. thanks for this script.

i have a request. can you make this npc script announce when the player gets an item that has 10% chance of gaining it?

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

zXoOm I'm going to give you the best help I can ever give you! And that is to look it up in the doc/script_commands.txt. Doing that is very easy for me, and once you learn it will be very easy for you! From there I will help you all I can with it.

Peopleperson49

Announce Command:

*announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
This command will broadcast a message to all or most players, similar to
@kami/@kamib GM commands.
   announce "This will be shown to everyone at all in yellow.",0;
The region the broadcast is heard in (target), source of the broadcast
and the color the message will come up as is determined by the flags.
The flag values are coded as constants in db/const.txt to make them easier to use.
Target flags:
- bc_all: Broadcast message is sent server-wide (default).
- bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
- bc_area: Message is sent to players in the vicinity of the source.
- bc_self: Message is sent only to current player.
You cannot use more than one target flag.
Source flags:
- bc_pc: Broadcast source is the attached player (default).
- bc_npc: Broadcast source is the NPC, not the player attached to the script
 (useful when a player is not attached or the message should be sent to those
 nearby the NPC).
You cannot use more than one source flag.
Special flags:
- bc_yellow: Broadcast will be displayed in yellow color (default).
- bc_blue: Broadcast will be displayed in blue color.
- bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
If any of the optional parameters is used, special flag is ignored.
Optional parameters may not work well (or at all) depending on a game client used.
The color parameter is a single number which can be in hexadecimal notation.
For example:
   announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
Will display a global announce in green. The color format is in RGB (0xRRGGBB).
In official scripts only two font-weights (types) are used:
- normal (FW_NORMAL = 400, default),
- bold (FW_BOLD = 700).
Default font size is 12.
Using this for private messages to players is probably not that good an idea,
but it can be used instead in NPCs to "preview" an announce.
   // This will be a private message to the player using the NPC that made the
   // announcement
   announce "This is my message just for you",bc_blue|bc_self;
   // This will be shown on everyones screen that is in sight of the NPC.
   announce "This is my message just for you people here",bc_npc|bc_area;

Use rand to easiy calculate a percent. For example if(rand(1,100)<=10) it would be a 10%.

*rand(<number>{,<number>});
This function returns a number ...
(if you specify one) ... randomly positioned between 0 and the number you specify -1.
(if you specify two) ... randomly positioned between the two numbers you specify.
rand(10)  would result in 0,1,2,3,4,5,6,7,8 or 9
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(2,5) would result in 2,3,4 or 5

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  138
  • Reputation:   1
  • Joined:  12/27/11
  • Last Seen:  

is this 10% chance

if(rand(100)<10)
and this is 1% chance [rand(1,10)]?
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

Yes that is true, but don't mess yourself up with the rand numbers. If you just use rand(100) it is not 1 to 100. Its actually 0 to 99. It is a common misconception I see people make (see below). For your second question if you use rand(1,10) it is still a 10% chance because 1 is 10% of 10. You still have to make it something like if(rand(1,10)==1). So seem less confusing to me to just use if(rand(1,100)<=10). I hope this teaches you something, feel free to ask if you need more information.

Peopleperson49

*rand(<number>{,<number>}); 
This function returns a number ... 
(if you specify one) ... randomly positioned between 0 and the number you specify -1. 
(if you specify two) ... randomly positioned between the two numbers you specify. 
rand(10)  would result in 0,1,2,3,4,5,6,7,8 or 9 
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9 
rand(2,5) would result in 2,3,4 or 5

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  138
  • Reputation:   1
  • Joined:  12/27/11
  • Last Seen:  

this is now the scroll

210mzxz.jpg

and I found out that there is announcement when you get the lowest chance.

Is it possible to make the grand prize just 1% chance of getting it and 1 item only? As I read your explanation 1 is equal to 10%.

Edited by Natsu Dragneel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

If you remember before I said it was easier to use rand(1,100) instead of rand(1,10). That is because if you want a 1% chance then all you do is make it if(rand(1,100)==1). To get the 10% as I stated earlier it was 1 of 10 which equal 10%. If you use 1 of 100 it equals 1%.

Peopleperson49

Edited by peopleperson49
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  218
  • Topics Per Day:  0.05
  • Content Count:  1180
  • Reputation:   141
  • Joined:  01/27/12
  • Last Seen:  

I hope that I helped you out some Natsu. If you have any more questions feel free to ask. Have a nice day.

Peopleperson49

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  138
  • Reputation:   1
  • Joined:  12/27/11
  • Last Seen:  

I hope that I helped you out some Natsu. If you have any more questions feel free to ask. Have a nice day.

Peopleperson49

aye aye sir!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  06/21/12
  • Last Seen:  

Posted · Hidden by Emistry, October 15, 2012 - Wrong Place + Non Topic Related...
Hidden by Emistry, October 15, 2012 - Wrong Place + Non Topic Related...

How about 10% chance to @storeall an enemy when receiving: All kinds of attack?

Link to comment

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  54
  • Reputation:   1
  • Joined:  02/21/12
  • Last Seen:  

how if only angeling card i want to broadcast if they get angeling card on random items :D how i will script it

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:  

lol ... feels like this topic discussion like a script support ....

anyways

xxxxx, ........, { doevent "asdf::Onasdf"; }, {},{}

-    script    asdf    -1,{
Onasdf:
   set .@itemid, callfunc( "F_RandMes", 5,
       501, 502, 503, 504, 505 );
   getitem .@itemid, 1;
   if ( .@itemid == 501 )
       announce strcharinfo(0) +" just got "+ getitemname( .@itemid ), 0;
   end;
}

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