I have a problem with an animate dead spell im trying to imp on my mud. Ill paste it here, pardon me if there is some line wraps: ASPELL(spell_animate_dead) { struct affected_type af; struct obj_data *corpse, *next_corpse, *object, *next_object; struct char_data *skeleton, *skeleton_proto; int any_to_animate = FALSE, roll = 0, lvl_variable = 0; if (ch == NULL) return; for (object = world[ch->in_room].contents; object; object = next_object) { next_object = object->next_content; if ((GET_OBJ_TYPE(object) == ITEM_CONTAINER) && GET_OBJ_VAL(object, 3)) { any_to_animate = TRUE; break; } else continue; } if (any_to_animate == FALSE) { send_to_char("There are no corpses in the room to animate!\r\n", ch); return; } skeleton_proto = read_mobile(SKELETON, VIRTUAL); for (corpse = world[ch->in_room].contents; corpse; corpse = next_corpse) { next_corpse = corpse->next; if (corpse == NULL) break; if ((GET_OBJ_TYPE(corpse) == ITEM_CONTAINER) && GET_OBJ_VAL(corpse, 3)) { extract_obj(corpse); char_to_room(skeleton_proto, ch->in_room); skeleton = skeleton_proto; lvl_variable = dice(level, 2) + 10; skeleton->points.max_hit = lvl_variable; skeleton->points.hit = lvl_variable; lvl_variable = level / 10; skeleton->points.armor = 6 - lvl_variable; skeleton->player.level = lvl_variable; af.type = SPELL_CHARM; af.duration = GET_WIS(ch) * 3; af.modifier = 0; af.location = 0; af.bitvector = AFF_CHARM; affect_to_char(skeleton, &af); REMOVE_BIT(MOB_FLAGS(skeleton), MOB_AGGRESSIVE); if (skeleton->master) stop_follower(skeleton); add_follower(skeleton, ch); skeleton->master = ch; } else continue; } send_to_char("You animate the corpses in the room!\r\n", ch); act("$n animates the bodies in the room!", TRUE, ch, 0, 0, TO_ROOM); return; } Ok, now before you jump on me for "well, it would depend on a lot of stuff", it does work when animating just one corpse. However, when it falls into the for loop for more than one corpse, it will hang. I believe it is the loop conditions itself that is causing it to crash, but give me some input back on what you see. Franco
This archive was generated by hypermail 2b30 : 12/07/00 PST