Spider Eggs and cracking them open

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Saurbaum
Posts: 17
Joined: Sat Jan 05, 2013 6:19 pm

Spider Eggs and cracking them open

Post by Saurbaum »

Hi everyone,

I'm trying to put together a room with a lot of hatch-able spider eggs as a trap. Step one is complete and that's following the steps to make the eggs spawn a spider on hatching. That bit works fine.

What I want to do though is to make pressing a button hatch all the eggs.

I wrote a script to go through the eggs in the room and destroy them using damageTile(). That works but it also almost always kills the freshly spawned spider even though they are spawned onDeath() of the eggs. I think I can see why in terms of game logic update that happens because onDeath() happens spawns the monster then the damageTile() spots another entity in the tile to damage and kills the spider.

I think I can get round it by making a custom spider that's immune to one type of damage and have them spawn out the piosion immune spider and use poison damage to break the eggs. I'd rather not go this way just in case the player has dumped all his magic points into earth magic it'd suck to have it all rendered useless.

So assuming I've not overlooked something obvious can anyone suggest a way to kill the eggs better than damageTile() or a way to prevent the spider death which won't screw over a party's abilities if they have been stacked that way?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Spider Eggs and cracking them open

Post by Komag »

I don't know how your script works to make the spiders from the eggs, but you could stick in a very short timer, like 0.05s, to spawn the spiders after the eggs are killed, that might do it.

Or you could simply destroy() all the eggs and use the script to spawn the spiders directly (perhaps again after a very brief delay)
Finished Dungeons - complete mods to play
Saurbaum
Posts: 17
Joined: Sat Jan 05, 2013 6:19 pm

Re: Spider Eggs and cracking them open

Post by Saurbaum »

My script is the classic example from the Grimrock website. onDeath() of the eggs causes the spawn of a spider in it's space.

I tried doing destroy() on the egg and while it does work (with a minor mod to the script) it removes the eggs so you don't have the broken open model displayed.
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Spider Eggs and cracking them open

Post by Komag »

You could spawn those in, maybe have to define a new decoration object with the broken egg model first
Finished Dungeons - complete mods to play
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Spider Eggs and cracking them open

Post by Drakkan »

just tried this solution and seems its working.
open your object.lua and add this there

defineObject{
name = "spider_eggs_broken",
class = "Decoration",
model = "assets/models/env/spider_eggs_broken.fbx",
brokenModel = "assets/models/env/spider_eggs_broken.fbx",
placement = "floor",
editorIcon = 56,
}

this will allows you to destroy egg and then replace its place with broken object like regular (using spawn command) example:

Code: Select all

function broken()
function destroyandspawn()
egg1:destroy()
spawn("spider_eggs_broken", 2, 16, 5, 3, "broken1")  -- coordinates of the original egg (level, x,y,tile)
end
Breath from the unpromising waters.
Eye of the Atlantis
Saurbaum
Posts: 17
Joined: Sat Jan 05, 2013 6:19 pm

Re: Spider Eggs and cracking them open

Post by Saurbaum »

While that's possible it's starting to get a little convoluted.

If someone goes round and destroys the eggs in turn to take out the spiders one at a time I don't want to drop them all on the player as a trap if they have been careful and cleared them out first.

So I'll end up with a very complicated script tracking the eggs that haven't been destroyed. When the button is pressed I remove them spawn in replacement cracked open eggs along with their fresh spiders.

Speaking directly to the Devs now should one happen to stumble across this.

Is is possible to add a damage() function to all objects with a health rating? Something a little more targeted than the damageTile() we have now.
Saurbaum
Posts: 17
Joined: Sat Jan 05, 2013 6:19 pm

Re: Spider Eggs and cracking them open

Post by Saurbaum »

In a moment of inspiration I made my hatchable eggs have a health of 1 which means a damageTile strength 1 will burst them wide open leaving the spider unharmed.

Oddly trying to do damage "physical" fails with an error but "fire" works a treat.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Spider Eggs and cracking them open

Post by Drakkan »

Saurbaum wrote:In a moment of inspiration I made my hatchable eggs have a health of 1 which means a damageTile strength 1 will burst them wide open leaving the spider unharmed.

Oddly trying to do damage "physical" fails with an error but "fire" works a treat.
good to know :) btw:When I tried to deal some precise physical dmg with script (like 100 physical dmg) it was instead dealing some random values 0-200. probably depends on evasion of that object...
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply