Jump to content

"scripts/components/diseaseable.lua":133: attempt to call method 'SetLoops' (a nil value)


NikMik
  • Pending

Seems like there's an issue with the diseaseable component where latency can cause a crash with the error listed above. I was able to fix it by adding :

        local fx = SpawnPrefab("diseaseflies")
        fx.entity:SetParent(inst.entity)

I added this part -->  fx:DoTaskInTime(0, function()  < -- Simply delaying it seems to fix the issue. Adding an "if fx ~= nil then" may also help just in case the flies fail to spawn?
        fx:SetLoops(loops)

end)

into the diseasable command within the DoFX function - I think it's pretty safe to assume WHERE in the function

Seems like I didn't fix it. Here's the log.

server_log.txt


Steps to Reproduce
Make many plants diseased; make many crash



User Feedback


My bad. The fix is just this:

local fx = SpawnPrefab("diseaseflies")

if fx ~= nil then 

fx.entity:SetParent(inst.entity)

fx:SetLoops(loops)

end

 

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...