[Tutoriel] random box

09/20/2018 17:26 redbull2905#1
Hi, I open this topic for you to share a tutorial on a comment creates a random box.

to start you have to choose the case you want ending with a break.

example:

[Only registered and activated users can see links. Click Here To Register...]

Once this is done, you must mark the code. You have several ways of doing thingsbut I'm going to show you my way.

[Only registered and activated users can see links. Click Here To Register...]

Here is for example my whole code for the boxes of the raid caligor.

as soon as you put your code, you will have to go to your database, in item
you go to the item you have chosen. and you put the number of the box you have chosen in effect so 7000 and the same in effect value
09/21/2018 02:42 Tbp123#2
or better use RollGeneratedItem with some changes instead?...
09/21/2018 15:26 PepBDev#3
First of all, don't hardcode the random item because if you add a new item you will need to change the random function because it's not going to be 13 items so at least use:
Random rnd = new Random();

short[] itemArray = { 1, 2, 3, 4 };
short item = itemArray[rnd.Next(itemArray.Count())];

short[] amountArray = { 10, 20, 30};
short amount = amountArray[rnd.Next(amountArray.Count())];

// Code to add item, amount to player