FANDOM


  • This mechanism is a little complicated. So I choose to reply on your wall.


    First, there is a preset weight table:

       loottable =
       {
           goggleshat_blueprint = 0,
           deserthat_blueprint = 0,
           succulent_potted_blueprint = 0,
           antliontrinket = 0,
           trinket_1 = 1, -- marbles
           trinket_3 = 1, -- knot
           trinket_8 = 1, -- plug
           trinket_9 = 1, -- buttons
           trinket_26 = .1, -- potatocup
           TOOLS_blueprint = .05,
           LIGHT_blueprint = .05,
           SURVIVAL_blueprint = .05,
           FARM_blueprint = .05,
           SCIENCE_blueprint = .05,
           REFINE_blueprint = .05,
           DRESS_blueprint = .05,
       },
    

    When Opening a Crumpled Package, it will drop only one item from this table. The item with higher weight has higher possibility to be dropped. Add them up you can get the sum of weights. The possibility of one item is its weight divided by the sum of weights.


    For example, the sum of weights is (0*4 + 1*4 + 0.1 + 0.05*7) = 4.45. If you want a Potato Cup, you have 0.1/4.45 = 2.2% possibility.


    That's not finished, for the Blueprints and antliontrinket, there is a UpdateLootBlueprint function to assign their weights:

       UpdateLootBlueprint = function(loottable, doer)
           local builder = doer ~= nil and doer.components.builder or nil
           loottable["goggleshat_blueprint"] = (builder ~= nil and not builder:KnowsRecipe("goggleshat")) and 1 or 0.1
           loottable["deserthat_blueprint"] = (builder ~= nil and not builder:KnowsRecipe("deserthat") and builder:KnowsRecipe("goggleshat")) and 1 or 0.1
           loottable["succulent_potted_blueprint"] = (builder ~= nil and not builder:KnowsRecipe("succulent_potted")) and 1 or 0.1
           loottable["antliontrinket"] = (builder ~= nil and builder:KnowsRecipe("deserthat")) and .8 or 0.1
       end,
    

    The weights depends on if the player has known some recipes (goggleshat, deserthat, succulent_potted).

    If player has known goggleshat, he has goggleshat_blueprint = 0.1. Else he has goggleshat_blueprint=1.

    If player has known goggleshat and deserthat, he has deserthat_blueprint = 0.1. Else he has deserthat_blueprint = 1.

    If player has known succulent_potted, he has succulent_potted = 0.1. Else he has succulent_potted = 1.


    If player has known deserthat, he has antliontrinket=0.8. Else he has antliontrinket=0.1.


    In short words, If you have learnt any Blueprint, the weight of the Blueprint will become one-tenth. If you have learnt deserthat, the weight of antliontrinket will become 8-times.


    For example, if you have learnt goggleshat and want a deserthat_blueprint. Now the weight table is:

           goggleshat_blueprint = 0.1,
           deserthat_blueprint = 1,
           succulent_potted_blueprint = 1,
           antliontrinket = 0.1,
    

    The sum of weights is 6.65. You have 1/6.65 = 15% possibility to get one deserthat_blueprint.


    I hope I explained clearly. If you have any questions, just ask me.

    ~__orange(Wall)

      Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.