Author Topic: Monster Proposal  (Read 848 times)

Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 231
Monster Proposal
« on: October 20, 2012, 01:03:37 PM »
ImpassIve made a comment in another thread about wanting a CREATURE_DEATH hook. I have also wanted some more flexible monster hooks in the past.

I propose we add the following fields to the "MonsterType" table:

* on_attack -- this is called when the monster makes an attack / swings its weapon
* on_damage -- this is called when the monster receives non-fatal damage
* on_death -- this is called when the monster is killed

(These are a bit like HOOK_CREATURE_SQUELCH etc, but there is one for each monster type instead of one "global" hook. I think this is better than using hooks :) )

Romanio(Rus)

  • Jr. Member
  • **
  • Posts: 13
  • FOR MOTHER RUSSIA!
Re: Monster Proposal
« Reply #1 on: October 23, 2012, 11:36:39 AM »
Fully support this initiative, as it will give much more space to write mods =)

Stephen

  • Administrator
  • Hero Member
  • *****
  • Posts: 231
Re: Monster Proposal
« Reply #2 on: December 27, 2012, 04:07:51 PM »
This is now implemented. A snapshot is available here: http://www.solarflare.org.uk/snapshots/knights_src_2012_12_27.tar.gz (source code) or http://www.solarflare.org.uk/snapshots/knights_2012_12_27.zip (Windows binary)

In addition to "on_attack", "on_damage" and "on_death", I also added "on_move" which is called whenever the monster moves to a new square.

I also removed the "sound" property because monster sounds can now be implemented using a combination of on_attack, on_damage, on_death and on_move, as required. For example, zombies make a sound whenever on_attack, on_damage, on_death are called, and also 5% of the time when on_move is called. Bats only make their "screeching" sound when on_damage is called.

ImpassIve_rus

  • Sr. Member
  • ****
  • Posts: 69
  • 0_o
Re: Monster Proposal
« Reply #3 on: December 27, 2012, 05:20:42 PM »
Nice news, hehe)
Will try it later

P.S. I just have installed a new router (because from today I have a VDSL connection instead of ADSL) but I have problems with playing some games in online (including Knights)
I hope I will fix this until Sunday... -_-