Page 1 of 1

Swamp Toad Eat Bomb

Posted: Sat Dec 09, 2023 3:17 am
by CainOrdamoth
Hey all.
So, swamp toads have a monster action named eatBomb, and it has animations and everything, but I can't get the monster to do it. I can force the monster to do it with a script, but can't suss out how it would happen in combat. I've tried having the toad eat bombs out of my hand, I tried throwing a bomb right when it attacks to see if it swallows it, but nothing happens. I did some searches on the forum and Google but to no avail. Does anyone know what this action is all about?
Cheers :)

Re: Swamp Toad Eat Bomb

Posted: Sun Dec 10, 2023 1:00 am
by 7Soul
I checked the code with uMod and this is what I found:

MonsterStealWeaponComponent has this function:

Code: Select all

function MonsterStealWeaponComponent:finish()
	if self.go.tongueItem then
		self.go:removeComponent(self.go.tongueItem)
	end
	self.tongueItemScale = nil
	
	-- digest items
	for _,it in self.go.monster:contents() do
		it:sendMessage("onDigestItem", self.go.monster)
	end
end
Which doesn't actually do anything because the message is being sent to the item component rather than the object itself

Then BombItemComponent has this function:

Code: Select all

function BombItemComponent:onDigestItem(monster)
	-- bomb was eaten by a monster
	self:explode(monster.go.map, monster.go.x, monster.go.y, monster.go.facing)
	monster:removeItem(self.go)
	monster:performAction("eatBomb")
	return true
end
Which causes an error when it tries to remove itself from the monster

So I fixed the functions with uMod

Code: Select all

function MonsterStealWeaponComponent:finish()
	if self.go.tongueItem then
		self.go:removeComponent(self.go.tongueItem)
	end
	self.tongueItemScale = nil
	
	-- digest items
	for _,it in self.go.monster:contents() do
		it.go:sendMessage("onDigestItem", self.go.monster)
	end
end

function BombItemComponent:onDigestItem(monster)
	-- bomb was eaten by a monster
	self:explode(monster.go.map, monster.go.x, monster.go.y, monster.go.facing)
	local bomb = monster:getItemById(self.go.id)
	monster:removeItem(bomb)
	monster:performAction("eatBomb")
	return true
end
This is the result: https://drive.google.com/file/d/1YpiAqF ... drive_link

So either they broke it by accident before release, or left it broken on purpose for some other reason. I don't know if you could fix this via regular scripting but hopefully this at least helps shed some light on this mechanic

Re: Swamp Toad Eat Bomb

Posted: Sun Dec 10, 2023 3:05 pm
by CainOrdamoth
Wow, this is really nice, thank you so much. I had a feeling that was how it would work, but it was something I never witnessed in-game so that now makes a lot more sense. I was trying to figure out a way to use this for a boss monster or something (like the dodongo from Legend of Zelda). I'm not sure if i'm skilled or knowledgeable enough to put any of this to use, unfortunately, but I greatly appreciate your help.