Page 1 of 1

make boos and twomps only killable by hammer?

Posted: Thu Aug 11, 2016 9:48 pm
by Shadowblitz16
how do I edit the thwomps and boos so they can only be killed by the hammer projectile?

Re: make boos and twomps only killable by hammer?

Posted: Thu Aug 11, 2016 10:17 pm
by PixelPest
I'd suggest using NPC.get() and NPC.getIntersecting() to check for collisions by other NPCs that can harm them (really only shells I think) and then either change their direction or despawn them before they collide

Re: make boos and twomps only killable by hammer?

Posted: Fri Aug 12, 2016 6:48 am
by Emral
PixelPest wrote:I'd suggest using NPC.get() and NPC.getIntersecting() to check for collisions by other NPCs that can harm them (really only shells I think) and then either change their direction or despawn them before they collide
Too complicated. Just use onNPCKill and a getIntersecting ID check.

Re: make boos and twomps only killable by hammer?

Posted: Fri Aug 12, 2016 7:02 am
by PixelPest
Enjl wrote:
PixelPest wrote:I'd suggest using NPC.get() and NPC.getIntersecting() to check for collisions by other NPCs that can harm them (really only shells I think) and then either change their direction or despawn them before they collide
Too complicated. Just use onNPCKill and a getIntersecting ID check.
But then wouldn't the Boo or Thwomp already be killed?

Re: make boos and twomps only killable by hammer?

Posted: Fri Aug 12, 2016 7:09 am
by Hoeloe
PixelPest wrote:
Enjl wrote:
PixelPest wrote:I'd suggest using NPC.get() and NPC.getIntersecting() to check for collisions by other NPCs that can harm them (really only shells I think) and then either change their direction or despawn them before they collide
Too complicated. Just use onNPCKill and a getIntersecting ID check.
But then wouldn't the Boo or Thwomp already be killed?
Uhh no. That would defeat the whole point of onNPCKill if that were the case. onNPCKill runs juuust before the NPC is killed, and you can cancel the kill event to prevent it.

Re: make boos and twomps only killable by hammer?

Posted: Fri Aug 12, 2016 8:00 pm
by Shadowblitz16
Hoeloe wrote:
PixelPest wrote:
Enjl wrote: Too complicated. Just use onNPCKill and a getIntersecting ID check.
But then wouldn't the Boo or Thwomp already be killed?
Uhh no. That would defeat the whole point of onNPCKill if that were the case. onNPCKill runs juuust before the NPC is killed, and you can cancel the kill event to prevent it.
how do I cancel the kill event?

Re: make boos and twomps only killable by hammer?

Posted: Fri Aug 12, 2016 8:06 pm
by Emral