When spawning an object from a script, is there a way to pass a property to the spawned object so that it links to the object that spawned it? (directly or indirectly)
Alternatively is there a way to find the ID of an object of a specific type at a given x/y location?
Passing properties to spawned objects?
Re: Passing properties to spawned objects?
I have this script for finding IDs:MadCatter wrote:Alternatively is there a way to find the ID of an object of a specific type at a given x/y location?
Code: Select all
function getID(self, name, coordX, coordY)
for i in self.go.map:entitiesAt(coordX, coordY) do
if i.name == name then
print(name .. ' #1' .. ' = ' .. i.id)
return i.id
else
print(name .. ' at ' .. coordX .. ', ' .. coordY .. ' not found')
end
end
endTo call it from another script:
Code: Select all
global.script:getID('torch', 12, 18)