Jump to content
  • 0

nid help on how to make random item


Question

Posted

nid help on how to make random item on this script

prontera,155,181,5 script Freebies 2035,{

if(#dailytimer < gettimetick(2)) {

mes "Here's your prize, you'll get another one after 24 hours.";

getitem 7528,1; //remove <id> and add your own ids for item

set #dailytimer,gettimetick(2) + 86400; //24 hours.

close;

}

end;

}

3 answers to this question

Recommended Posts

Posted

Set an array with the IDs of the items you want and then use rand to generate a number to be used

setarray .@var[0],1234,5678,8901;
getitem .@var[rand(0,3)],1;

Test the second line out. I haven't scripted in a while and not quite sure if rand will work inside.

Posted

Lets say you have a pool of 10 different items which means 10 items = 10% chance for each one to appear. If you want to say increase item 1234's chances, you just have to use 2 of those 10 slots so now items 1234 has 20% of appearing compared to the rest. I haven't done a random item drawing with different chances for each item, so I'm not exactly sure how to do it either besides what I just mentioned.

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