Jump to content

Detect of NPC is wearing a power armor by script


Recommended Posts

Hi,found this in the foreum:

 

Keyword Property pIsPowerArmorFrame Auto Const Mandator

 

Function CheckForPowerArmor(Actor akActor)

     If(akActor.WornHasKeyword(pIsPowerArmorFrame) == true)

          dothis....

    endif

 

Hopes it help someone else...

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...
4 hours ago, DlinnyLag said:

It's a working alternative indeed but there's unfortunately a problem with it.. it checks for the PA perk:

; Return true if this actor is in power armor
bool Function IsInPowerArmor()
	;Return if the actor has the Power Armor Perk
	Return HasPerk(Game.GetFormFromFile(0x0001F8A9, "Fallout4.esm") as perk)
EndFunction

There's an engine bug that can cause this perk to get stuck on an NPC.. extremely rare in vanilla but it's still there. Here's the original discussion about it (from 2021). In short:

IF an NPC's 3D unloads while; 1) being mounted on a Vertibird AND 2; wearing a Power Armor; THEN the PA perk gets stuck (becomes completely unremovable with vanilla Console/Papyrus RemovePerk(), thus even the vanilla code can't remove it on PA exit).

  • Thanks 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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