macklebee Posted December 13, 2009 Share Posted December 13, 2009 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 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 13, 2009 Share Posted December 13, 2009 Use for model in iterate(fw.main.world.entities) do if(model:GetKey("Name") == name) then return model end end You don't know what CurrentWorld() is returning because there can be multiple worlds. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 13, 2009 Author Share Posted December 13, 2009 Use for model in iterate(fw.main.world.entities) do if(model:GetKey("Name") == name) then return model end end You don't know what CurrentWorld() is returning because there can be multiple worlds. yes i have already tried this as well as performing GetGlobalObject for the main_world and setting the world to fw.main.world etc... still no response at all... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted December 13, 2009 Share Posted December 13, 2009 That works for me. Put some Prints() in there to see where it's hitting and where it's not. That could help debug. Quote Link to comment Share on other sites More sharing options...
macklebee Posted December 13, 2009 Author Share Posted December 13, 2009 yep got it... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.