random selection

robertwriter
24 May 2011, 12:21
Is there any way possible to make a random selection for the player. Like if the player is taking an item and if i wanted to have 10 preset versions of that item and wanted the program to give the player a random one of those 10 items? Just a thought. I didn't think there was any way to do it that i saw but you are the master.

Pertex
24 May 2011, 14:11
This shouldnt be a problem. You have 11 Items in the game: item is the object the player can see and take. item1 to item10 are not visible for the player. If the player takes item, remove it from his inventory and move one of the other items into the inventory.

robertwriter
24 May 2011, 16:16
Yes I know that would be easy. But, that's not what I need. I need it to be able to select randomly from the other 10 items. I know i could just make the player get a dif item than the name.

Pertex
24 May 2011, 20:50
sorry, I dont understand your problem :(

robertwriter
25 May 2011, 00:07
Don't be sorry for attempting to help. =p

RedTulip
26 May 2011, 04:57
In running a script, you could add a select case with the random number function. After the 'Select Case:' you could type '$rand(1; 10)$' (or click the function button and choose the rand function, from then on, change the lowest and highest number to 1 and 10).

After that, add cases. Click Add, and type on the case '1'. Press Ok. The script editor will pop-up, and from there you could add a message and add another script that gives one of the object's preset to the player. Click Ok.

Add more cases, typing '2', then '3', then '4', and continuing on until you finish the highest number, 10.

I hope that works. ^_^