How do I make a chest?

I’m trying to make a chest where it will drop random items of my choice when you press E at a certain radius. I have never used Modd.io before.

1 Like

First, to make the item type group containing the items that you want:
Go in Environment > Global Variables and create a new variable. Set the data type to item type group and add the item types that you want the chest to be able to drop. Additionally, if you want to make one of the items in the group relatively rarer to get, click on it and make its probability lower.

Next, go in the scripts of your player unit and make this script:

Finally, edit the controls of your player unit and add a keybind. Set the key to E and set the script to interact with chest. If the E key is already used by a different ability then you may need to change the key for one of the abilities.

create unit called chest,
make a script called unit death,
when attribute down to 0 trigger
if trigging attribute == health
(go in environnement for variable)
variable random number set to random number between 1-3
random nuber = 1 then do give sword
or random number = 2 then give bow
or random number 3 = then give nothing