Jump to content

Turn friendlies hostile and then back to friendly


FlashyJoer

Recommended Posts

Hi all,

 

Just curious about the subject. Ive tried too do this and can certainly make the targeted actor hostile by placing them into a custom faction that has the playerfaction set as an enemy, but the reverse, taking them out of the faction and then putting them into a second custom faction where the playerfaction is set to friend does nothing to stop them attacking.

 

Scenario: Dialogue driven scene - if a specific topic is chosen, it causes the NPC to turn hostile and attack the player. Using OnHit event to monitor health percentage of Player and NPC, I need the outcome in either case to be the NPC stops attacking and goes back into friendly mode where dialogue can be initiated again. As I said, I can trigger the dialogue and on chosen option make the NPC hostile. I have the code to monitor healthAV on both parties to see if it drops below 0.5 (50% total health) but yeah, doing the faction swap and .StopCombat or .StopCombatAlert does nothing to change the NPC back to 'friendly', non-attack mode.

 

Is there a step in the faction setup that I am missing? Is it perhaps that I need to add the two factions to PlayerFaction, as enemy and friend, depending on the custom faction?

Link to comment
Share on other sites

Answered my own question through testing. So apparently the issue is not about having two user made factions where one is hostile to the player and the other is a friend. You also need to add the 'friend' faction to the vanilla playerfaction record as well. Once I did that, boom... I can trigger a fight with a friendly NPC and when their health hits 50% they are dropped from enemy faction and added to friendly et voila! They want to talk and no longer fight :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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