Jump to content

How to change NPC template (TPLT) ?


pxd2050

Recommended Posts


I am creating a skse dll to change the npc Template(LPLT) and Template Flags(Use Traits) and have encountered some problems seeking help.

I have changed the Template and Flags of NPC, but it don't work in the game(npc1 -> npc2). May I ask where the problem ?



void MessageHandler(SKSE::MessagingInterface::Message* a_message)
{
switch (a_message->type) {
case SKSE::MessagingInterface::kDataLoaded:
{
if (INI::GetConfigs_NPCReplacer()) {
logger::info("{:*^50}", "NPCReplacer");
NPCReplacer::force_NPCReplacer();
}
}
break;
default:
break;
}
}
..........
void force_NPCReplacer()
{
for (auto& data : INI::configs_NPCReplacer) {

for (auto npc1 : data.npcs1) {
int i = std::rand() % (data.npcs2.size());
auto npc2 = data.npcs2[i];
npc1->baseTemplateForm = npc2;
npc1->actorData.templateUseFlags.set(RE::ACTOR_BASE_DATA::TEMPLATE_USE_FLAG::kTraits);

logger::info("{} -> {}", npc1->GetFormID(), npc2->GetFormID());
}
}
}

Edited by pxd2050
Link to comment
Share on other sites

  • Recently Browsing   0 members

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