Random drop

Place to get help with not working mods / modding interface.
Post Reply
SPolygon
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Jan 02, 2016 8:22 pm
Contact:

Random drop

Post by SPolygon »

Is there a way to make some entity (for example tree) drop random items from predefined selection? Like, idk, random amount of wood, leaves etc.
I mean, if you destroy that tree, there is like 50% chance that it will drop some special item.

Natha
Fast Inserter
Fast Inserter
Posts: 178
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: Random drop

Post by Natha »

You can declare a on_preplayer_mined_item event and give the player a random amount of items

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Random drop

Post by Rseding91 »

SPolygon wrote:Is there a way to make some entity (for example tree) drop random items from predefined selection? Like, idk, random amount of wood, leaves etc.
I mean, if you destroy that tree, there is like 50% chance that it will drop some special item.
Yes, you can define the "loot" as a percent chance to drop for any entity. You can also define the mining results as a percent chance to give any item.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”