How to make a monster spawn a poison cloud on death

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
LocalFire
Posts: 261
Joined: Thu Feb 21, 2013 1:16 am
Location: Auckland, New Zealand

How to make a monster spawn a poison cloud on death

Post by LocalFire »

I'd like a custom monster to spawn a poison cloud on death, so far I've tried using an onDie hook and it works when I test it with a blockage, but not with the monster itself

heres the code

Code: Select all

 onDie = function(object)
		ghoulplague.onDeath(object.level, object.x, object.y)
	end,
Calling on the script

Code: Select all

function onDeath()

	local facing = (party.facing + 2)%4
	spawn("poison_cloud", level, x, y, facing)
end
and yes I have checked the spelling on the SE, it works fine if I use it on a set of spider eggs, but not for the monster, What am I doing wrong?
My Dungeons
Paths of the Earth: viewtopic.php?f=14&t=5136
Beneath the Sands: viewtopic.php?f=14&t=5216
Videos: viewtopic.php?f=11&t=5443
User avatar
DesperateGames
Posts: 90
Joined: Sun Oct 06, 2013 1:54 pm

Re: How to make a monster spawn a poison cloud on death

Post by DesperateGames »

The following combination works for me:

Code: Select all

onDie=function(monster)
		death_test.spawnCloud(monster)
	end
Calling on the script:

Code: Select all

function spawnCloud(monster)
	spawn("poison_cloud", monster.level, monster.x, monster.y, monster.facing)
end
Can you check on the parameters for your OnDeath() function? In the script it has no parameters defined, but in the monster definition you are trying to pass object.level etc. to the function, I'm not sure how lua / Grimrock handles this....
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: How to make a monster spawn a poison cloud on death

Post by msyblade »

It may be that you are calling "object.level, x and y", while you need it to reference "monster.level, x and y". This would also explain why it works on spider eggs.
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
User avatar
LocalFire
Posts: 261
Joined: Thu Feb 21, 2013 1:16 am
Location: Auckland, New Zealand

Re: How to make a monster spawn a poison cloud on death

Post by LocalFire »

Well that explains it, I feel kinda dumb for not realizing that, thanks guys
My Dungeons
Paths of the Earth: viewtopic.php?f=14&t=5136
Beneath the Sands: viewtopic.php?f=14&t=5216
Videos: viewtopic.php?f=11&t=5443
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: How to make a monster spawn a poison cloud on death

Post by msyblade »

Happens to the best of us. sometimes the forest is so big, the trees start to look alike. That's why were here, a fresh set of eyes is just invaluable on projects this size.
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
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: How to make a monster spawn a poison cloud on death

Post by Eleven Warrior »

cloneObject{
name="Boss",
baseObject = "ogre",
onDie = function(monster)
spawn("poison_cloud", monster.level, monster.x, monster.y, monster.facing)

end
}
Post Reply