Jump to content

Help directing headpiece meshes


Mosstronaut

Recommended Posts

Hi, this is my first time using the forums and also my first time trying to actually patch anything to do with the game models and meshes.

 

I'm using Fluff's Hybrid Khajiits SSE as one of my mods. In short, it's a khajiit race replacer that makes khajiit actors look less catlike.

 

One of the things listed as a "known bug" is that all headpieces worn by khajiit actors will still point to the khajiit headpiece files. The problem with this behavior is that the head mesh of the model resembles that of the human races closer, so when equipping a facemask or a circlet, it juts out from the character a lot and it ends up looking really bad.

 

What I would like to do is make the game load the human race headpiece files for khajiits, the problem is I'm completely lost as to where to do this in the most efficient way.

 

I'd very much appreciate some assistance on how to go about this task.

 

Thanks in advance!

Link to comment
Share on other sites

I wish I could help. but just to get a reply going.. I would think there would be some headpiece mods needed to go with this mod.... Or is there a way to make human armor work like you said? I say this not knowing what differences exist between human/cat armor..

 

Good luck man..

c0AX599

Edited by c0ax599
Link to comment
Share on other sites

I wish I could help. but just to get a reply going.. I would think there would be some headpiece mods needed to go with this mod.... Or is there a way to make human armor work like you said? I say this not knowing what differences exist between human/cat armor..

 

Good luck man..

c0AX599

As far as I know, the armor itself is the same for humans and beast races. The headpieces tend to be a tad longer or bigger to accommodate the bigger skulls khajiit and argonians have.

 

I could go into SSEedit and change each reference for the khajiit race headpiece to the human headpiece reference, but that just seems like the slowest and worst way to do it.

Link to comment
Share on other sites

So I got some more reading done. If I'm going about it correctly, what I actually want to be editing is the Armor Addon value, since it's the one that handles the actual 3d model. I'm still completely lost as to the actual value I want to edit and then how to bulk change them.

 

I read about MXPF and it sounds like it's the tool I want to use, (once I figure out what value to edit), so I could actually build a patcher that takes the whole load order into account rather than just make a solution that fits only my personal load order at the moment.

 

Still, if someone has ever worked on something similar, I'm really wanting to learn how to get this to work.

Link to comment
Share on other sites

More updates, (in the rare off-chance that someone is actually interested in this), I've figured out what registries need to be changed.

 

