02 Dec, 2006, cbunting wrote in the 1st comment:
Votes: 0
Hey all,

I've been messing around making various changes to info that is
displayed during the fighting. I've had an idea that I saw awhile
back on another mud but no matter how I write the code, it doesn't
seem to work.

I've been working with the void dam_message( at the end of all of the
else if's. What I'm trying to do is to diplay my own last message
type of thing..

EG:

Your chop mauls a gnome child.
A gnome child's hit wounds you.
Your chop sends a gnome child to his grave!
A gnome child is dead.
Your recive 1 exp..

I know that is a bland example but I'm having a brain freeze I assume
cause I just can't figure it out. I've tried about 100 variations of
code like this.

Remember, I put this below all of the else if checks. I've either had
it show for each and every hit or not at all. I just want it to show
upon the death of the victim and not the normal

Your chop mauls a gnome child.
A gnome child is dead.

Here is a mini version of what I was trying to do.

if ( victim->max_hit == 0 ) { vp = "to his grave"; }


Anyone have any ideas?

Thanks,
Chris
02 Dec, 2006, Aidan wrote in the 2nd comment:
Votes: 0
if(victim->position == POS_DEAD && victim->hit <= 0)
vp = "to his grave.";

Easy as that. :)
02 Dec, 2006, Skol wrote in the 3rd comment:
Votes: 0
Chris, I wasn't sure which base you're working with, but look for the death_cry or something along those lines perhaps?
Another way to do it is in the damage function, ie something like 'if (dam > victim->hit) etc, then gather the damage type, and a random message about killing (maybe a switch statement with like 10 variations based on amount of damage OVER the hp left?).

Anyway, just thoughts. Sounds like a fun bit to play with.
02 Dec, 2006, Zeno wrote in the 4th comment:
Votes: 0
Aidan said:
if(victim->position == POS_DEAD && victim->hit <= 0)
vp = "to his grave.";

Easy as that. :)


But won't that also trigger if someone else kills the mob you're fighting?
03 Dec, 2006, Aidan wrote in the 5th comment:
Votes: 0
Zeno said:
Aidan said:
if(victim->position == POS_DEAD && victim->hit <= 0)
vp = "to his grave.";

Easy as that. :)


But won't that also trigger if someone else kills the mob you're fighting?


Yes it will Zeno, however, the death message in dam_message is setup to send it out to who it's supposed to. It's up to Chris to make sure he sets the message in the right place. I was working off of the information he provided.
03 Dec, 2006, cbunting wrote in the 6th comment:
Votes: 0
Hello All,
Thanks for the replies. I did try it before using the position == POS_DEAD.. But I guess the problem is that the vitims position isn't updated until after dam_message which is set in death_dry. I looked at death_cry but was focused on dam_message since I am trying to get that message to display at the end of the fight.

Other example, basicly the same thing I'm trying to do is this. On a mud I used to play, the very last hit would say

You pierce a vicious dragon with terminal brutality.
You get some exp for the kill!

I have all the needed code in place, just can't get that last message to show.

BTW, I'm using the Merc 2.2 codebase
03 Dec, 2006, Aidan wrote in the 7th comment:
Votes: 0
So replace the code where it gives the random messages.

IE: $n hits the ground…dead.
04 Dec, 2006, cbunting wrote in the 8th comment:
Votes: 0
Hello,
I thought about that as well but then the problem is that attack, endit, and vp are not called within the death_cry, only within the dam_message. This is why I figured that dam_message is where the code would go.

EG:

else if ( dam <=  1000 ) { vp = "<<< ERADICATING >>>";		}
else { vp = "***EXTREMELY ILLEGAL***"; }

if ( dam == 0 ) { endit = "intensity"; }
/* else if(victim->position == POS_DEAD) { vp = "terminal"; endit = "brutality"; } */
else
switch(number_range(0,9))
{
default: { endit = "intensity"; } break;
case 0: { endit = "viciousness"; } break;
case 1: { endit = "strength"; } break;


Maybe showing some of the code will give a better idea. The commented out part is what I can't get working either because the position is yet updated to dead at this point or ch->hit = 0 doesn't seem to work either.

Thanks for all of your help,
Chris
04 Dec, 2006, kiasyn wrote in the 9th comment:
Votes: 0
try char_died(victim)
04 Dec, 2006, cbunting wrote in the 10th comment:
Votes: 0
Hello all,
I guess 've been messing with too much and the little things seem to slip my mind. I do have this working now although it only seems to work about 90% of the time. Other times, it's not the last thing that is shown, just the normal dam_message.

else if ( dam > victim->hit ) { vp = "terminal"; endit = "brutality";	}


I still am not sure if this is the right way to do it though.

Thanks again,
Chris
04 Dec, 2006, Justice wrote in the 11th comment:
Votes: 0
Just skimming the posts, but you might want to try (dam >= victim->hit)

Although some muds use an incapacitated state between 0 and -10 hp or so.
0.0/11