Does onDie work in LOG 2?
-
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Does onDie work in LOG 2?
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.
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?
You could just add the items to the monster in the dropdown box in the editor, then they will drop when it dies.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Does onDie work in LOG 2?
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.
Writer and sometimes artist of the very slightly acclaimed comic series Scrambled Circuits. A comic series about a robot written by a human.
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
-
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Re: Does onDie work in LOG 2?
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.
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.
-
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Re: Does onDie work in LOG 2?
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?
addItem accepts an object not a string.
-
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Re: Does onDie work in LOG 2?
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.
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.
-
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Re: Does onDie work in LOG 2?
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?
has anyone one gotten the onDie to work?
Re: Does onDie work in LOG 2?
yes attach that event to the party object with addConnector or use defineObject in the objects.lua
-
- Posts: 17
- Joined: Sun Oct 05, 2014 7:29 am
Re: Does onDie work in LOG 2?
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.
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.