Jump to content

AddKeyword to NPC when Armor OnEquipped


Recommended Posts

I am puzzled once again. I am trying to add keywords to an NPC during the Event OnEquipped for an Armor object. I am not sure why the keywords do not get added, I guess that akActor is not sufficient and that I need to better define the object reference that will receive the keywords.

 

I tried using akActor first and then added a local ObjectReference variable because using akActor didn't work. The script compiles either way but the NPCs do not gain the two keywords. They do get added to the Bodyguard faction.

 

My script is in the spoiler below. It is added to the armor object and the properties are filled there.

 

 

 

Keyword property _MY_Bodyguard auto
Keyword property _NewBodyguard auto
Faction property BodyguardFaction auto
Event onEquipped(Actor akActor)
ObjectReference NPCBodyguard = akActor as ObjectReference
NPCBodyguard.AddKeyword(_MY_Bodyguard)
NPCBodyguard.AddKeyword(_NewBodyguard)
akActor.AddtoFaction(BodyguardFaction)
EndEvent

Link to comment
Share on other sites

I have noticed that AddKeyword can suffer delay in in happening, especially when adding an actor to a quest alias with a static keyword that should be applied.

 

If you wait some frames/seconds/cycles then test HasKeyword it appears.

 

The only workaround I have found if you need instant response flagging is to use an ActorValue instead as I have never found a delay on SetValue.

 

Or, your problem could be something totally different but the code looks fine (just double check properties are set !).

Link to comment
Share on other sites

Thanks, I am still puzzled as the keywords never appear. I eventually added them via console after a couple of game days passed.

 

The ActorValue idea is a good one and I will try that in my next round of playtesting.

 

These are not keywords that will ever be assigned to non-actor objects so ActorValues make good sense.

Link to comment
Share on other sites

Odd. I haven't had time to change my script yet. While I was playtesting something else today, the script was triggered on an NPC and worked with the addkeyword commands. I still plan to switch to ActorValues but it was nice to see the script actually work correctly.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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