I have managed to get melee damage to show for the attacker, and the attacked. But I cannot seem to get it for spells. Anyone have any success doing this?
Although I have no idea which version of circleMUD you are using I will take a guess that you put your damage displays in the hit() function. Spells and other non-round combat damage is run through the damage() function.
Right below where I did it for melee hits, I noticed this. But not sure if it is even remotely close to where I need to be to do this for spells/skills.
/* message for doing damage with a spell or skill. Also used for weapon * damage on miss and death blows. */ int skill_message(int dam, struct char_data *ch, struct char_data *vict, int attacktype) { int i, j, nr; struct message_type *msg;
struct obj_data *weap = GET_EQ(ch, WEAR_WIELD);
for (i = 0; i < MAX_MESSAGES; i++) { if (fight_messages.a_type == attacktype) { nr = dice(1, fight_messages.number_of_attacks); for (j = 1, msg = fight_messages.msg; (j < nr) && msg; j++) msg = msg->next
You may have "fight_message" as well as "skill_message". One is for "default" attacks and the other is for attacks listed in the skill table. Spells are the latter, so "skill_message" should be a good place to intercept them. But there's a slight problem if you want the damage to be shown on the same line as the attack message. The function "act" auto-appends CR/LF and accepts a limited number of arguments. The easiest thing to do probably would be to create a modified act_something function to you can pass "dam" to it, and it would print it anywhere you want it in the skill message.
This is a relatively simple task, but let me know how it goes.
/* Set the maximum damage per round and subtract the hit points */ dam = MAX(MIN(dam, 100), 0); GET_HIT(victim) -= dam;
+send_to_char(ch, "[Damage: %d] ", dam);
I'd argue that the easiest way would be to just slap this in the damage() function as it will display the damage before both melee and skill/spell messages.
If you'd wish for the damage to be shown following the attack message then plamzi is correct, as "act" will append the CR/LF and thus any damage display would be shown on the following line. Unless you modified it of course.
Thanks!
Hal