void do_mortality( CHAR_DATA *ch, char *argument )
{
    char arg[MIL];
    char buf[MIL];

    if (IS_NPC(ch))
     return;

    set_char_color( AT_IMMORT, ch );

    argument = one_argument( argument, arg );
    if ( arg[0] == '\0' && (!IS_IMMORTAL(ch) && ch->tmplevel < 51))
    {
	send_to_char( "Huh?\n\r", ch );
	return;
    }
    if (IS_IMMORTAL(ch))
    {
     if (is_number(arg))
     {
      sh_int level;
     level=atoi(arg);   
     if ( level > ch->level || level < 2 )
     {
	send_to_char( "Invalid Level.\n\r", ch );
        return;
     }

     ch->tmplevel = ch->level;   
     ch->tmptrust = ch->trust;
     ch->level = level;   
     ch->trust = 0;
     if ( xIS_SET(ch->act, PLR_WIZINCOG) )
       xREMOVE_BIT(ch->act, PLR_WIZINCOG);
     if ( xIS_SET(ch->act, PLR_WIZINVIS) )
       xREMOVE_BIT(ch->act, PLR_WIZINVIS);
     save_char_obj(ch);
     }
     else
     {
     ch->tmplevel = ch->level;   
     ch->tmptrust = ch->trust;
     ch->level = 50;   
     ch->trust = 0;
     if ( xIS_SET(ch->act, PLR_WIZINCOG) )
       xREMOVE_BIT(ch->act, PLR_WIZINCOG);
     if ( xIS_SET(ch->act, PLR_WIZINVIS) )
       xREMOVE_BIT(ch->act, PLR_WIZINVIS);
     save_char_obj(ch);
     }
     act( AT_PLAIN, "$n coalesces into a mortal avatar.", ch, NULL, NULL, TO_ROOM );
     act( AT_PLAIN, "You coalesce into a mortal avatar.", ch, NULL, NULL, TO_CHAR );

     if (!str_cmp(argument, "broadcast") || !str_cmp(arg, "broadcast"))
     {
      sprintf(buf, "%s has taken on a Mortal avatar within the realms.", ch->name);
      echo_to_all(AT_IMMORT, buf, ECHOTAR_ALL);  
     }   
     return;
    }
    if (!IS_IMMORTAL(ch) && ch->tmplevel > 50)
    {
    ch->level = ch->tmplevel;   
    ch->trust = ch->tmptrust;
    ch->tmplevel = 0;   
    ch->tmptrust = 0;
    save_char_obj(ch);
    act( AT_PLAIN, "$n returns to a immortal state.", ch, NULL, NULL, TO_ROOM );
    act( AT_PLAIN, "You return to your immortal state.", ch, NULL, NULL, TO_CHAR );
     if (!str_cmp(argument, "broadcast") || !str_cmp(arg, "broadcast"))
     {
      sprintf(buf, "%s ascends into the heavens once more.", ch->name);
      echo_to_all(AT_IMMORT, buf, ECHOTAR_ALL);  
     }   
    return;
    }
   else
	send_to_char( "Huh?\n\r", ch );
    return;
}


changes needed to enact this:

in mud.h add to char_data:
    sh_int		tmplevel;
    sh_int		tmptrust;


And create the macro:
#define WAS_IMMORTAL(ch)	(!IS_NPC((ch)) && (ch)->tmplevel > 50)

in save.c in fwrite_char add:
    if (ch->tmplevel > 50)
      fprintf( fp, "tmpLevel        %d\n",	ch->tmplevel		);
    if (ch->tmptrust > 50)
      fprintf( fp, "tmpTrust        %d\n",	ch->tmptrust		);

Also in fwrite_char change the immortal data check to:
	if ( IS_IMMORTAL( ch ) || WAS_IMMORTAL(ch))

and to fread_char in case T add:
	    KEY( "tmpTrust", ch->tmptrust, fread_number( fp ) );
	    KEY( "tmpLevel", ch->tmplevel, fread_number( fp ) );


Recompile your mud.
install do_mortality


