Re: Events & Casting

From: Sam Moggach (
Date: 01/22/02

i've done something like this with my fight system. The way it works is,
each player has a speed factor, and that is the amount of time that passes
before they can use another fight command again. And fight commands are
things like kick and bash and such.

The way i did it is this: give each player a speed factor, and a fightchk
variable (float) when the command is inputted, it starts the fightchk at the
players speed factor, and then pulse_violence lowers the fightchk by 0.25
every 0.25 seconds, and in the command interpreter, i just put an if
statement. if you've got no fightchk, you can use a fight command, if you
have one, well, too bad for you.

The way this could work for spells is just add a spell pulse to the
hearbeat() function in db.c, this function performs the functions contained
over and over again after the given amount of time is finished, this is how
fighting works with circle, every second or so it runs the function

Just add a perform_cast function and a PULSE_CAST.
now just make a castchk variable global somewhere, or in the player's data
or something, and do the same in the command interpreter, if they've got a
castchk, too bad they can't cast again, if they do? then cast the spell.

You'd also have to modify the function that actually casts the spell and
says like 'micken closes his eyes and utters the magic word, 'Please'. you'd
pretty much just have to make that function do nothing and just say that you
start casting, and set the castchk value. and maybe add a player flag callid
IS_CASTING or something, then in perform_cast you'd just do
if (IS_CASTING(Ch) && castchk > 0) {
  castchk -= PULSE_CAST;
else if (IS_CASTING(Ch) && castchk <= 0) {

Hope this helps, it's complicated and i'm not incredibly good at explaining

- Micken

Join the world’s largest e-mail service with MSN Hotmail.

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

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