This is how I implemented multiple attacks on my mud:
When you call perform_violence() (in the heartbeat() function in pl11),
call it once for each attack you have with the attack number as argument, ie:
perform_vilence(1); /* for attack #1 */
perform_vilence(2): /* for attack #2 */
/* and so on... */
And my perform_violence() looks something like this (taken from head):
void perform_violence(int attack)
{
/* variable declaration */
struct char_data *ch;
for (ch = combat_list; ch; ch = ch->next_fighting)
{
/* misc stuff to check positions and such */
/* the old hit() statement */
/* hit(ch, FIGHTING(ch), TYPE_UNDEFINED); */
switch (attack)
{
case 1:
percent = number(1, 101);
prob = GET_SKILL(ch, SKILL_ATTACK1);
if (percent > prob)
{
hit(ch, FIGHTING(ch), TYPE_UNDEFINED,
attack);
}
break;
case 2:
percent = number(1, 101);
prob = GET_SKILL(ch, SKILL_ATTACK1);
if (percent > prob)
{
hit(ch, FIGHTING(ch), TYPE_UNDEFINED,
attack);
}
break;
/* and so on */
}
}
}
As you can see, I added a new argument to the hit() function, the attack
number.
Well, I hope this makes some sense and helps some of you out there :)
/ Joachim Pileborg
---------------------------------------------------------------------
The Arrow Moses@PTMUD sargasso.fukt.hk-r.se 4000
Joachim Pileborg Email: pt94jpi@pt.hk-r.se
Svarvarevägen 5
37230 Ronneby http://www.pt.hk-r.se/~pt94jpi/pt94jpi.html
SWEDEN
---------------------------------------------------------------------
This archive was generated by hypermail 2b30 : 12/18/00 PST