First-off, the aggressive flag is crap in my opinion. The best way to achieve something like this is to not use that flag altogether. Instead, use a mobprog that does the same thing. In that mobprog, just have it perform an ifcheck based on the victim player's level. If you really insist on doing this with that antiquated flag, find the part of the source code in which a mob with that flag initiates combat with the player (I couldn't find it myself; but then again, I didn't look very hard either). When you find that code, put the comat initiation within an ifcheck that goes something like: if ( victim->level > (ch->level - 15) )
You would need to modify that ifcheck depending on the context of the code in which you end up placing that. For example, it may be vch instead of victim. ch->level in this case would be the mob's level. The ifcheck basically states that if the victim's level is greater than 15 levels less than the mob's level (i.e. the mob is less than 15 levels higher than the player), then go ahead and do the aggr initiate combat thing. But I would really suggest just using mobprogs for that stuff, since they're much more customizeable for each situation.
As for casting a spell from one room to another, yah that's very possible. The details of the spell and what-not will have to be worked-out by you of course, but here's the general concept of doing something from one room into the next (like casting a fireball to the room south or whatever). Notice in act_info.c, the do_look function. You know that you can 'look east', 'look south', etc, so naturally something to that effect would be in do_look. Here's the ifcheck I found on line 1229 (it'll be on a different line for you, as I've modified act_info.c so much):
door = get_door(arg1);
if ( (pexit=find_door(ch, arg1, TRUE)) != NULL )
This ifcheck uses get_door to determine if arg1 (what you type after 'look') points to a valid exit for that room. Find that code, so you can look at the details. It then goes on for a bit checking if the door is closed, the room has the private flag set, etc. After all that, you get to the part that really counts:
original = ch->in_room;
char_from_room( ch );
char_to_room( ch, pexit->to_room );
do_look( ch, "auto" );
char_from_room( ch );
char_to_room( ch, original );
This code temporarily moves the player to the target room (similar to the immortal 'at' command). The do_look( ch, "auto" ); makes the player actually in that room. You would replace that with the code to cast the spell. The last 2 lines move the player back into his original room. Now, of course, you can put in some other stuff to give the illusion that the player is actually standing there, casting a ball of flame south, or whatever, instead of the player just appearing in the room and casting the spell.
I hope that helps :)
--Kris
P.S. If that is helpful to you, please feel free to visit my mud's website at www.aethia.org (I hope Nick doesn't mind me putting that there). |