Page 2 of 2

Re: spawning a monster onDie

Posted: Tue Mar 24, 2015 8:51 pm
by Isaac
bongobeat wrote:Hello,

can a monster be spawned after the death of another monster, and a the same place of the dying monster?
Yes.

Code: Select all

--script name: hook_script
spawn('zarchton', 1, 15,15,0,0).monster:addConnector("onDie", "hook_script", "deathSpawn")

function deathSpawn(monster)
	local c = spawn( "zarchton_ambush", monster.go.level,
				monster.go.x, monster.go.y,
				monster.go.facing, monster.go.elevation).monster
				c:setLevel(2)
				c:setMaxHealth(228)
				c:addConnector("onDie", "hook_script", "deathSpawn")
end

Re: spawning a monster onDie

Posted: Tue Mar 24, 2015 10:00 pm
by Eleven Warrior
Hi Issac thxs for this code man :) Just wondering why you added the line: c:addConnector("onDie", "hook_script", "deathSpawn") to the second monster? Wont it just keep respawing a new monster each time it dies or did I miss something thxs :)

Re: spawning a monster onDie

Posted: Tue Mar 24, 2015 11:56 pm
by Isaac
Eleven Warrior wrote:Hi Issac thxs for this code man :) Just wondering why you added the line: c:addConnector("onDie", "hook_script", "deathSpawn") to the second monster? Wont it just keep respawing a new monster each time it dies or did I miss something thxs :)
It is an infinite demo... To demonstrate; but the second hook can be removed or commented out.

*But it's neat to kill off the zarchtons in the editor with 'K', and they just keep crawling out of the pond (or floor).

Re: spawning a monster onDie

Posted: Wed Mar 25, 2015 7:08 am
by Eleven Warrior
Isaac wrote:
Eleven Warrior wrote:Hi Issac thxs for this code man :) Just wondering why you added the line: c:addConnector("onDie", "hook_script", "deathSpawn") to the second monster? Wont it just keep respawing a new monster each time it dies or did I miss something thxs :)
It is an infinite demo... To demonstrate; but the second hook can be removed or commented out.

*But it's neat to kill off the zarchtons in the editor with 'K', and they just keep crawling out of the pond (or floor).


Sound cool and funny at the same time. I tried it and man what a laugh, also gave me some awesome new ideas when my Brain went to sleep lol :)

Re: spawning a monster onDie

Posted: Wed Mar 25, 2015 9:07 pm
by bongobeat
Azel wrote:Oh yeah, the Teleporter wouldn't be able to do it in the exact location where the original monster died; unless you added Script. The smaller script minmay gave is definitely better for a straight 1-to-1 scenario: monster dies, monster spawns. Sorry if I confused you, I tend to like to make things a bit more adventurous, so to speak. Cheers!
no problem, thanks for the help :)

Isaac wrote:
bongobeat wrote:Hello,

can a monster be spawned after the death of another monster, and a the same place of the dying monster?
Yes.

Code: Select all

--script name: hook_script
spawn('zarchton', 1, 15,15,0,0).monster:addConnector("onDie", "hook_script", "deathSpawn")

function deathSpawn(monster)
	local c = spawn( "zarchton_ambush", monster.go.level,
				monster.go.x, monster.go.y,
				monster.go.facing, monster.go.elevation).monster
				c:setLevel(2)
				c:setMaxHealth(228)
				c:addConnector("onDie", "hook_script", "deathSpawn")
end
oh my! funny things, thanks for that! ;)