I've written a little bit of code to preform autoassist, borrowing from do_group. I'd like to hear if there are any potential problems, better ways of implimenting it, or additional idea's. Working with Circle3.0 bpl12 I added in structs.h #define PRF_AUTOASSIST (1 << 22) /* Will autoassist in group combat */ I added an autoassist command and made the needed changes to do_gen_tog to flip the flag and present the text. Then in fight.c, I added the following code to set_fighting() at the very end. (borrowed and modified from the do_group code) struct char_data *k; struct follow_type *f; [... set_fighting code ...] if (!pk_allowed) check_killer(ch, vict); /* Preform AutoAssist */ /* Right now I don't want NPC's to autoassist, I may change that or use spec_proc's for NPC groups and assisting. */ if (IS_AFFECTED(ch, AFF_GROUP) && !IS_NPC(ch) ) { k = (ch->master ? ch->master : ch); /* Find the master */ /* Not an NPC, Not Yourself, Not Fighting, Above standing */ if (!IS_NPC(ch) && k != ch && GET_POS(k) == POS_STANDING) { if(PRF_FLAGGED(k, PRF_AUTOASSIST)) { /* If he is flagged to assist */ k->next_fighting = combat_list; /* Master assists a follower */ combat_list = k; FIGHTING(k) = vict; GET_POS(k) = POS_FIGHTING; } } for (f = k->followers; f; f = f->next) { if (!IS_AFFECTED(f->follower, AFF_GROUP) || IS_NPC(f->follower) || (f->follower == ch) || GET_POS(f->follower) < POS_STANDING) continue; /* Skip if any of these are true */ if(PRF_FLAGGED(f->follower, PRF_AUTOASSIST)) { f->follower->next_fighting = combat_list; combat_list = f->follower; /* Follower Assists Group */ FIGHTING(f->follower) = vict; GET_POS(f->follower) = POS_FIGHTING; } } } } /* set_fighting closes */ Right now it seems to work. I do not want player who was sitting or sleeping automatically join the combat if he stands. One thing I was still wondering is if it would be possible to call do_assist for the player, or if I should just place the act()'s in the above code. Please point out any problems, mistakes, or improvements, would be greatly apprechiated. Thanks in advance -Balif at Nacs.Net +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST