sornan Posted December 17, 2020 Share Posted December 17, 2020 (edited) Hi everyone :smile: I have a scenario, where the player fights some baddies, drives them off eventually where they are then in 'Flee' mode, and then a scene unfolds where the player needs to interact with a few friendly Npc's in dialog. Problem is, as long as the fleeing baddies are in the general area, combat mode persists, and the dialog with the Npc's is messed up, where the dialog session is ended by the game engine in about 2 seconds every time while combat mode is still active. Once the bad guys are gone after a minute, everything is fine and dialog works as it should, but the dialog needs to work while they are in the area still. I've tried the following to stop combat from happening once the enemy is fleeing with no success: CJA_NazgulFaction.SetAlly (PlayerFaction) PlayerFaction.SetAlly (CJA_NazgulFaction) CJA_Nazgul_1_Ref.SetRelationshipRank (PlayerRef, 4) CJA_Nazgul_2_Ref.SetRelationshipRank (PlayerRef, 4) CJA_Nazgul_3_Ref.SetRelationshipRank (PlayerRef, 4) CJA_Nazgul_4_Ref.SetRelationshipRank (PlayerRef, 4) CJA_Nazgul_5_Ref.SetRelationshipRank (PlayerRef, 4) PlayerRef.StopCombat () The Npc that the player is interacting with is an Ally to those bad guys (also an ally to the player) so they never went into combat during the previous fight, and has package flags set to ignore combat and no combat alert, so the Npc himself should not be an issue. As a last resort, I can just move the bad guys to a holding cell and at the same time replace them with identical actors that would not be in combat with the player, but that would be a bit of work and not the ideal solution for any future scenarios where this may come up again. Has anyone else ran into this, and found a way to get dialog sessions between the player and Npc's to work while under combat conditions (combat mode)? Any help appreciated :smile: Edited December 17, 2020 by sornan Link to comment Share on other sites More sharing options...
maxarturo Posted December 18, 2020 Share Posted December 18, 2020 (edited) The npc's combat mechanic is exclusively handled by the game engine, so having dialogue with an npc while combat is active is not supported by the game. * Dialogue is only possible when 'CombatStateChange' is "0". However, your scene can work if your script uses on either anyone of the group of npcs that are in combat "StopCombatAlarm()" immediately followed by "StopCombat()" in each npc and then do any other functions you need to, this way the game engine leaves combat completely and the player can once again interact with other actors. * "StopCombat()" does not work on the player, but "StopCombatAlarm()" does. There is also this for referencealias: TryToStopCombat() - ReferenceAlias https://www.creationkit.com/index.php?title=TryToStopCombat_-_ReferenceAlias Edited December 18, 2020 by maxarturo Link to comment Share on other sites More sharing options...
sornan Posted December 18, 2020 Author Share Posted December 18, 2020 (edited) Thank you Maxarturo :smile: Thanks for the great information there. It's good to know that StopCombatAlarm is the only thing that works on the player. Thanks also for the command that uses Alias References. Despite many tests, I was not able to get StopCombatAlarm + StopCombat to work to end the dialog issues. It still cuts off after a second or two.It certainly *did* stop the combat music, indicating combat has ended, despite the enemies nearby whom still showed red on the miniature radar in the area. I added the friendly Npc's to the code as well just to be sure, even though technically they should not have been in combat, unfortunately it made no difference. I can only surmise that both StopCombatAlarm and or StopCombat may only temporarily work under conditions where opposing forces exist nearby each other, as maybe eventually the game engine says "we've stopped all combat, but there are still enemies nearby...". I could be wrong, just conclusions from testing on my end. I have found a combination that works with factional adjustments during the presence of enemies: CJA_NazgulFaction.SetAlly (PlayerFaction) PlayerFaction.SetAlly (CJA_NazgulFaction) CJA_Nazgul_1_Ref.StopCombat () CJA_Nazgul_2_Ref.StopCombat () CJA_Nazgul_3_Ref.StopCombat () CJA_Nazgul_4_Ref.StopCombat () CJA_Nazgul_5_Ref.StopCombat () The Nazgul being set Ally to the PlayerFaction actually seems to be all that's needed for the factional part, but I figured it can't hurt to set the PlayerFaction to Ally to them as well. The StopCombat part for them finished it off, and actually works. I was really surprised it worked, it was a last ditch effort expected to fail. The dialog works as it should, with no enemies nearby any longer. /EDIT Decided to just integrate the StopCombatAlarm plus StopCombat code along with the factional adjustments in the scenario to help ensure things are solid. Final code: CJA_NazgulFaction.SetAlly (PlayerFaction) PlayerFaction.SetAlly (CJA_NazgulFaction) CJA_Nazgul_1_Ref.StopCombatAlarm () CJA_Nazgul_2_Ref.StopCombatAlarm () CJA_Nazgul_3_Ref.StopCombatAlarm () CJA_Nazgul_4_Ref.StopCombatAlarm () CJA_Nazgul_5_Ref.StopCombatAlarm () CJA_Frodo_Ref.StopCombatAlarm () CJA_Sam_Ref.StopCombatAlarm () CJA_Merry_Ref.StopCombatAlarm () CJA_Pippin_Ref.StopCombatAlarm () CJA_Nazgul_1_Ref.StopCombat () CJA_Nazgul_2_Ref.StopCombat () CJA_Nazgul_3_Ref.StopCombat () CJA_Nazgul_4_Ref.StopCombat () CJA_Nazgul_5_Ref.StopCombat () CJA_Frodo_Ref.StopCombat () CJA_Sam_Ref.StopCombat () CJA_Merry_Ref.StopCombat () CJA_Pippin_Ref.StopCombat () PlayerRef.StopCombatAlarm ()Same good results, things are working, and I can only imagine that the extra measures help to ensure further scene and scenario content will function properly with combat having been effectively ended. Thanks so much for the help, it got sorted! :smile: Edited December 19, 2020 by sornan Link to comment Share on other sites More sharing options...
Recommended Posts