I am setting a key/value in object's script file. I have a sbx that has this object loaded into it. Looking at the sbx file in notepad, my custom key/value is being written to the sbx. I have the map loaded into sandbox and I am using the fpscontroller.lua file to scan the current world entites for this key, but yet it never finds it. Does this not work because its in the editor and I would need to actually load the sbx in my own lua file to run separately from the editor? Or is this a limitation of a multistate lua system versus a single state?
pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0)
if pick~=nil then
for entity in iterate(CurrentWorld().entities) do
if GetEntityKey(entity,"myvalue","")=="1" then
if entity==pick.entity then
if EntityDistance(camera, pick.entity)<3 then
myotherkey = 1
else
myotherkey = 0
end
end
end
end
end