Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FactionHomeTerritoryConfig.c
Go to the documentation of this file.
1[BaseContainerProps(configRoot: true)]
3{
4 [Attribute(desc: "Array of all locations from which the people of this factions can be from")]
5 protected ref array<ref SCR_FactionHomeTerritory> m_aFactionHomeTerritories;
6
7 [Attribute("0.1", desc: "The percentage chance of a AI group to all share the same place of birth as leader. The higher this number the higher the chance", params: "0 1")]
9
10 //~ Total weight of all entries
11 protected int m_iTotalWeight;
12
13 //------------------------------------------------------------------------------------------------
18 {
19 if (!m_aFactionHomeTerritories.IsIndexValid(index))
20 return null;
21
22 return m_aFactionHomeTerritories[index].m_UIInfo;
23 }
24
25 //------------------------------------------------------------------------------------------------
26 //! Get random place of birth index of faction using random Generator
27 //! \param[in] random Generator. Set null it should not use Generator
28 //! \param[in] useWeightedRandom if true it will randomize the entries with the given weight
29 //! \return Random (weighted) index
30 int GetRandomHomeTerritoryIndex(RandomGenerator randomizer = null, bool useWeightedRandom = true)
31 {
32 if (useWeightedRandom && m_iTotalWeight <= 0)
33 return -1;
34
35 int count = m_aFactionHomeTerritories.Count();
36
37 if (count == 0)
38 return -1;
39
40 if (!useWeightedRandom)
41 {
42 if (randomizer)
43 return randomizer.RandInt(0, count);
44 else
45 return Math.RandomInt(0, count);
46 }
47
48 //~ Randomize with total weights
49 int randomWeight;
50
51 if (randomizer)
52 randomWeight = randomizer.RandIntInclusive(0, m_iTotalWeight);
53 else
54 randomWeight = Math.RandomIntInclusive(0, m_iTotalWeight);
55
56 int checkedWeight = 0;
57
58 foreach (int i, SCR_FactionHomeTerritory territory : m_aFactionHomeTerritories)
59 {
60 //~ Last in list no need to calculate
61 if (i == count -1)
62 return i;
63
64 checkedWeight += territory.m_iWeight;
65 if (randomWeight <= checkedWeight)
66 return i;
67 }
68
69 return -1;
70 }
72 //------------------------------------------------------------------------------------------------
76 {
78 }
79
80 //------------------------------------------------------------------------------------------------
82 {
84
85 //~ Get all weights
86 foreach (SCR_FactionHomeTerritory homeTerritory: m_aFactionHomeTerritories)
87 {
88 m_iTotalWeight += homeTerritory.m_iWeight;
89 }
90 }
91}
92
94class SCR_FactionHomeTerritory
95{
96 [Attribute(desc: "Unique ID for place of birth")]
97 string m_sID;
98
99 [Attribute(desc: "UI Info for place of birth")]
101
102 [Attribute ("1", desc: "Weight of place of birth for randomization. Higher number means higher chance of being picked")]
103 int m_iWeight;
104
105 [Attribute(desc: "EACH GENDER SHOULD ONLY HAVE ONE ENTRY IN THIS LIST! List of genders that contain identity overrides that have a chance to be assigned to a character that is part of this terratory")]
106 ref array<ref SCR_TerritoryIdentityOverride> m_aTerritoryIdentityOverrides;
107}
108
111{
112 [Attribute("1", desc: "Gender of overwrite. The character needs to be the set gender to have the override assigned.", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_EIdentityGender))]
113 SCR_EIdentityGender m_eGender;
114
115 [Attribute(desc: "List of visuals that have a chance to be assigned to the character that is part of this Territory")]
116 ref array<ref SCR_TerritoryIdentityVisualOverride> m_aVisualOverrides;
117
118 [Attribute(desc: "List of first names that have a chance to be assigned to the character that is part of this Territory")]
119 ref SCR_TerritoryIdentityNameOverride m_FirstNameOverrides;
120
121 [Attribute(desc: "List of surnames that have a chance to be assigned to the character that is part of this Territory")]
122 ref SCR_TerritoryIdentityNameOverride m_SurnameOverrides;
123}
124
126class SCR_TerritoryIdentityVisualOverride
128 //~ Unused atm
129 /*[Attribute(desc: "Body of this visual override")]
130 ResourceName m_sBodyOverride;
131
132 [Attribute(desc: "Faces of this visual override. Each face has a random chance to be assigned")]
133 ref array<ResourceName> m_aFaceOverride;
134
135 [Attribute("1", desc: "Weight for this Visual to be used as an override. Take into account that multiple visuals. 1 means 100% (or multiple with one means multiple with 100%. If two entries have 0.5 then the calculation is as following (if calc <= ArrayCount Pick) So in the case it is a 25% to pick A, 25% to pick and 50% to pick default)", params: "0 1 0.001")]
136 float m_fWeight;*/
137}
138
141{
142 [Attribute(desc: "List of names that can be overridden. Each name has a random chance to be assigned")]
143 ref array<LocalizedString> m_aNames;
144
145 [Attribute("1", desc: "Weight for a random Territory name to be chosen. 1 mean 100%", params: "0 1 0.001")]
146 float m_fChanceToOverrideName;
147}
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
SCR_EIdentityGender
class SCR_FactionHomeTerritoryConfig BaseContainerProps()
class SCR_FactionHomeTerritoryConfig BaseContainerCustomDoubleTitleField("m_sID", "m_iWeight")
float m_fSharedPlaceOfBirthWeight
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition Math.c:13
int GetRandomHomeTerritoryIndex(RandomGenerator randomizer=null, bool useWeightedRandom=true)
ref array< ref SCR_FactionHomeTerritory > m_aFactionHomeTerritories
SCR_FieldOfViewSettings Attribute