I took cornos idea and just added a little that would allow your "slawn" to disappear based on distance but not be removed so you can call him back using ResetPosition(e,x,y,z).
You'd need to calculate the x, y and z
eg:
-- this is an incomplete APPEAR example
minDist = 300
maxDist = 500
pX= g_PlayerPosX
pY= g_PlayerPosY
pZ= g_PlayerPosZ
-- add some randomness to where "slawn" appears
pX = pX + math.random(minDist,maxDist)
pZ = pZ + math.random(minDist,maxDist)
ResetPosition(e,pX,pY,pZ)
Show(e)
CollisionOn(e)
-- this is a partially complete DISAPPEAR example
function entity_init(e)
end
function entity_main(e)
plyrDist = GetPlayerDistance(e)
if g_Entity[e]['activated'] == 1 and plyrDist < minDist then
Hide(e)
CollisionOff(e)
end
end
You could use a trigger zone (for example) to decrease/increase the appear/disappear distances dynamically. ie: Add something like this to a trigger zone script. Every time they entered the zone the range could be increased/decreased?
minDist = minDist - 1
Obviously both of these script pieces are
not really working script and the ResetPosition script example would not check for obstacles so if you weren't careful where Slawn appeared you could land him in a tree.
----
Based on my understanding of your lights problem, the range is fixed so there is no way (I know of) to make lights work from a long way away. Need to find the thread where this was discussed a little while back.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD