Page 1 of 1

Bug: overriding the cube crashes the editor

Posted: Wed Sep 19, 2012 6:22 pm
by Billick
I was playing around with trying to make a "not invincible" version of the cube, so I added the following code to my monster.lua.

Code: Select all

cloneObject {
	name = "weak_cube",
	baseObject = "cube",
	health = 30,
	exp = 100,
	attackPower = 5,
	onDamage = function(monster, damage)
		return true
	end,
}
When I added my cloned cube to my map, the editor crashed when I started the preview. I'm not sure, this might be an invalid thing to try to do. If it is, the editor should probably display an error instead of crashing. The cube is a neat model though, and I'd like to have it in my mod without it being an unstoppable killing machine.

Re: Bug: overriding the cube crashes the editor

Posted: Wed Sep 19, 2012 6:29 pm
by Montis
There's no such thing as a weak cube! :twisted:

Seriously though, I think what's wrong here is that "return true" doesn't work here.
Can you try the following (I'm unable to test at the moment):

Code: Select all

onDamage = false
With that you should be able to "reset" all previously written statements in the onDamage hook.
If that doesn't work you can also try:

Code: Select all

onDamage = function()
end

Re: Bug: overriding the cube crashes the editor

Posted: Wed Sep 19, 2012 6:45 pm
by Billick
Montis wrote:There's no such thing as a weak cube! :twisted:

Seriously though, I think what's wrong here is that "return true" doesn't work here.
Can you try the following (I'm unable to test at the moment):

Code: Select all

onDamage = false
With that you should be able to "reset" all previously written statements in the onDamage hook.
If that doesn't work you can also try:

Code: Select all

onDamage = function()
end
I commented everything else out except for the first two lines, just to see if my function was messed up, and it still crashed the editor. I wasn't planning on having my cube be that weak, I was just using low numbers for testing so that I could get it working, but I haven't gotten past that point yet. :lol:

Re: Bug: overriding the cube crashes the editor

Posted: Wed Sep 19, 2012 10:29 pm
by Montis
Ok I tried it as well: When just cloning the cube with another name, it will crash the editor good. I even have to restart steam because that thinks that LoG is still running for some reason.