PJMail Posted May 31, 2022 Author Share Posted May 31, 2022 (edited) I deliberately look for posts from you as well, so hopefully others will notice your valuable insights (and not just ignore this post/subject as another rant from PJM). Concerning SetPlayerEnemy(false) - I use that in my 'that is not an enemy' OnCombatStateChanged code (Vertibirds have a habit of going rogue), but how else are you considering it being used?As far as I am aware it requires the crimefaction of the NPC you have annoyed, so you need to have an explicit enemy. I wish it would work like "StopCombatAlarm" but finding all the NPC's that have suddenly turned enemy (and their crimefaction) seems computationally expensive - like going through "GetAllCombatTargets()".Do you have a cheaper piece of code you can share? Thanks again SKK. Update: Apart from when you are actually attacked, I can't see any way of finding all the NPC's you have annoyed via the crimefaction so not sure how you "run stopcombat/alarm on each actor"?FindAll... seems to not have a 'faction' option. I am missing something here obviously, or do you mean via "onhit" or "GetAllCombatTargets()"? Seems hugely script intensive... Run away sounds better otherwise... Update2: reviewing my code I actually use Self.SetRelationshipRank(Enemy,pRankAlly) and Enemy.SetRelationshipRank(Self,pRankAlly) as the antagonist is not the player - so I am full of sh*t.Still, it would be useful to know how to stop a whole settlement attacking me when I accidentally shoot ONE OF MY OWN turrets into bleedout!(and Codsworth leaving/attacking me as he is also part of the WorkshopCrimeFaction due to bad config by Bethesda...) Edited May 31, 2022 by PJMail Link to comment Share on other sites More sharing options...
SKKmods Posted May 31, 2022 Share Posted May 31, 2022 As far as I am aware it requires the crimefaction of the NPC you have annoyed, so you need to have an explicit enemy. So what really alerted me to this issue is a fantastic bit of script engineering in CompanionCrimeFactionHostilityScript.TestForSharedCrimeCombatants ... take a look at it. To pacify a population I would trigger a finder quest that has a collection alias which fills to find all [ actors ] [ in the loaded area] conditioned hostile to the player and members of a bunch of or factions you may be interested in like CrimeDiamondCity CrimeGoodneighbor CrimeInstitute or just native factions because the WAY they are alerted dont matter its the FACT they are hostile. The interate the array doing what you need to combat, hostility and aggresion. Dont forget to stop the finder quest to release the actors ! If (pPlayerRef.IsInFaction(pInstituteFaction) && (pCrimeInstitute.IsPlayerEnemy() == true) ; I'm in the faction but they are angry pInstituteFinderQuest.Start() ; includes hostile members of int CrimeInstitute and ext InstituteFaction If (Alias_HostileActors.GetCount() > 0) ;do stuff to them EndIf pInstituteFinderQuest.Stop() EndIf Link to comment Share on other sites More sharing options...
PJMail Posted June 1, 2022 Author Share Posted June 1, 2022 (edited) Sounds horrific - especially if you want to get around this bleedout bug for ALL NPC's. How bad do you think it would be to add the OnEnterbleedout/Stopcombat (remote event) code into something common to all Human NPC's like an Actor Effect on the HumanRace record?Add some conditions to it of course - like the NPC is 3D loaded (and player nearby?) and a 'getfactionreaction' test (as they should not be an enemy of the player - faction-wise). Possibly even use the 'target.isbleedingout' condition to only enable an effect script when needed (rather than register a remote 'onenterbleedout' event). Edited June 1, 2022 by PJMail Link to comment Share on other sites More sharing options...
SKKmods Posted June 1, 2022 Share Posted June 1, 2022 How bad do you think it would be to add the OnEnterbleedout/Stopcombat (remote event) code into something common to all Human NPC's like an Actor Effect on the HumanRace record? Totally depends what you are trying to protect yourself from. Is it any friendly human or specific keyword/faction/getisID populations ? Persistent or Temporary actors ? Specific locations ? & etc. If its any human that could be not hostile (netural/frend/ally) to the player then a race magic script would be easy to implement, but abhorant for touching so many base game records, and: (a) I remember there were some issues with actor events being missed by race attached magic effects on a project, so test test test.(b) I dont trust magic effect attached scripts as the magic effect updates seem to be (dont know just feel it in my nuggets) constant rather than just the pub/sub event triggers.© Prefer to attach such script direct to lvlActor (if they are my actors) or via an Alias (if I can identify and find the actors). Link to comment Share on other sites More sharing options...
PJMail Posted June 1, 2022 Author Share Posted June 1, 2022 How bad do you think it would be to add the OnEnterbleedout/Stopcombat (remote event) code into something common to all Human NPC's like an Actor Effect on the HumanRace record? (a) I remember there were some issues with actor events being missed by race attached magic effects on a project, so test test test.Didnt know about this - the legendary creature effect works this way - would explain why it doesn't always work...(b) I dont trust magic effect attached scripts as the magic effect updates seem to be (dont know just feel it in my nuggets) constant rather than just the pub/sub event triggers.I know many things disrupt magic effects (as you are aware - equipitem for instance) - but really - 90% coverage is still better than aggro settlers due to a firefight with raiders and a few stray bullets...© Prefer to attach such script direct to lvlActor (if they are my actors) or via an Alias (if I can identify and find the actors).Looking at a generic, game wide solution to the 'friendly NPC bleedout Aggro" bug you highlighted. I really can't see a simpler alternative though... A low priority 'experiment' I may continue with at a later time (even just for my own game). Thanks for the excellent info though. Link to comment Share on other sites More sharing options...
SKKmods Posted June 1, 2022 Share Posted June 1, 2022 I have a solution Combat Settlers which can manage all settler bleedout and recovery when configured Essential/NoBleedoutRecovery needing stimpak to recover (because simply adding keyword PlayerCanStimpak does not work). The pattern is: Stick all WorkshopParent registered workshops in a RefColectionAlias whichWorkshop Onload registers for distance less than 5K units so all non persistent resources are findable (at OnLoad distant resources can still be unloaded).ObjectReference[] WorkshopActors = ThisWorkshop.GetWorkshopResourceObjects(pWorkshopRatingPopulation) ; use a finder quest alias fill if expecting more than 127Plus iterate WorkshopParent.CaravanActors for remote actors with the same ((ThisCaravanActor as WorkshopNPCScript).GetWorkshopID() == (ThisWorkshop as WorkshopScript).GetWorkshopID())Plus iterate (pGenericGoHome as GenericGoHomeScript).GoHomeActors for remote actors with the same ((ThisGoHomeActor as WorkshopNPCScript).GetWorkshopID() == (ThisWorkshop as WorkshopScript).GetWorkshopID())Stick all the actors in a RefCollectionAlias that handles event OnEnterBleedout and removes them OnDeath. EZ Link to comment Share on other sites More sharing options...
PJMail Posted June 2, 2022 Author Share Posted June 2, 2022 EZ! Excellent resource for some future modder (GoHomeActors? wtf??? Never encountered that situation).Not going to be me though - you have successfully put me off. As Clint would say - you have to know your limitations...I will look under the covers of Combat Settlers now though you realize... Out of perverse interest at how complex this solution has to be. Link to comment Share on other sites More sharing options...
Recommended Posts