8 [
Attribute(
SCR_EPerceivedFactionOutfitType.DISABLED.ToString(),
desc:
"Decides what the faction outfit calculation is.\n\DISABLED: Perceived faction is never set by outfit\nHIGHEST_VALUE: The perveived faction is what ever the highest combined value is\nFULL_OUTFIT: Perceived faction will be unknown unless all clothing is of the same faction (Needs at least a torso and pants to be seens as a faction)",
category:
"Settings", uiwidget:
UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(
SCR_EPerceivedFactionOutfitType)),
RplProp(onRplName:
"OnPerceivedFactionOutfitTypeChanged")]
11 [
Attribute(
"0",
desc:
"The punishment when killing a hostile character while the player is perceived as an unknown or other faction then their own.\n\nNote that warcrime will result as each kill counting as if they killed a friendly which will eventually cause a player to be kicked", uiwidget:
UIWidgets.Flags, enumType: SCR_EDisguisedKillingPunishment,
category:
"Settings"),
RplProp(onRplName:
"OnPunishKillingWhileDisguisedChanged")]
12 protected SCR_EDisguisedKillingPunishment m_ePunishmentKillingWhileDisguised;
14 [
Attribute(
desc:
"If character has no outfit faction it will set default faction. Otherwise it will set outfit faction to null\n\nIf Type is FULL_OUTFIT it will always set it to null regardless of this value",
category:
"Settings")]
15 protected bool m_bNoOutfitFactionSetsDefaultFaction;
17 [
Attribute(
desc:
"Hints for on perceived faction changed. To inform the player about the system and what it means to not be of the perceived faction",
category:
"Hints")]
20 [
Attribute(
"0",
desc:
"If AI should perceive the Perceived faction of a player character when their outfit changes their perceived faction.\n\nThis is an experimental feature!",
category:
"AI Settings"),
RplProp(onRplName:
"OnPerceivedFactionChangesAffectsAIChanged")]
21 protected bool m_bPerceivedFactionChangesAffectsAI;
23 [
Attribute(
"CIV",
desc:
"For AI only when m_bPerceivedFactionChangesAffectsAI is true. FactionKey of a faction which will be set if the player's faction can not be determined. Such as when the player is naked. Keep this empty if you want the faction to be NULL.\n\nThis setting is only used when m_bNoOutfitFactionSetsDefaultFaction is set to false and if that faction exists",
category:
"AI Settings")]
26 protected Faction m_FallbackFaction;
43 return m_FallbackFaction;
57 if (!m_PerceivedFactionHints)
65 SCR_HintManagerComponent hintManager = SCR_HintManagerComponent.GetInstance();
71 if (addtionGameModeSettings && !addtionGameModeSettings.IsTeamKillingPunished())
80 hint = m_PerceivedFactionHints.GetHintByType(
EHint.GAMEPLAY_PERCEIVED_FACTION_CHANGED);
81 else if (
SCR_Enum.HasFlag(
flags, SCR_EDisguisedKillingPunishment.WARCRIME))
82 hint = m_PerceivedFactionHints.GetHintByType(
EHint.GAMEPLAY_PERCEIVED_FACTION_CHANGED_PUNISH_WARCRIME);
83 else if (
SCR_Enum.HasFlag(
flags, SCR_EDisguisedKillingPunishment.XP_LOSS))
84 hint = m_PerceivedFactionHints.GetHintByType(
EHint.GAMEPLAY_PERCEIVED_FACTION_CHANGED_PUNISH_XP);
90 hintManager.Show(hint);
97 return m_eCharacterPerceivedFactionOutfitType;
109 m_eCharacterPerceivedFactionOutfitType =
type;
114 SCR_NotificationsComponent.SendToEveryone(
ENotification.EDITOR_PERCEIVED_FACTION_TYPE_DISABLED, playerID);
116 SCR_NotificationsComponent.SendToEveryone(
ENotification.EDITOR_PERCEIVED_FACTION_TYPE_HIGHEST_VALUE, playerID);
118 SCR_NotificationsComponent.SendToEveryone(
ENotification.EDITOR_PERCEIVED_FACTION_TYPE_FULL_OUTFIT, playerID);
129 if (m_OnPerceivedFactionOutfitTypeChanged)
130 m_OnPerceivedFactionOutfitTypeChanged.Invoke(m_eCharacterPerceivedFactionOutfitType);
137 if (!m_OnPerceivedFactionOutfitTypeChanged)
140 return m_OnPerceivedFactionOutfitTypeChanged;
147 return m_bNoOutfitFactionSetsDefaultFaction;
154 return m_ePunishmentKillingWhileDisguised;
166 m_ePunishmentKillingWhileDisguised = punishmentFlags;
169 SCR_NotificationsComponent.SendToEveryone(
ENotification.EDITOR_PERCEIVED_FACTION_PUNISHMENT_KILLING_SET, playerID, m_ePunishmentKillingWhileDisguised);
179 if (m_OnPunishKillingWhileDisguisedChanged)
180 m_OnPunishKillingWhileDisguisedChanged.Invoke(m_ePunishmentKillingWhileDisguised);
187 if (!m_OnPunishKillingWhileDisguisedChanged)
190 return m_OnPunishKillingWhileDisguisedChanged;
196 SCR_CharacterFactionAffiliationComponent affiliationComponent = SCR_CharacterFactionAffiliationComponent.Cast(entity.
FindComponent(SCR_CharacterFactionAffiliationComponent));
197 if (!affiliationComponent)
201 affiliationComponent.InitPlayerOutfitFaction_S();
207 SCR_CharacterFactionAffiliationComponent affiliationComponent = SCR_CharacterFactionAffiliationComponent.Cast(instigatorContextData.GetVictimEntity().FindComponent(SCR_CharacterFactionAffiliationComponent));
208 if (!affiliationComponent)
212 affiliationComponent.DisableUpdatingPerceivedFaction_S();
218 return m_bPerceivedFactionChangesAffectsAI;
227 m_bPerceivedFactionChangesAffectsAI = affectsAI;
240 if (m_OnPerceivedFactionChangesAffectsAI)
241 m_OnPerceivedFactionChangesAffectsAI.Invoke(m_bPerceivedFactionChangesAffectsAI);
247 if (!m_OnPerceivedFactionChangesAffectsAI)
250 return m_OnPerceivedFactionChangesAffectsAI;
273 Print(
"'SCR_PerceivedFactionManagerComponent' exists twice in the world!",
LogLevel.WARNING);
284 if (DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_CHARACTER_SHOW_FACTION_OUTFIT))
285 CharacterOutfitDebug();
292 super.OnPostInit(owner);
295 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_CHARACTER_SHOW_FACTION_OUTFIT,
"",
"Show Perceived Faction",
"Character");
308 if (m_sAIFallbackFaction.IsEmpty())
311 FactionManager factionManager =
GetGame().GetFactionManager();
315 m_FallbackFaction = factionManager.GetFactionByKey(m_sAIFallbackFaction);
316 if (!m_FallbackFaction)
317 Print(
"SCR_PerceivedFactionManagerComponent trying to set fall back faction '" + m_sAIFallbackFaction +
"' but this faction could not be found so it is null instead.",
LogLevel.WARNING);
322 protected void CharacterOutfitDebug()
324 DbgUI.Begin(
"Player Perceived Faction", 0, 0);
326 IEntity player = SCR_PlayerController.GetLocalControlledEntity();
329 DbgUI.Text(
"No Player");
339 DbgUI.Text(
"--------");
348 SCR_CharacterFactionAffiliationComponent charFactionAffiliation = SCR_CharacterFactionAffiliationComponent.Cast(player.
FindComponent(SCR_CharacterFactionAffiliationComponent));
349 if (!charFactionAffiliation)
351 DbgUI.Text(
"Player is missing SCR_CharacterFactionAffiliationComponent");
357 if (!charFactionAffiliation.HasPerceivedFaction())
359 DbgUI.Text(
"Unable to get Perceived faction:");
361 SCR_PossessingManagerComponent possessingManager = SCR_PossessingManagerComponent.GetInstance();
363 if (!possessingManager || possessingManager.IsPossessing(SCR_PlayerController.GetLocalPlayerId()))
364 DbgUI.Text(
" - Player is possessing an AI");
366 DbgUI.Text(
" - Player spawned was not called: Was player spawned on play in workbench?");
373 Faction currentOutfitFaction = charFactionAffiliation.GetPerceivedFaction();
375 if (!currentOutfitFaction)
376 DbgUI.Text(
"Perceived Faction: UNKNOWN");
378 DbgUI.Text(
"Perceived Faction: " + currentOutfitFaction.GetFactionKey());
381 DbgUI.Text(
"Disguise Type: " +
typename.EnumToString(
SCR_ECharacterDisguiseType, charFactionAffiliation.GetCharacterDisguiseType()));
383 map<Faction, int> outfitFactionValues =
new map<Faction, int>();
384 int count = charFactionAffiliation.GetCharacterOutfitValues(outfitFactionValues);
387 DbgUI.Text(
"Outfit values:");
391 DbgUI.Text(
" - None");
395 foreach(
Faction outfitFaction,
int outfitvalue : outfitFactionValues)
397 DbgUI.Text(
" - " + outfitFaction.GetFactionKey() +
": " + outfitvalue);
404 DbgUI.Text(
"Missing:");
407 EquipedLoadoutStorageComponent characterStorage = EquipedLoadoutStorageComponent.Cast(player.
FindComponent(EquipedLoadoutStorageComponent));
409 if (!characterStorage.GetClothFromArea(LoadoutJacketArea))
410 DbgUI.Text(
" - Jacket");
412 if (!characterStorage.GetClothFromArea(LoadoutPantsArea))
413 DbgUI.Text(
" - Pants");
422 DbgUI.Text(
"--------");
434 DbgUI.Text(
"Faction AI perceives if no outfit values: " + m_sAIFallbackFaction +
" ");
436 DbgUI.Text(
"Faction AI perceives if no outfit values: DEFAULT FACTION");
451enum SCR_EDisguisedKillingPunishment
SCR_EAIThreatSectorFlags flags
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
void SCR_AdditionalGameModeSettingsComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_BaseGameMode GetGameMode()
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
void OnPlayerKilled(notnull SCR_InstigatorContextData instigatorContextData)
SCR_ECharacterDisguiseType
Get all prefabs that have the spawner data
Get all prefabs that have the spawner the given labels and are valid in the editor mode param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param faction Faction(Optional)
Faction GetFallbackFaction()
bool DoesPerceivedFactionChangesAffectsAI()
SCR_EPerceivedFactionOutfitType
@ HIGHEST_VALUE
The faction is set to the highest value of all combined clothing.
@ FULL_OUTFIT
The faction is unknown until all clothing items are of the same faction and at least a pants and tors...
ScriptInvokerInt GetPerceivedFactionOutfitTypeChanged()
enum SCR_EPerceivedFactionOutfitType XP_LOSS
Killing players while disguised will case a lose in XP.
void OnPerceivedFactionChangesAffectsAIChanged()
SCR_EPerceivedFactionOutfitType GetCharacterPerceivedFactionOutfitType()
Get the current Perceived faction outfit type. Which determintes how the perceived faction is calcula...
SCR_EDisguisedKillingPunishment GetPunishmentKillingWhileDisguisedFlags()
bool DoesNoOutfitSetFactionToDefault()
void SetPunishmentKillingWhileDisguisedFlags_S(SCR_EDisguisedKillingPunishment punishmentFlags, int playerID=-1)
void OnPerceivedFactionOutfitTypeChanged()
ScriptInvokerInt GetOnPunishKillingWhileDisguisedChanged()
void SetCharacterPerceivedFactionOutfitType_S(SCR_EPerceivedFactionOutfitType type, int playerID=-1)
void OnPunishKillingWhileDisguisedChanged()
void ShowPerceivedFactionChangedHint(Faction playerPerceivedFaction)
Called by SCR_CharacterFactionAffiliationComponent On Perceived faction changed. To show hint to play...
void SetPerceivedFactionChangesAffectsAI(bool affectsAI, int PlayerID=-1)
void SCR_PerceivedFactionManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
ScriptInvokerBool GetOnPerceivedFactionChangesAffectsAIChanged()
override void EOnFrame(IEntity owner, float timeSlice)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
ScriptInvokerBase< ScriptInvokerIntMethod > ScriptInvokerInt
override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
override void EOnInit(IEntity owner)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
@ DISABLED
General event switch.
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.