yes you could just use a distance check rather than a zone but the original request was for it to be done by zone, i will put up both versions anyway as it's a simple adjustment.
all you need to set is the start markers (e) value (as the check is HP based and apparently the start markers HP value is taken from the actual player HP value you set for some reason (while i could set a max limit to technically automate this it would cause issues if you set (for example) a boss with a high HP)
feel free to adjust the range based on whatever works for you
and the HP value is just to hide markers (no idea if lights still show or not as they currently error for me and i dont use them anyway)
occlusion_zone.lua
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Enters occlusion Zone
--set veiw range here (anything beyond this range will be invisible while player is inside the 'zone'
local distance = 1000
--set this to the (e) value of your startmarker
local startmarkerE = 1
--anything below this HP will not be shown (i.e. markers for zones)
local health_limit = 2
function occlusion_zone_main(e)
if g_Entity[e]['plrinzone']==1 then
for a = 1, 1999 do
if g_Entity[a] ~= nil then
PlayerDX = g_Entity[a]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[a]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[a]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if g_Entity[a]['health'] >= health_limit and a ~= startmarkerE then
if PlayerDist < distance then
Show(a)
else
Hide(a)
end --end distance check
end --end HP check
end --end nil check
end --end for loop
--if player isnt inside the zone
else
for a = 1, 1999 do
if g_Entity[a] ~= nil then
if g_Entity[a]['health'] >= health_limit and a ~= startmarkerE then
Show(a)
end --end marker check
end --end entity exists check
end --end for loop
end --end player in zone
end --end function
occlusion.lua (always on - just set to any entity that will always be present in the level)
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Enters occlusion Zone
--set veiw range here (anything beyond this range will be invisible while player is inside the 'zone'
local distance = 1000
--set this to the (e) value of your startmarker
local startmarkerE = 1
--anything below this HP will not be shown (i.e. markers for zones)
local health_limit = 2
function occlusion_main(e)
for a = 1, 1999 do
if g_Entity[a] ~= nil then
PlayerDX = g_Entity[a]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[a]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[a]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
if g_Entity[a]['health'] >= health_limit and a ~= startmarkerE then
if PlayerDist < distance then
Show(a)
else
Hide(a)
end --end distance check
end --end HP check
end --end nil check
end --end for loop
end --end function
let me know if you have any issues but it's working for me so should be fine
life's one big game
windows vista ultimate
i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11