Item drop on monster kill

So guys i have this problem. Should i create a list with all items? Its gonna be huge. If i create an array with just the names, i will have problem with the levels. What can i do?

could you please rephrase your question. it's not clear. there is no logic in here...

Ok so when the enemy dies in the game, it must drop a random item based on player's class. So the item will be random, the item grade will be with chances, and the item level must be between monster level - 1 and monster level + 1. How can i do this? :D

Ok, Maybe you can try with a 2 dimensional array: int[,] MyItemArray = new int[2, 3]; with 3 = the number of level you got 2 = the number of items at this level. then you pick a random number between your level - 1 & +1 and a random item number and your item is selected. is it clear ?

Pretty awesome actually, and i will have an extra item array with all the items that are from -1 & +1 level of the monster right?

But this is very hard, i will have to do this with every monster

1 Answer

1

You can put the script on your camera or in an empty gameobject. then you call the function which select the item from a script on you monster :

script on empty GameObject:

int[,] mytab = int[2,3]

public void PopRandomObject(int levelMonster)
{
generate a random number between lvl - 1 & +1;
generate a other one for the seconde dimension;
}

Script on you monter:

find the game object on the one is the first script;
Gameobject.find(“objectname”).getComponent().PopRandomObject(levelofthis monster)

the second script call the function which pop a random object in the first one.