Using DG_Events to make Spell Casting Events Timed

From: Mathew Earle Reuther (
Date: 09/06/02

Ok, this is probably going to rapidly get confusing if people start
tossing around too many big words.  Let's start this one off by reminding
folks that I'm not a very adept coder, and this is not something I'm
having an easy time grasping.

What I want to do is this:

The grand goal is to move to an event-based structure for a number of
processes.  Combat rounds would be event based, allowing differing speed
of weapons (and spells which enhance the speed of your attacks, for
example).  Special attacks in combat would be event-based, allowing
regular combat to be put on hold for the really impressive attacks, or
just having a delay to other commands for the weaker ones (a flying
dragon death spiral move would take far mor concentration than a kick to
the groin, and be much more deadly, of course).

The thing I want to work on first is a spell-casting system.  Essentially
I want cast_magic to to hand off to an event, which would then make a call
to call_magic (assuming it was not interrupted, more on this below).  I'm
working with a mostly stock spell system here.  I want to change the
system to events, then modify other aspects of it.

So, the things I know about this system (in haphazard order):

1) When cast_magic is finished, it needs to create a casting event, stick
it to the caster, and pass all the info normally required for call_magic
to it.

2) The event struct has to store the stuff cast_magic needs.

3) I need a way to cancel the event in case of being damaged/moving/etc.

4) The event must cancel upon character death.

5) When the event actually executes, the EVENTFUNC needs to pass
everything appropriate on to call-magic (after making sure the caster is
not unconcious and such).  It also needs to free the event_obj, of course.

There's probably more.


I'm running bpl 21/22 (current cvs version) with dg pl8 (which includes
dg events) and oasis olc current version.  I've modified the code a fair
bit, but many pieces are still quite stock.  I'm looking to utilized the
standard dg events system when building my event-based systems.  (I'd
prefer to keep everything to one standard, rather than making my combat
system handle stuff one way, my hp regen another, my spells yet another.)

Any assistance or ideas people can provide is useful.  I'm working on
this, but am getting lost mainly in how to make it so people lose
concentration when damaged, how to prevent them from doing anything else
when they're casting, or at least how to break it if they try.  I *think*
that I'll manage to get something working which actually calls an event
and executes it after the casting time has expired (and it has a
rudimentary check to see if they fail due to damage, but it's not very
well implemented currently) a bit later today.  But that's far from where
I'd like to get this system!

Thanks in advance for any thoughts/ideas/comments/randomness.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT