On Mon, 24 Jun 1996, Joshua Mentzer wrote: > > > you type "cast 'spell'" <like word of recall, say it needs no target>.. > > > and it goes Casting: #######, then a few seconds, then Casting: ##### > > > etc etc.. like WAIT(ch, PULSE_VIOLENCE); send_to_char ("Casting", nums, > > > ch); or something.. ? and each spell have different num of nums? i.e. > > > num++ fer every pulse violence, each pulse violence, the nums goes down > > > one, and once nums = 0, the spell is cast? thank ye fer any help > > Well, I think I understand what he's saying, though it is a little > messy...instead of just having it cast 'blah' <target> and it then say > Okay, and have the wait after it's cast, have it wait before it's cast > and for each wait 'tick' send_to_char "Casting: <spellname>" and after > the wait state cast the spell... Ah-hah, with your help I think I cought on to what he was trying to say. While in my MUD I use messages for delayed spells, what he essentially wanted to do was have a "graphical" representation of the countdown until the spell is cast, like: > cast 'freeze' bob Casting: ######## > Casting: ####### > Casting: ###### > Casting: ##### > Casting: #### > Casting: ### > Casting: ## > Casting: # > Okay. (the spell is finally cast) Whereas I decided upon special messages for the spell routines, he wants it to just count down, display pound signs (#) as it goes. Spell delays, overall, is not very difficult. Here's a general outline of what I did: * Add in an 'int delay;' cast into the spell structure in spells.h * Change spello to include the delay, this is a little time consuming depending upon how many spells you have. Make sure you add the extra zero into the skillo macro and the zeroing of the delay var in unused_skill (or was it unused_spell?). This is all done in the spell_parser.c file. * Add three temporary variables where 'struct char_data *hunting;' is (wherever that structure is in stock CircleMUD): int cast_spellnum; int cast_timer; char *cast_target; * In spell_parser.c again, write a function that updates the spell timer for a character. Essentially, check if they have a spell, if they do, then decrease the timer. Check the target by essentially copying and appropriately removing/reworking the code from do_cast to get the target (this does require a bit of reworking on it). If cast_timer is positive then you'll want to do something like: for (i = 0; i < cast_timer; i++) *(tmp + i) = '#'; Assuming you have 'i' cast as an integer and 'tmp' cast as a char pointer. Then sprintf 'i' into 'buf', and send it out. <grumble> That probably didn't make much sense at all, but then, neither did his original message. I hope you can derive something out of that useful. I did a lot more (including making characters that are casting added onto a caster list [like the in room list] and things). It works alright, but is kind of a pain when it comes to some combat spells that loose their effectiveness because of the delays.
This archive was generated by hypermail 2b30 : 12/18/00 PST