Well here it is ... my multi-hit code but its actually someone elses multi-hit code that I edited to suit my needs... not such a biggie to ad anyway... just set up 2 new skills second attack and third attack and allow warriors to prac them (or any other warrior classes you have) - perhaps second attack for rogues (thiefs). that part goes like this: 1: in --- spell_parser.c --- add two new fields to the *spells[] list: > "second attack", > "third attack", 2: in --- spell_parser.c --- add two new spello function calls: > skillo(SKILL_SECOND_ATTACK ); > skillo(SKILL_THIRD_ATTACK ); 3: in --- spells.h --- add new defines for these two skills, something like: > #define SKILL_SECOND_ATTACK 142 > #define SKILL_THIRD_ATTACK 143 4: in --- class.c --- assign levels to these two skills: (something like:) /* * do this with all the other spell_level finction calls... * * WARNING: if you have pl8 or lower you will have to do this with the * spello function calls in spell_parser.c (old system for assigning * spell and skill levels for classes) */ > spell_level(SKILL_SECOND_ATTACK, CLASS_WARRIOR, 2); > spell_level(SKILL_THIRD_ATTACK, CLASS_WARRIOR, 7); I think thats about it for defining new skills - if I skipped anything you should be able to fill in the blanks... :-) (sorry if I did) Now for the main part of the multi-hit code (simple as it may be): 1: in --- fight.c --- change the perform_violence function to something like: (read my commends between the code lines - but dont add those to your) (source :-))) at least not thise in ( and ) brackets - they are NOT ) (part of the code ) > /* control the fights going on. Called every 2 seconds from comm.c. */ > void perform_violence(void) > { > struct char_data *ch, *k; > struct follow_type *f; > extern struct index_data *mob_index; (add this variable for counting number of attacks) > sh_int attacks; > > for (ch = combat_list; ch; ch = next_combat_list) { > next_combat_list = ch->next_fighting; > (primitive system to set npc number of attacks per round depending on their ) (level, later I'll set it differently based on some other changed I plan to do) ( ) (player characters set their number of attacks based on their knowledge of ) (previously defined skills second attack and third attack this I plan to ) (change so that the chance for player succiding (however this is spelled) ) (in doing the second and third attack is based on his/her level. ) > attacks = 1; > if (IS_NPC(ch)) { (here set the level dependency of the mob's number of attacks - my mud has) (100 levels so its atm like this ) > if (GET_LEVEL(ch) > 20) attacks = number(1, 2); > if (GET_LEVEL(ch) > 40) attacks = number(1, 3); > if (GET_LEVEL(ch) > 60) attacks = number(2, 3); > if (GET_LEVEL(ch) > 80) attacks = number(2, 4); > } else /* PC */ > if (number(1, 100) <= GET_SKILL(ch, SKILL_SECOND_ATTACK)) { > attacks++; > if (number(1, 100) <= GET_SKILL(ch, SKILL_THIRD_ATTACK)) > attacks++; } > > while(attacks-- > 0) { > if (!FIGHTING(ch) || (ch->in_room != FIGHTING(ch)->in_room)) { > stop_fighting(ch); > continue; > } > > if (IS_NPC(ch)) { > if (GET_MOB_WAIT(ch) > 0) > GET_MOB_WAIT(ch) -= PULSE_VIOLENCE; > GET_MOB_WAIT(ch) = 0; > } > (next three lines are my fix for a little bug with the sleep spell - if its) (cast on someone while that person's fighting ) > /* sleep spell stops working in a fight */ > if (IS_AFFECTED(ch, AFF_SLEEP)) > affect_from_char(ch, SPELL_SLEEP); > > /* automatically stand up in a fight */ > if (GET_POS(ch) < POS_FIGHTING) { > GET_POS(ch) = POS_FIGHTING; > act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM); > send_to_char("You scramble to your feet!!\r\n", ch); > continue; > } > (don't add this code for group attack - it has some changes that require much) (more changing all around the circle mud code - it allows for groups to ) (automatically assist and is compatible with my system for circular following) (if you want I can send you this code aswell but some other time... ) > /* group automatically attacks in a fight */ > if (IS_AFFECTED(ch, AFF_GROUP)) { > k = (IS_LEADER(ch) ? ch : ch->master); > > assert(IS_LEADER(k) && IS_AFFECTED(k, AFF_GROUP)); > > if ((ch != k) && (k->in_room == ch->in_room) && !FIGHTING(k)) > hit(k, FIGHTING(ch), TYPE_UNDEFINED); > > for (f = k->followers; f; f = f->next) { > if (IS_AFFECTED(f->follower, AFF_GROUP) && !IS_LEADER(f->follower) && > (f->follower != ch) && !FIGHTING(f->follower) && > (f->follower->in_room == ch->in_room)) > hit(f->follower, FIGHTING(ch), TYPE_UNDEFINED); > } > } (group attack code is upto here) > > hit(ch, FIGHTING(ch), TYPE_UNDEFINED); > if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL) > (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""); > } > } > } I think this is all... if it by any chance doesn't work or you want any more help just mail me... Jurko (jgospod@public.srce.hr)
This archive was generated by hypermail 2b30 : 12/07/00 PST