I would recommend not using a new variable to count up the attackers as that is just asking for trouble(as you've seen). Try simple for loop in the perform violence code that checks to make sure there are always 6 or less attackers. It won't use too much cpu time I don't think. This way you save on memory usage, have a smaller playerfile, and you're ALWAYS sure who's attacking whom and the exact count. > what I am trying to do is limit the number of attackers on a mob to 6. I did it > this way: > > in set_fighting(): > > vict->attackers += 1; > > in stop_fighting(): > > ch->attackers -= 1; > > in do_hit(): > > else if (vict->attackers >= 6) { > send_to_char("There's no room to attack!\r\n", ch); > return; > > > the problem with this is that the attackers -= 1 in stop_fighting() doesnt seem > to be working properly. when fleeing, transporting etc the attackers away, the > number isnt decreased but instead seems to stack up so when attacking the mob > again, only one person can attack it. if a second person tries it says "There's > no room to attack!". > > is the error due to a mistake in my added code, or do I need to try out a > totally different concept in order to add this? > -- > /Damian/ > +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 04/10/01 PDT