I think this could be achieved without much problem. I don't know much about C either, but after modifying the src for almsot a year now, I pretty much have a nack for it (and when I'm stuck, I can always run to good-ol Nick here).
I assume that death_cry (I haven't payed much attention to that) is whatever the mob screams out when it dies. That is done as an echo to the room. If you want it to echo 2 rooms away, you'll have to have it first use the code from do_exits to see what the exits for the room are, and what vnums they correspond to. Then, for each of those exits, you'd have to see what exits are from each of those rooms, and the corresponding vnums. Then, you'd have it echo to each of those rooms. This is just a general concept; I will now look at the source (since I'm bored), and see what exactly would need to be done to accomplish this. Please keep in mind that somebody could probably do this a lot more efficiently, and my method may cause a millisecond or three more lag than someone else's method might, but this should still work ok (you'll have to test it and let me know).
....
Well after reading your post again I realize that death_cry does in fact already echo to the surrounding rooms, and you'd like it to be 2 rooms away instead of one (I noticed this when reviewing the code). That'll make this easier than I initially thought :)....
In fight.c, in function death_cry, you'll notice the lines:
was_in_room = ch->in_room;
for ( pexit = was_in_room->first_exit; pexit; pexit = pexit->next )
{
if ( pexit->to_room
&& pexit->to_room != was_in_room )
{
ch->in_room = pexit->to_room;
act( AT_CARNAGE, msg, ch, NULL, NULL, TO_ROOM );
}
}
ch->in_room = was_in_room;
The first line sets was_in_room to the vnum of the room you're currently in (so it essentially remembers the room you're in). Then, it temporarily puts the mob into each of the surrounding rooms, echoes the msg to each of the rooms, then puts the mob back into its original room, where it can finish dying. So, to have it do this 2 rooms away instead of just one, you'd just copy this code, paste it inside the inner-most ifcheck (where the mob is currently in each surrounding room), and change the variables of course. This will make it so the mob then does the same thing to each of the surrounding rooms for each surrounding room. So, in effect, the death_cry is being displayed 2 rooms away.
Here's what you need to do to the code. First, add these 2 variable definitions to the top of the function where the other variables are defined:
ROOM_INDEX_DATA *was_in_room2;
EXIT_DATA *pexit2;
Then, replace the big block of code I mentioned earlier with this:
was_in_room = ch->in_room;
for ( pexit = was_in_room->first_exit; pexit; pexit = pexit->next )
{
if ( pexit->to_room
&& pexit->to_room != was_in_room )
{
ch->in_room = pexit->to_room;
act( AT_CARNAGE, msg, ch, NULL, NULL, TO_ROOM );
was_in_room2 = ch->in_room;
for ( pexit2 = was_in_room2->first_exit; pexit2; pexit2 = pexit2->next )
{
if ( pexi2t->to_room
&& pexit2->to_room != was_in_room2 )
{
ch->in_room = pexit2->to_room;
act( AT_CARNAGE, msg, ch, NULL, NULL, TO_ROOM );
}
}
}
}
ch->in_room = was_in_room;
I'm sure you can see what I'm doing here. This -should- work, however I haven't tested it on my mud (since my source code is a tangled mess with my almost-finished pskills system). So if you have any problems, please reply to this post. Otherwise, please feel free to visit my website (www.aethia.org) and/or email me at: kris@aethia.org.
I hope this helps :) |