Changing a NPC's Hair

Post » Sat May 28, 2011 8:40 pm

Ok so I got Face anims to work from advice on this forum... Now for somthing HARD.
Do you think we can get the NPC's hair to change?

The comands MatchRace and AgeRace are ment to...

Taken From... http://geck.gamesas.com/index.php/AgeRace

If an NPC's chosen hair is now invalid for the changed race, the default hair is shown instead: however, once you change them back, their hair will be restored.

Wrong.

For the Player thats right, for a NPC thay will take the default hair for the race no matter what.

Now becouse I and DocL asked the FOSE team added a GetHair/SetHair to FOSE.
GetHair kind of works, it returns the RefID of the NPC's base form hair.
SetHair dont apper to do ANYTHING.

So calling C++ coders.

bool Cmd_GetHair_Execute(COMMAND_ARGS)
{
TESNPC * npc = 0;

UInt32 * refResult = (UInt32 *)result;

*refResult = 0;

if(!ExtractArgs(EXTRACT_ARGS ,&npc))
return true;

if(!npc && thisObj)
npc = DYNAMIC_CAST(thisObj->baseForm, TESForm, TESNPC);

if(npc && npc->hair)
{
if(IsConsoleMode())
Console_Print("GetHair: %08X", npc->hair->refID);

*refResult = npc->hair->refID;
}

return true;
}


bool Cmd_SetHair_Execute(COMMAND_ARGS)
{
TESForm * part = NULL;
TESForm * target = NULL;

*result = 0;
Console_Print("Starting Hair");

if(!ExtractArgsix(paramInfo, arg1, opcodeOffsetPtr, scriptObj, eventList, &part, &target))
{
Console_Print("ExtractArgsix Failed");
return true;
}
else
{
Console_Print("ExtractArgsix Win");
}

TESHair* hair = DYNAMIC_CAST(part, TESForm, TESHair);
if(!hair)
{
Console_Print("Cast Hair Fail");
return true;
}
else
{
Console_Print("Cast Hair Win");
}

if(!target)
{
Console_Print("No target pased falling back to the Me.");
target = thisObj->baseForm;
if(!target)
{
Console_Print("Was not called on Me. eather cant work.");
return true;
}
}
else
{
Console_Print("Useing Pased target");
}

TESNPC * npc = DYNAMIC_CAST(target, TESForm, TESNPC);

if(!npc)
{
Console_Print("Cast NPC Fail");
return true;
}
else
{
Console_Print("Cast NPC Win");
}

npc->hair = hair;

*result = 1;
Console_Print("SetHair Done did I win?");

return true;
}

I have modified the code from the copy in FOSE src folder becouse it never made it to the line
npc->hair = hair;
It will now run right through the Function, but it just plain don't do anything.
Can anyone out there help please?

P.S. if you wish to test it, with the way GetHair works the only way to make this SetHair work is to pass a Ref from a form list with the hairs in it. I can send you a demo if you contact me about it
User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Return to Fallout 3