easy (I hope) onHit script help pls

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

easy (I hope) onHit script help pls

Post by Drakkan »

What i need help with, is probably onHit functionality added directly to creature specification. When creature (call it Snake) is hit by red_gem, gem is destroyed and it deals 100 physical dmg to Snake.
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: easy (I hope) onHit script help pls

Post by Komag »

probably this from the MONSTER section of Asset Definitions:
onProjectileHit: a hook which is called when a projectile hits the monster. The function gets the following parameters: the monster itself, the projectile which hit the monster, amount of damage and damage type. If the function returns false, the monster receives no damage and the projectile drops to ground.

have your script check if the projectile was a red_gem, and if so then bomb that sucker for 100 damage! Probably return false so the monster doesn't also get the few small points of damage from the gem itself, and then destroy() the gem - maybe have to use very short timer - and script in the damage effect. But then I'm not sure how to credit the champion who threw it with XP if it dies, hmm, could get complicated
Finished Dungeons - complete mods to play
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: easy (I hope) onHit script help pls

Post by Drakkan »

Komag wrote:probably this from the MONSTER section of Asset Definitions:
onProjectileHit: a hook which is called when a projectile hits the monster. The function gets the following parameters: the monster itself, the projectile which hit the monster, amount of damage and damage type. If the function returns false, the monster receives no damage and the projectile drops to ground.

have your script check if the projectile was a red_gem, and if so then bomb that sucker for 100 damage! Probably return false so the monster doesn't also get the few small points of damage from the gem itself, and then destroy() the gem - maybe have to use very short timer - and script in the damage effect. But then I'm not sure how to credit the champion who threw it with XP if it dies, hmm, could get complicated
hmmm... and what about script directly red_gem instead creature ? Make from that regular throwing weapon with some minor attack dmg, but get destroyed and deal 100 dmg when hit Snake creature ?

defineObject{
name = "red_gem_bomb",
baseObject = "rock",
attackPower = 4,
model+gfx to create

*** Onhit creature Snake = true then destroyitself and deal 100 physical dmg to snake**
end
}
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: easy (I hope) onHit script help pls

Post by Komag »

but there isn't that hook for items, so we are limited in that way. For items there is onUseItem, but that is the moment you attack, not when it hits the snake.

It could possibly still be useful, to set a flag and a timer perhaps, so that any creature that is hit before the timer resets the flag will know that it must have been the bomb that hit it, but it's no guarantee, because you could toss it north, quickly turn and shoot an arrow at a monster to the east, and it would think it was hit with the bomb!

But maybe some combination could be made to work more reliably than that. I'm afraid I don't have time to really work through it though, sorry.
Finished Dungeons - complete mods to play
Post Reply