• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Drop probability from entities while harvesting

Iceburg71

New member
Is it possible to use probability when harvesting an animal to get or not get an item from it?  or is there a way to specify a range say from 0 to 5 to get an item from harvesting an animal? or a combination of both? been struggling with this and I am either being an idiot because I have not worked on modding in a while, or it can't be done, or I just don't know how to do it.

Thanks for any help.

 
Not sure what you tried so far, but have you added a new line to the animal and added probability to it?

For example,

<entity_class name="animalStag" extends="animalTemplateTimid">

.........
    <drop event="Harvest" name="foodRawMeat" tag="butcherHarvest" count="30"/> <!-- animalStag -->

    <drop event="Harvest" name="foodRawMeat" tag="butcherHarvest" prob="0.5" count="5"/>






Not sure if this would work, never tried it myself

 
hmmm..   Haven't tried it like that yet.  I will have to give something like that a go.  I really want to do something like this as well for some animals to try and get a little more variety in what you get from some of them...  this would give you anywhere from 0 to 10 meat.  this is just an example...

Code:
[COLOR=#e8bd89]<drop[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]event[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"Harvest"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]name[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"foodRawMeat"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]tag[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"butcherHarvest"[/COLOR][COLOR=#ebe7e3] [/COLOR][COLOR=#df897a]count[/COLOR][COLOR=#d9b180]=[/COLOR][COLOR=#7ea9c4]"0","10"[/COLOR]
 
hmmm..   Haven't tried it like that yet.  I will have to give something like that a go.  I really want to do something like this as well for some animals to try and get a little more variety in what you get from some of them...  this would give you anywhere from 0 to 10 meat.  this is just an example...

<drop event="Harvest" name="foodRawMeat" tag="butcherHarvest" count="0","10"



and it would probably fail. You have to write

count="0,10" />




i.e. only one string and a closing bracket at the end.

You could look at the existing code in vanilla xmls for examples. For example to get the syntax right now I just searched all the textfiles in Data/Config for the string "count" and among all those I immediately found one with a range.

Also you can check for errors by looking into the directory ConfigsDump in the savegame after trying out a change. There you will see the resulting xmls. If your change is not there or an error is displayed you know the game did not accept your change.

 
Last edited by a moderator:
Back
Top