Jump to content

help with function arguements


Recommended Posts

i'm having problems with certain conditions not working as it keeps on talking about needing a function enlargements, i'm sure this is a novice mistake but i don't understand >.<

local function onread (inst,reader)

     local pt = reader:GetPosition()
     local numtentacles = 3     
     if reader:HasTag("frick") then

    for k = 1, numtentacles do
    local theta = math.random() * 2 * PI
    local radius = math.random(3, 6)
	
     reader.components.sanity:DoDelta(-TUNING.SANITY_HUGE)

     local result_offset = FindValidPositionByFan(theta, radius, 12, function(offset)
          local pos = pt + offset
          return #TheSim:FindEntities(pos.x, 0, pos.z, 1, nil, { "INLIMBO", "FX" }) <= 0
          and TheWorld.Map:IsDeployPointClear(pos, nil, 1)
          end)
 
          if result_offset ~= nil then
          local x, z = pt.x + result_offset.x, pt.z + result_offset.z
          reader.components.petleash:SpawnPetAt(x, 0, z)

          if reader.petleash:numpet ~= 3 then  ------------- # around here it starts to crash
          SpawnPrefab("poopcloud").Transform:SetPosition(x, 0, z)
          ShakeAllCameras(CAMERASHAKE.FULL, .2, .02, .25, reader, 40)
         
		 end

        return true
    end
	end
	end
	end

 

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
 Share

×
  • Create New...