JEREMY IRISH wrote: > > HELP! > > Basically, what I want to do is make a random number, check if a mobile has that number and > exists in the world, and return the mobile to make checks on it (AFF_NOSUMMON, etc). As a > newbie, I'm having a terrible time with this. This code will eventually be used for random > quests. > Well this is what I use for my randomly generated quest system.... temp=number(1,top_of_mobt); for (questmob = character_list; questmob; questmob = questmob->next) if(GET_MOB_RNUM(questmob)==temp) if (CAN_SEE(ch, questmob) && questmob->in_room != NOWHERE && (!IS_SET(MOB_FLAGS(questmob),MOB_NOTARGET))) { found = 1; break; }else { temp=number(1,top_of_mobt); questmob = character_list; } not the nicest of code but it works, one problem if no suitable mobs are found (EXTREMELY unlikely) then you get an infinite loop :( Chris +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list_faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST