random loot chest via variables.

I'm having a bad time to figure it out, how can i make a chest give random loot using variables like giving a random item from 5 possible ones or based on his level.
Easy.


You make a chest.


You set a variable named LootType to random between 1 and 5.


You then create a conditional branch for each case


Here is the logic:


If LootType == 1


You give something


End If


If LootType == 2


You give something else


End If


and so on...


Level Based:


You get character level into a variable named CurrentLVL (you can set value using eventing)


Conditional Branch:


Here is the logic


If CurrentLVL >90


Give something awesome


else


If level >80


Give something less awesome


else


If level >70


Give something even less awesome


else


....


and so on....


What you do is checking if it is above 90.


If so you give something fantastic.


If not then you are sure it is less than 91


so it IS from 0 to 90


You check then if it is >80


So between 81 and 90 you give something less awesome.


Or else it is less than 81 now for sure.


So you go now for values between 0 to 80


Is it more than 70? This is the next step.


And so on.


This will end up having a LOT of nested conditional branches, but it will do the job all right.


If you can code in Javascript and know what the MV variable values are, you can script this and it will be way more neat that way.


But it IS possible, just with eventing as you can see.
oh god, thx a lot man

Original thread: https://forums.rpgmakerweb.com/threads/random-loot-chest-via-variables.66608/