Page 1 of 1

[BUG?] Editor crashs with monster onMove (details inside)

Posted: Wed Oct 17, 2012 1:56 am
by Mebaru

Code: Select all

cloneObject{
	name = "spider_other",	
	baseObject = "spider",
	uiName = "The Other Spider",
	sight = 0, -- blind spider
	onMove = function(self, direction)
		for j in entitiesAt(2, self.x, self.y) do
			print(j:getUIname())
		end
		return true
	end,
}
See the code. When try to use ANY methods of j like getUIname(), destroy() or setSubtileOffset() editor (or game if I export it) crashes constantly with "bad object" error.

Re: [BUG?] Editor crashs with monster onMove (details inside

Posted: Wed Oct 17, 2012 2:09 am
by Neikun
I.. don't think there's a uiName string for cloned monsters, as the players will never pick them up.

Re: [BUG?] Editor crashs with monster onMove (details inside

Posted: Wed Oct 17, 2012 7:03 am
by petri
Yeah, unfortunately scripts that are written outside the editor are unprotected so any error in them causes the editor to crash. We'll try to address this issue when we do a patch/update.

Re: [BUG?] Editor crashs with monster onMove (details inside

Posted: Wed Oct 17, 2012 10:06 am
by Mebaru
Neikun wrote:I.. don't think there's a uiName string for cloned monsters, as the players will never pick them up.
It's not about uiName cloned monsters only. As I wrote it crashes on every other method, for example destroy(). And actually it crashes on any object in my case, I have an item in a tile and want to destroy it:

Code: Select all

	onMove = function(self, direction)

		for j in entitiesAt(2, self.x, self.y) do
			local allowed = {"rat_shank", "grim_cap","pitroot_bread"}
			for i = 1, #allowed do
				j:destroy()
			end
		end
		return true

	end,
What I am doing wrong?