Author Topic: question about random items  (Read 318 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
question about random items
« on: July 25, 2015, 01:58:42 am »


               

Just a quick question is it possable to take a random item from a PC?



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
question about random items
« Reply #1 on: July 25, 2015, 02:18:02 am »


               


Just a quick question is it possable to take a random item from a PC?




loop all items in inventory, increase integer variable counter by 1 for each found item


then get random inte from count and start loop over this time decrease the counter by 1 for each item found till the counter will be 0 in which case you break the loop and oItem will be random item.


 


Just be cautious for undroppable items with this...