Jump to content

Slight Adjustment to the % Chance Mechanic of Lureplant Spawning?


Recommended Posts

For quite some time, my understanding of the lureplant spawning mechanics is that the chance for a lureplant to spawn is actually lowered drastically the more players there are in the world. (The % chance is 1 over the number of total players in a world.)

Is it possible to adjust the chance mechanic so that more players on a server doesn't mean less lureplants than if you were a solo player? I'm guessing the intention was so that the world wouldn't be riddled with lureplants from full servers, but instead results in there being less than a solo person? (Correct me if I'm wrong here) .I'm not saying for it to be more than a solo player either, just not less than a solo player.

The spoiler contains my understanding of how this mechanic works, as per the lureplantspawner component.

Spoiler

 The % chance is 1 over the number of total players in a world. So if a world has three people in a world, lureplants would have a 33% chance of actually spawning, compared to a 100% chance of spawning if someone was playing solo. This is also assuming that the player(s) was exploring the world on valid spawning turf the whole time so that there is a proper player data trail for the game to use.

From my experience, if you are playing solo, you can get up to 3-5 Lureplants, depending on the RNG on the spawn interval that's also defined in the lureplantspawner component (every 4 days, plus or minus 1 day; given that there is a valid spot to spawn the lureplant based on the player's data trail). But when playing with other people, you'd get maybe 1-2 Lureplants, and sometimes when the server is heavily populated, you're lucky to get a single lureplant.

Relevant code from the lureplanterspawner component, which has been my basis of understanding:


local function SpawnLurePlantForPlayer(playerinst, playerdata, reschedule)
    if not _worldstate.iswinter then

        local chance = 1/#_activeplayers         --this line 
        local should_spawn = math.random() < chance --and this line here reducing the total overal chance for a lureplant to spawn
        local loc = FindSpawnLocationInTrail(playerdata.trail) or FindSpawnLocation(playerinst.Transform:GetWorldPosition())
        if loc ~= nil and should_spawn then
            local plant = SpawnPrefab("lureplant")
            plant.Physics:Teleport(loc:Get())
            plant.sg:GoToState("spawn")
        end
    end
    _scheduledspawntasks[playerdata] = nil
    reschedule(playerdata)
end

 

Thanks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...