SetBonePosition: Bone is unwriteable

I wonder what may be the cause of this error. It only seems to occure when I try to set the bone position in certain map locations. The code that causes that error (It doesn’t look like a Lua error, more like a warning.):

local bonestomove = {

function ENT:Draw ()
self:DrawModel ()

function ENT:CalcBonePositions (ply)
for k, v in pairs (bonestomove) do
local bone1 = ply:LookupBone (v)
local bone2 = self:LookupBone (v)
local pos, ang = ply:GetBonePosition (bone1)
self:SetBonePosition (bone2, pos, ang)

function ENT:BuildBonePositions (numbones, numphysbones)
local ply = Entity(1)
self:CalcBonePositions (ply)
end [/lua]

The side effects of this error are model polygons stretches almost all over the map.

I think you may have forgotten a bone. Also, I would recommend using the source bonemerge for the best performance. [lua]self:AddEffects( EF_BONEMERGE | EF_BONEMERGE_FASTCULL | EF_PARENT_ANIMATES )[/lua]

Could you kindly explain as to how am I supposed to use this?

[editline]24th May 2011[/editline]

I would deal with that I have forgotten some of the bones, but the effect of stretched polygons only occures in certain areas of the map (Likely close to the origin of the map, i.e x/y/z near 0/0/0, also some other areas.). And it also moves alongside with the main entity, so it’s just like if they were translated to a wrong position.

[editline]24th May 2011[/editline]

I found out that it actually stretches the bones if the distance from the render point and the entity itself is like medium (not too long and not too short). So parenting that entity to the local player fixed the problem (The distance is always 0, but bones are where they should be). I had this problem because I used cameras… lol…

Also, adding the said effects have also seemed to fix the problem with the error itself. So, thanks.