Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Combat System
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Harsk
USA (47 posts) Bio
|
Date
| Sat 15 Dec 2001 11:02 AM (UTC) |
Message
| I was wondering where if fight.c the combat system is handled. What I want to do is change they way combat is handled, so that lowlevel characters don't get stuck inside rooms with a high level aggro mob and end up killed. I've looked through it, but can't really make heads or tails of it (that, or I'm just tired). Any help would be greatly appreciated.
Also, I would like to know if it would be possible to code in ranged attacks. IE: your in a room north of the room that a mob is in. You want to fire a ranged weapon south into that room to attack said mob. Also, you want it so that when that character that made the ranged attack enters the room soon after finds themselves in close quarters combat with the attacked mob. If anyone knows how to do this, please let me know. Or, if anyone knows of a snippet that will do this, again, let me know. Thanks. | Top |
|
Posted by
| Kris
USA (198 posts) Bio
|
Date
| Reply #1 on Sat 15 Dec 2001 09:58 PM (UTC) |
Message
| 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). | Top |
|
Posted by
| Harsk
USA (47 posts) Bio
|
Date
| Reply #2 on Mon 17 Dec 2001 12:04 AM (UTC) |
Message
| OK, that helped with getting it set up so that players can fire missile weapons and spells into another room. However, in some cases you will want aggressive mobs. I should have been a little clearer on what I was asking, so here it is.
Player A starts combat with mob A, player A then decides to leave the room. While the flee command is usefull, it often poses serious risks to the player. So instead of useing flee or recall, the player can then just leave the room from where they came from just by typeing in that direction. Hence, the character does not loose any experience after leaving the room, and can reenter the room to continue the fight. I allready have it set up so that the mob will recognize its attacker, and renew the fight. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,386 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top