Fix syserror messages on start related to msave

This commit is contained in:
kinther 2025-09-25 09:13:24 -07:00
parent df3c3d5395
commit b9acbbba9f
3 changed files with 12 additions and 7 deletions

View file

@ -1726,6 +1726,7 @@ ACMD(do_load)
for (i=0; i < n; i++) {
mob = read_mobile(r_num, REAL);
char_to_room(mob, IN_ROOM(ch));
equip_mob_from_loadout(mob);
act("$n makes a quaint, magical gesture with one hand.", TRUE, ch, 0, 0, TO_ROOM);
act("$n has created $N!", FALSE, ch, 0, mob, TO_ROOM);

View file

@ -2472,6 +2472,10 @@ void equip_mob_from_loadout(struct char_data *mob)
{
if (!mob || !IS_NPC(mob)) return;
/* If called too early (e.g., from some future path), just do nothing. */
if (IN_ROOM(mob) == NOWHERE)
return;
mob_rnum rnum = GET_MOB_RNUM(mob);
if (rnum < 0) return;
@ -2589,9 +2593,6 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
mob->script_id = 0; // this is set later by char_script_id
/* Equip/load items from prototype loadout before scripts fire */
equip_mob_from_loadout(mob);
copy_proto_script(&mob_proto[i], mob, MOB_TRIGGER);
assign_triggers(mob, MOB_TRIGGER);
@ -2754,13 +2755,15 @@ void reset_zone(zone_rnum zone)
case 'M': /* read a mobile */
if (mob_index[ZCMD.arg1].number < ZCMD.arg2) {
mob = read_mobile(ZCMD.arg1, REAL);
char_to_room(mob, ZCMD.arg3);
mob = read_mobile(ZCMD.arg1, REAL);
char_to_room(mob, ZCMD.arg3);
/* NEW: equip from prototype loadout now that the mob is in a room */
equip_mob_from_loadout(mob);
load_mtrigger(mob);
tmob = mob;
last_cmd = 1;
last_cmd = 1;
} else
last_cmd = 0;
last_cmd = 0;
tobj = NULL;
break;

View file

@ -377,6 +377,7 @@ ACMD(do_mload)
return;
}
char_to_room(mob, rnum);
equip_mob_from_loadout(mob);
if (SCRIPT(ch)) { /* It _should_ have, but it might be detached. */
char buf[MAX_INPUT_LENGTH];
sprintf(buf, "%c%ld", UID_CHAR, char_script_id(mob));