Hrm, I might be mildy confused so help me out here. Players create these
objects that cast various spells, blast of fireball what not correct? Now
you don't want to give that player experiance for dealing that damage?
Granted he only created the thing, but if it hadn't it wouldn't have killed
the other person.

As far as taking them into a round of combat. Add to your damage function
where it has the victim strike back, a check to see if the victim is in the
same room as the ch.

if (victim->in_room == ch->in_room)
// put information here for an ok attack.

That will clean up the round of battle if their not in the same room.

As for exp you could do the same kind of check right where it calls
gain_exp... But read the top of the email first :P

You could always alter your obj_cast_spell to accept a NULL ch pointer, just
make sure that if (ch == NULL) then don't do things like ch->level or
get_trust(ch);

It's pretty simple to mod a function like that to accpet a NULL ch. Then
when it does get a NULL ch you can have it act as if it was setting itself
off.

Remeber that if you do go with a void * pointer approch that you have some
sort of way to have it tell the differance of when it needs to make that
void * a char or an object.... Something like an int with ATTACK_FROM_OBJ or
ATTACK_FROM_CH.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 29, 2004 1:50 AM
Subject: Help with a spell concept/implementation.


Sorry if this is a little long, sometimes it takes me a bit to get to the
point.
I'm running a slightly modified version of QuickMUD and I'm trying to make a
'delayed blast fireball' type spell and at the same time, modify the code in
such a way as to allow me to easily create other spells in the same vein,
such
as a delayed blast curse or a delayed blast heal.

I have coded a spell that functions correctly to a point.  In order to have
the
object cast the spell, obj_cast_spell needs to have a ch thats operating the
object passed to it.  If the item is just sitting in a room somewhere, there
is
no char_data connected with it so it will go off but not cast any spells.
To
remedy this, I added a new field to OBJ_DATA that stores the ch of whoever
created the item.  This is passed to the function when the item goes off so
that spells will be passed correctly.  The problem with this is that, when
the
item goes off and the creator of the item is in another room, they will see
all
the damage messages from the spell and will be entered in one round of
combat
with the chars in a completely different room.  Or, if the spells kill
things
in a different room, the char will recieve exp from fights in a different
room.
 This is what I do not want to happen.  Since the spell will hit its' caster
as
soon as it will hit anything else, I don't see the need to have the gem
actually initiate combat.

I have thought of a few scenarios for fixing this but all are fairly complex
and
I wanted to get some other, more experienced opinions on which route I
should
take.
 The first thing I thought of was to create a new function patterend on
the function damage that accepted an obj instead of a ch as the attacker,
but
then I could not utilize current spells, attack information would have to be
stored on the item itself.
The second thing I thought of would be to, since I plan on rewriting most of
the
spells anyways, was to change all the spells to accept a void pointer as the
caster, so the caster could be an object and to modify damage() in the same
way.
 This way is the most work intensive, but also offers me the flexibility I
am
seeking.
If anyone could tell me what they think, or offer some suggestions, I would
appreciate it.

Brian


-- 
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom



Reply via email to