Re: [newbie] fight system...

From: Mike Breuer (
Date: 08/25/01

To create a new fight system such as what you're describing will take a bit
of effort.  I assume you've already looked for patches/snippets on the ftp
site that might get you at least part of what you're looking for.  Here is a
basic overview of how I think I would handle this.

in structs.h, add a "combat" structure and stick it into struct char_data:
struct combat_data {
  sh_int attack_type;
  sh_int defend_type;
  ubyte timer;
  .... (whatever else might be relevant)

You'll probably also want to create some macros in utils.h.   And also
something like:
#define COMBAT_DELAY    3    /* Number of rounds for response */

Next, in do_punch, and/or any offensive commands:
  ch->combat.attack_type = ATTACK_PUNCH_LEFT; /* or whatever */
  ch->combat.defend_type = DEFEND_NONE;
  ch->combat.timer = COMBAT_DELAY;
  act("$n tries to punch you!", FALSE, ch, 0, vict, TO_VICT);

And in do_block, and/or any defensive commands:
  ch->combat.attack_type = ATTACK_NONE;
  ch->combat.defend_type = DEFEND_BLOCK_PUNCH; /* whatever */
  ch->combat.timer = 0;

Next, modify perform_violence in fight.c:
+  if (ch->combat.timer - (ch->combat.timer > 0) ||
+      ch->combat.attack_type == ATTACK_NONE)
+    continue;
    if (IS_NPC(ch)) {
      if (GET_MOB_WAIT(ch) > 0) {

Finally, modify the hit function in fight.c to include the rules for
handling attacks and blocks.  Note that this really is only benificial for
player vs. player combat, unless you write some rules to allow mobs to
attack/defend strategically.  Good luck with it.


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST