Milena - If you want the mupltiple attacks to operate in the same fashion as the first attack a player gets (ie checks for a hit, does damage, etc....meaning the second or third hits are independant of the first) then the best place (If I remember DIKU correctly) is in fight.c in the perform_violence routine. (As below) /* control the fights going on */ void perform_violence(void) { struct char_data *ch; for (ch = combat_list; ch; ch = combat_next_dude) { combat_next_dude = ch->next_fighting; assert(ch->specials.fighting); if (AWAKE(ch) && (ch->in_room == ch->specials.fighting->in_room)) { hit(ch, ch->specials.fighting, TYPE_UNDEFINED); } else { /* Not in same room */ stop_fighting(ch); } } } You should modify this function to include the check for a possible multiple attacks. I wrote a quick example below. (disclaimer: this is only one way of doing it, and not necessarily the best) /* control the fights going on */ void perform_violence(void) { struct char_data *ch; for (ch = combat_list; ch; ch = combat_next_dude) { combat_next_dude = ch->next_fighting; assert(ch->specials.fighting); /* every creatures god given right to attack once a round */ if (AWAKE(ch) && (ch->in_room == ch->specials.fighting->in_room)) { hit(ch, ch->specials.fighting, TYPE_UNDEFINED); } else { /* Not in same room */ stop_fighting(ch); } /* See if the character gets a second attack */ if (AWAKE(ch) && (ch->in_room == ch->specials.fighting->in_room) &&\ <some formula to determine if gets second attack goes here>) { hit(ch, ch->specials.fighting, TYPE_UNDEFINED); } else { /* Not in same room */ stop_fighting(ch); } /* See if the character is really luck and gets third attack */ if (AWAKE(ch) && (ch->in_room == ch->specials.fighting->in_room) &&\ <some formula to determine if gets third attack goes here>) { hit(ch, ch->specials.fighting, TYPE_UNDEFINED); } else { /* Not in same room */ stop_fighting(ch); } /* See if the ch gets the golden egg and the accompanying 4th attack */ if (AWAKE(ch) && (ch->in_room == ch->specials.fighting->in_room) &&\ <some formula to determine if gets fourth attack goes here>) { hit(ch, ch->specials.fighting, TYPE_UNDEFINED); } else { /* Not in same room */ stop_fighting(ch); } } } Again this may not be exactly what you want, since it's possible for a character to fail his second attack check, but still get 3 attacks that round. Nest these hit checks/commands to stop checking for more attacks if the player fails any of the other checks. I implemented this for one DIKU a few years ago, and the function I used to determine whether or not the player got another attack was something like: (On an 80 level system...) (MAX(1,((player_level) - (25 * numberofpreviousattacks) - (penalty for being hurt bad) - (penalty for high encumbrance) + (bonus for a high dexterity + (bonus for opponent hurt bad)) > num(1,100)) In english what that say is if the number generated by num() is less than the formula, the player gets another attack. The MAX() macro is there to give each player at the very least a 1% chance at another attack. Wow...hope this long thing helps *someone* out! ==================================================================== Christopher Herringshaw Networking and Special Projects Division Medical Center Information Technology (MCIT) xxviper@med.umich.edu University of Michigan Medical Center, B1911 CFOB 1414 Catherine Street, Ann Arbor, MI 48109-0704 (313) 747-2778 ==================================================================== On Wed, 14 Sep 1994, Milena R. Johnson wrote: > > Can anybody tell me how and where to put in code for a second, third > and fourth attack for pc's and npc's? If that's too much to ask for, > can you at least point me in the right direction as to how to make it > work. > > Lo > mrj1@ra.msstate.edu > >
This archive was generated by hypermail 2b30 : 12/07/00 PST