Home › Dev CE (experimental) › BarbarianTribes
Experimental: needs Dev CE (
fork of the Community Extension, release zip and source). A GameCore that adds these Lua methods by calling engine functions directly. Not part of the upstream Community Extension, single-player testing only. Descriptions on these pages were written by an AI assistant from decompiled code and are marked inferred unless a test result confirms them.
BarbarianTribes
15 methods (Dev CE test build). this is found with the game's own IBarbarianTribes instance resolver (plain).
| Method |
Signature |
Purpose (AI-written, inferred) |
Tested |
Engine function |
Current |
| CanTribeTrainUnitNow |
BarbarianTribes:CanTribeTrainUnitNow(iTribeIndex: integer, eUnitType: integer) → boolean |
Checks whether a tribe can train a unit now: unit exists and is available, not blocked by a government flag, prerequisite tech is known by the player or the clan, and prerequisite civic is held. |
plumbing ✓ |
— |
0xe20c0 |
| ChangeSpawnRate |
BarbarianTribes:ChangeSpawnRate(tribe: integer, rate: integer) |
Sets the warrior spawn rate of the given tribe. |
plumbing ✓ |
— |
0xe2220 |
| CreateCamps |
BarbarianTribes:CreateCamps() |
Creates new barbarian camps: submits and runs AI camp-evaluation jobs, counts land plots and unseen ones to compute a target camp count, then places camps. Decompilation is truncated after the count logic, so placement details are not visible. |
plumbing ✓ |
— |
0xe2270 |
| DoTurnActivate |
BarbarianTribes:DoTurnActivate(bFirstActivation: boolean) |
Per-turn clans update: if the clans capability is on and bFirstActivation is true, picks a random tribe whose conversion is at least 100 percent on a valid city-found location and converts it to a minor civ; then advances a counter and tries to let a tribe claim a unique unit. Output truncated at the end. |
plumbing ✓ |
— |
0x620400 |
| GetBribeClanGoldCost |
BarbarianTribes:GetBribeClanGoldCost(iTribeIndex: integer, ePlayer: integer) → number |
Computes the gold cost for a player to bribe a barbarian clan: tribe definition base property plus a per-player factor, adjusted for game speed. |
plumbing ✓ |
— |
0x6209b0 |
| GetCurrentEra |
BarbarianTribes:GetCurrentEra() → number |
Returns the game's current era, or the first era if none is set yet. |
plumbing ✓ |
— |
0x620ab0 |
| GetHireClanGoldCost |
BarbarianTribes:GetHireClanGoldCost(iTribeIndex: integer, ePlayer: integer, eUnitType: integer) → number |
Computes the gold cost for a player to hire a clan with a given unit: unit production cost converted to purchase cost, multiplied by a global factor. |
plumbing ✓ |
— |
0x620ae0 |
| GetPreviousCampDistanceFromPlot |
BarbarianTribes:GetPreviousCampDistanceFromPlot(iPlotIndex: integer) → number |
Returns the smallest plot distance from the given plot to any previous camp location in the stored list; 0 if the list is empty. |
plumbing ✓ |
— |
0xe3f60 |
| GetRaidClanGoldReward |
BarbarianTribes:GetRaidClanGoldReward(iTribeIndex: integer, ePlayer: integer) → number |
Computes the gold reward for raiding a clan: barbarian camp improvement value plus a per-player amount, adjusted for game speed. |
plumbing ✓ |
— |
0x620e00 |
| GetRaidScoreForTribe |
BarbarianTribes:GetRaidScoreForTribe(tribe: integer) → number |
Returns the tribe's raid score as the sum of two stored ints at offsets 0x78 and 0x7c. |
plumbing ✓ |
— |
0xe4010 |
| GetRampageTarget |
BarbarianTribes:GetRampageTarget(tribeNumber: integer) → number |
Returns the player a tribe is currently rampaging against. |
plumbing ✓ |
— |
0xe40a0 |
| GetTribeType |
BarbarianTribes:GetTribeType(tribe: integer) → number |
Returns the barbarian name type of the tribe at the index. |
plumbing ✓ |
— |
0xe43f0 |
| GetUniqueUnitClaimTribe |
BarbarianTribes:GetUniqueUnitClaimTribe(eUnitType: integer) → number |
Looks up which tribe has claimed a given unique unit in the claim list. |
plumbing ✓ |
— |
0x621090 |
| IsDefender |
BarbarianTribes:IsDefender(unitType: integer) → boolean |
Checks whether the unit type is in the barbarian defender unit list. |
plumbing ✓ |
— |
0xe5090 |
| RemoveTribe |
BarbarianTribes:RemoveTribe(iTribeIndex: integer) |
Removes a tribe: finds the tribe with the given index, clears the improvement on its camp plot, updates two manager fields and marks the tribe entry as inactive. |
plumbing ✓ |
— |
0xe5cd0 |
Details
CanTribeTrainUnitNow
Arguments: iTribeIndex — Tribe index; eUnitType — Unit type to test
Input checks: Range-checks tribe index and unit type, null-checks definitions.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
ChangeSpawnRate
Arguments: tribe — Tribe index; rate — New warrior spawn rate passed to SetWarriorSpawnRate
Writes
- Tribe warrior spawn rate (via Instance::SetWarriorSpawnRate on the tribe vector)
Input checks: Range-checks tribe index; rate not validated.
Multiplayer: may-desync, edits synchronised tribe state. Risk: medium (Writes tribe state, only for a valid index). Confidence of the reading: high.
CreateCamps
Writes
- Barbarian camps and tribes (placement, truncated)
Side effects
- Runs and waits for AI jobs
- Logs stats through the logging manager
- Notification sent (per facts)
- Uses game random and turn info (per facts)
Input checks: Returns early if a setting is -1 or the camp limit is reached; other checks not visible.
Multiplayer: may-desync, creates camps and runs AI jobs. Risk: high (Spawns map improvements and tribes). Confidence of the reading: low.
DoTurnActivate
Arguments: bFirstActivation — Gate flag; function returns immediately when false
Writes
- Converts a tribe to a minor civ via ConvertTribeToMinorCiv
- Unique-unit claim counter at this+0x100 incremented or reset
- Tribe vector opened for edit
Side effects
- Random roll (GetRandNum) for tribe choice
- LogStats call
- May let a tribe claim a unique unit
Input checks: Checks capability 0x6e293fcc and bFirstActivation; null-checks tribe; no other range checks.
Multiplayer: may-desync, converts tribes and uses game RNG. Risk: high (Changes tribe and minor civ state and consumes RNG). Confidence of the reading: medium.
GetBribeClanGoldCost
Arguments: iTribeIndex — Index of the barbarian tribe; ePlayer — Player who would pay; a per-player value scales the cost
Input checks: Null-checks tribe and definition range; ePlayer is not validated before EditPlayer.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetCurrentEra
Input checks: No inputs.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetHireClanGoldCost
Arguments: iTribeIndex — Tribe index; not used by the code; ePlayer — Player whose unit cost is looked up; eUnitType — Unit type to be hired
Input checks: Returns -1 for NO_PLAYER or NO_UNIT; tribe index is unused and unchecked.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetPreviousCampDistanceFromPlot
Arguments: iPlotIndex — Map plot index
Input checks: Skips negative stored indices; iPlotIndex is not range-checked.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetRaidClanGoldReward
Arguments: iTribeIndex — Tribe index; not used by the code; ePlayer — Player whose per-improvement bonus is read
Input checks: Checks camp improvement type and definition range; ePlayer and tribe index not validated.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetRaidScoreForTribe
Arguments: tribe — Tribe index
Input checks: No bounds check on the tribe index; out-of-range reads other memory.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: medium.
GetRampageTarget
Arguments: tribeNumber — Tribe index
Input checks: Range-checks tribe index.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetTribeType
Arguments: tribe — Tribe index
Input checks: Range-checks tribe index.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
GetUniqueUnitClaimTribe
Arguments: eUnitType — Unit type to look up
Input checks: Returns -1 for NO_UNIT or when not found.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
IsDefender
Arguments: unitType — Unit type to find
Input checks: No validation; plain list search.
Multiplayer: read-only, pure query. Risk: low (pure getter). Confidence of the reading: high.
RemoveTribe
Arguments: iTribeIndex — Tribe index to remove
Writes
- Camp plot improvement set to none
- Tribe entry flag at +0x18 cleared
- Manager fields at +0xc8 and +0x150 updated
Side effects
- Map improvement change on the camp plot
Input checks: Range-checks index and searches for the matching tribe; no-op if not found.
Multiplayer: may-desync, changes map and tribe state. Risk: high (Removes improvement and tribe). Confidence of the reading: medium.