Re: question on adding skills

From: Skylar (
Date: 02/21/95

On Mon, 20 Feb 1995, Stefan Rensing wrote:

> 1. If I add a do_command type skill (retreat in that case) I can
> type the command despite it is not learned, it just wont succeed -
> is this the supposed behaviour ?
Erm... I dunno if its the "supposed" behaviour or not, but I personally
like it this way. -- It lets you make NPC's use stills and such, not
to mention it really is a little unreal to say tell someone they cant
even attempt to do something because they arent proficient at it :)
Anyways, if you dont want someone using a skill before they've practiced
it, just stick something like this at the top;

   send_to_char("You dont know how to retreat!\r\n", ch);

> 2. I added second attack by adding a skill prob call in fight.c
> and it works fine but sometimes the mud crashes :(
> I do not know whether or not I have to add a second attack line in
> the master command list in interpreter.c (actually I have, it looks
> like this:

You dont need this entry in interpreter.c unless you want people to
actually be able to type it in as a command.

>   { "second attack" , POS_FIGHTING , do_hit , 0 , SCMD_HIT },
> and, btw, can someone explain the last two fields of these lines ?)

The second to last field is the minimum level to use the command, and
the last field is for special args or switches I guess... for multi-purpose
commands such as go_gen_com -- take a look at how shout and gossip work.

> The added code in fight.c is (in perform_violence):
>     if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room)
>       stop_fighting(ch);
>     else {
>       hit(ch, FIGHTING(ch), TYPE_UNDEFINED);

I think just about everyone who's added multiple attacks has run into
this problem ... the only thing you need to do is make doubly sure that
the combatants have not died, fled, been summoned or for some other reason
been removed from the room and thus the fight.

>       percent = number(1, 101);                  /* added this */
>       prob = GET_SKILL(ch, SKILL_SECOND_ATTACK);

>       if (percent < prob) 
I would change the previous line to look something like this:

  if (percent < prob && FIGHTING(ch) && ch->in_room == FIGHTING(ch)->in_room)

This should keep the game from attempting to hit someone who's not there and
causing a segmentation fault.

>         hit(ch, FIGHTING(ch), TYPE_UNDEFINED);  /* until here */

Hope this helps ya...

This archive was generated by hypermail 2b30 : 12/07/00 PST