Jump to content

check if model exist


orel56000

Recommended Posts

Posted (edited)
3 minutes ago, NeXuS™ said:

You can try to create the object and if it runs succesful, you know it is a valid id.

That how I've done that, but it is printing me warnings and I thought to myself if there is an other way, why not to ask?

Edited by orel56000
Posted
function getObjectID()
  local objects = getElementsByType("object")
  for i,object in ipairs(objects) do
    if getElementModel(object) then
      return object      
    end
  end
  return false
end

try this

Posted
34 minutes ago, ÆBKV said:

function getObjectID()
  local objects = getElementsByType("object")
  for i,object in ipairs(objects) do
    if getElementModel(object) then
      return object      
    end
  end
  return false
end

try this

Useless code. Would stop after the first object found.

Posted (edited)

There's a Map Editor file called 'objects.xml' that has all objects IDs.

You'll need to convert it to Lua, though, to avoid loops through the whole file.

Edited by DNL291
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...