Page 1 of 2
Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 2:56 am
by KnotuAgain
I want a monster to spawn some treasure when it dies.
I have:
onDie function(self)
spawn("bone_club", self.level, self.x, self.y, 0)
spawn("coin_copper", self.level, self.x, self.y, 0)
end
I tried it in the Lua script and in the a verision of the monster that I made. When I kill it, nothing happens, no treasure is dropped. I am pretty sure this is what I did in LOG 1.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 4:50 am
by msyblade
You could just add the items to the monster in the dropdown box in the editor, then they will drop when it dies.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 6:29 am
by cameronC
onDie should work but if you are just spawning items you can use monstername.monster:addItem() to give it to them and they will always drop it when they die.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 7:18 am
by KnotuAgain
I tried the monstername.monster:addItem()
ex.
my_mummy_A.monster:addItem("bone_club")
when in the monster script it gave the following error: "attempt to index global "my_mummy_A" ( a nil value).
When I tried it in the lua script that spawns the mummy, there was no error, but nothing dropped when I killed it.
Don't know what I am doing wrong, this should be simple. I had no problem doing it in LOG 1.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 7:20 am
by KnotuAgain
I can't add the item in the drop down button, because it is spawns when the champions dig at a gravesite, therefore no drop down.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 7:22 am
by NutJob
addItem accepts an object not a string.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 7:35 am
by KnotuAgain
Weird. I tried no " "'s
No error when I put in the monster script, but no drop either.
Tried in the lua script and I get the error that I had earlier in the Monster file.
attempt to index "my_mummy_A" ( a nil value).
I am at a lost.
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 7:37 am
by KnotuAgain
I would not have to create my own verision of a monster if I could get it to not drop what it normally drops and switch it with what I want it to drop.
has anyone one gotten the onDie to work?
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 7:39 am
by NutJob
yes attach that event to the party object with addConnector or use defineObject in the objects.lua
Re: Does onDie work in LOG 2?
Posted: Fri Nov 07, 2014 8:13 am
by KnotuAgain
I GIVE UP !
LOG 1 was easy to mod. LOG 2 I can't even get a dumb monster to drop an item. Why did they make everything so hard this time around. I tried to make a mine level and the ceiling is all screwed up. I can't get the beach to have an ocean. I have been working on this for 3 days and have nothing to show for it. It is like going from first grade to college in one step. Nothing works.