First I'd need to add the khajiit race to the armor addon of the human races for each piece of headgear I'd like to use. Once that is done I then need to change the armor registry so the khajiit race uses the same model path as the human armor. (I suck at explaining but it's not that complicated, only terribly slow).

 

So now that I've figured out what needs to be changed, the next step is to find out if I can make a script that goes through all armor and clothing mods and makes changes those variables for me on a separate patch.

Link to comment
Share on other sites

So, I've actually got some code now but, as expected for a first try it's not working as intended.

 

I'm using Nazenn's code for allowing Khajiit ears to go through headpieces as a base, but I thought I had modified it to select all headpieces that aren't meant for Khajiits and then add Khajiit as an additional race.

{
 Change the Secondary race values of default headwear so Fluffy Khajiits can use them
}
 
unit KhajiitScript;
 
uses 'lib/mxpf';
 
//Detect Additional Races for filtering
function HasAdditionalRace(npc: IInterface; targetName: string): boolean;
var
  additionalRaces, aRace: IInterface;
  raceName: string;
  i: Integer;
begin
  Result := false;
  additionalRaces := ElementByPath(npc, 'Additional Races');
  // if record isn't an NPC record, or npc doesn't have
  // additional races element
  if not Assigned(additionalRaces) then
    exit;
 
  for i := 0 to Pred(ElementCount(additionalRaces)) do begin
    aRace := ElementByIndex(additionalRaces, i);
   
    // compare edids
    raceName := GetEditValue(aRace);
    if raceName = targetName then begin
      Result := true;
      break;
    end;
  end;
end;
 
//Biped slot functions
procedure SetFlag(element: IInterface; index: Integer; state: boolean);
var
  mask: Integer;
begin
  mask := 1 shl index;
  if state then
    SetNativeValue(element, GetNativeValue(element) or mask)
  else
    SetNativeValue(element, GetNativeValue(element) and not mask);
end;
 
function GetFlag(element: IInterface; index: Integer): boolean;
var
  mask: Integer;
begin
  mask := 1 shl index;
  Result := (GetNativeValue(element) and mask) > 0;
end;
 
//This is the modified script that will select the offending headwears
function Initialize: Integer;
const
  khajiitRace = 'KhajiitRace "Khajiit" [RACE:00013745]';
  defRace = 'DefaultRace "Default Race" [RACE:00000019]';
var
  i, max: integer;
  aRec: IInterface;
  bodt: IInterface;
  race, k: IInterface;
  rnam: string;
  bRnamDefault, bAdditionalKhajiit: boolean;
  sl: TStringList;
  slAddRACE: TStringList;
  
begin
  DefaultOptionsMXPF;
  InitializeMXPF;
       
  PatchFileByAuthor('Fluffijiits Headwear'); //Patch identifier
  SetExclusions(mxHardcodedDatFiles); //Ignores Bethesda .exe files

  mxLoadWinningOverrides := true; //Copies lowest version of the record
  mxSkipPatchedRecords := true; //Does not repeat already patched items

  LoadRecords('ARMA'); //ArmorAddon records loader
       
  sl := TStringList.Create;
  slAddRACE := TStringList.Create;
  slAddRACE.Add(khajiitRace);
  try
    max := MaxRecordIndex;
    for i:= max downto 0 do begin
      aRec := GetRecord(i);
      sl.Add('Processing '+Name(aRec));
      bodt := ElementByPath(aRec, 'BODT\First Person Flags'); //Biped slot flags for main Bethesda files
      if not Assigned(bodt) then
        bodt := ElementByPath(aRec, 'BOD2\First Person Flags'); //Biped slot flags for mod files
      rnam := GetElementEditValues(aRec, 'RNAM');
      bRnamDefault := (rnam = defRace); //Detect that main race assignment of ARMA is Default Race
      bAdditionalKhajiit := HasAdditionalRace(aRec, khajiitRace); //Detect that Khajiit is a secondary racial assignment
      if not Assigned(bodt) then begin
        //sl.Add('    "Khajiit does not know what this armor is"'); //Armor not supported
        RemoveRecord(i);
      end
      else if not GetFlag(bodt, 13) then begin
        //sl.Add('    "Khajiit thinks this armor not for wearing on head"'); //Not headwear
        RemoveRecord(i);
      end
      else if ( not bRnamDefault or bAdditionalKhajiit) then begin
        if not bRnamDefault then
          //sl.Add('    "This armor is for Beast Races"'); //Not assigned to Default
        if bAdditionalKhajiit then
          //sl.Add('    "This armor can be used by Khajiit already"'); //Assigned to Khajiit in additional races
        RemoveRecord(i)
      end
      else
        sl.Add(Format(' ** Khajiit will take this armor **', [Name(aRec)])); //Is a default armor with no support for Khajiit
    end;
  finally
    AddMessage(sl.Text);
    sl.Free;
  end;
       
  //Export remaining records to new esp file
  CopyRecordsToPatch;
       
  //Add Khajiit race in new esp
  for i := 0 to MaxPatchRecordIndex do begin
    aRec := GetPatchRecord(i);
    //bodt := ElementByPath(aRec, 'BODT\First Person Flags');
    //if not Assigned(bodt) then
      //bodt := ElementByPath(aRec, 'BOD2\First Person Flags');
	race := ElementBySignature(aRec, 'MODL');
	k := ElementAssign(race, HighInteger, nil, False);
	SetEditValue(k, slAddRACE[i]);
    // handle the stuff < Random Mator stuff for troubleshooting
    if not Assigned(bodt) then
      AddMessage('    "Khajiit not know how this got here"')
    else try
      SetFlag(bodt, 13, false);
    except
      on x: Exception do AddMessage('    "Khajiit is very confused" '+x.Message);
    end;
  end;
   slAddRACE.Free;
       
  PrintMXPFReport;
       
  FinalizeMXPF;
end;
 
end.

So, as I said I expected it to fail. I'm thinking I'm messing up the conditionals for selecting the headwear and further down I completely failed to grasp how to add the additional race record.

 

I'm having a very hard time getting a hang of the Delphi syntax, it's really different from anything I've seen before. I'll keep tinkering with it, but if in the meantime someone can help me understand what I'm doing I'd be grateful.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...