Jump to content
  • 0

nid help on how to make random item


bose

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  03/22/12
  • Last Seen:  

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;

}

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  03/22/12
  • Last Seen:  

how can i set the chance for every item?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

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.

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