-
Notifications
You must be signed in to change notification settings - Fork 0
AI Commander Treasury Fund Accessors
⚠️ PROPOSE-FLAG (unverified 2026-07-12, needs owner review): the "Locality contract" section below (and the accessor-pair table) describeGetAICommanderFundsas having no nil-guard andChangeAICommanderFundsas writing with no broadcast flag ("server-local... clients never see it"). Current source at origin/master 9d7482116 contradicts both:Server/Functions/Server_GetAICommanderFunds.sqf:8-10now exits with0on a nil/non-scalar balance, andServer/Functions/Server_ChangeAICommanderFunds.sqf:5,7now passes a third_syncAicomStateargument ((missionNamespace getVariable ["WFBE_C_AICOM_PUBLIC_STATE_SYNC", 0]) > 0) tosetVariable. This is a semantics change, not a line-anchor drift — this page needs a substantive rewrite of the "gotcha" narrative, which is out of scope for a value/anchor-only pass. The rest of this page's citations (producers/consumers tables, seeding section) were not re-swept this pass.
Source-verified 2026-06-22 against master 0139a346, B69 8d465fce, B74 b23f557f and salvage-w10-manfilter 2e0242b3. Paths relative to Missions/[55-2hc]warfarev2_073v48co.chernarus/ unless noted. Arma 2 OA 1.64.
ChangeAICommanderFunds and GetAICommanderFunds are the read/write pair for the AI commander's private money pool, wfbe_aicom_funds. They are the AI-side mirror of the player team's ChangeTeamFunds/GetTeamFunds pair, with one load-bearing difference: the AI write is server-local (no broadcast flag), so the value never reaches clients. This page documents the accessor contract, the storage object, the locality gotcha, and the full producer/consumer catalog.
Both functions are compiled in Server\Init\Init_Server.sqf:23 (ChangeAICommanderFunds) and :27 (GetAICommanderFunds), so they exist on the server only — there is no client alias. The treasury variable is seeded once per side at side-logic init in Server\Init\Init_Server.sqf:443.
| Function | File:line | Signature | Behavior |
|---|---|---|---|
GetAICommanderFunds |
Server\Functions\Server_GetAICommanderFunds.sqf:1 |
_side -> Number |
(_this Call WFBE_CO_FNC_GetSideLogic) getVariable "wfbe_aicom_funds". Resolves the side's logic object, reads the funds variable off it. No nil-guard — see the gotcha below. |
ChangeAICommanderFunds |
Server\Functions\Server_ChangeAICommanderFunds.sqf:1-5 |
[_side, _amount] -> (none) |
Resolves _logik = _side Call WFBE_CO_FNC_GetSideLogic, then _logik setVariable ["wfbe_aicom_funds", (_side Call GetAICommanderFunds) + _amount]. Read-current-plus-amount write; _amount may be negative (debits) or positive (credits). |
The mutator declares its locals capitalized (Private ["_amount","_logik","_side"], Server_ChangeAICommanderFunds.sqf:1), the A2-valid form. It composes the two getter-style reads (GetAICommanderFunds inside the write) rather than caching, so each ChangeAICommanderFunds call performs two GetSideLogic resolutions.
The funds live on the side's logic object (WFBE_L_BLU / WFBE_L_OPF / WFBE_L_GUE), resolved through WFBE_CO_FNC_GetSideLogic (Common\Functions\Common_GetSideLogic.sqf). That resolver returns objNull when the requested side's logic global is undefined (its A2 OA nil-guard against the resistance-logic RPT flood). The side logic holds wfbe_aicom_funds, the AI-only slot. This is a different storage object from the player-team funds: wfbe_funds is always written on the team/group object, never on the side logic (Common_ChangeTeamFunds.sqf:8 _team setVariable, Init_Server.sqf:553/:596 _group setVariable, Server_OnPlayerConnected.sqf:83/:103 _team setVariable, AI_Commander_Teams.sqf:350 _g setVariable). See Side-Team-State-Function-Reference for that player-funds counterpart.
| Aspect | Player funds (ChangeTeamFunds) |
AI funds (ChangeAICommanderFunds) |
|---|---|---|
| Storage |
wfbe_funds on the team group |
wfbe_aicom_funds on the side logic |
| Write |
setVariable [..., +amount, true] — broadcast (Common\Functions\Common_ChangeTeamFunds.sqf:8) |
setVariable [..., +amount] — no flag, server-local (Server\Functions\Server_ChangeAICommanderFunds.sqf:5) |
| Visibility | replicated to clients (drives the funds HUD) | server-only; clients never see it |
Because the AI write omits the broadcast true flag, the treasury is pure server-side state. No client (and therefore no HUD readout) ever observes wfbe_aicom_funds; the only public surface for the AI's wealth is the diagnostic AICOMSTAT RPT lines that print it (AI_Commander.sqf:455, :457). This is correct by design — the AI commander has no UI — but it means the value cannot be inspected live except through the RPT.
A second gotcha: GetAICommanderFunds has no nil-guard. If GetSideLogic returns objNull (logic not placed) or the side was never seeded, getVariable "wfbe_aicom_funds" yields nil, not 0. Callers that arithmetic-compare the result (e.g. _funds < _price) rely on the seed at Init_Server.sqf:443 having run for the side. Only EAST and WEST are seeded with wfbe_aicom_funds: the seed loop iterates [[_present_east, east, _startE],[_present_west, west, _startW]] (Init_Server.sqf:582), so GUER never gets an AI-commander treasury. Resistance runs a separate player-team stipend instead (Server_GuerStipend.sqf, spawned at Init_Server.sqf:612), which writes wfbe_funds on the player groups — not wfbe_aicom_funds. There are exactly two wfbe_aicom_funds writes in the whole source (the mutator at Server_ChangeAICommanderFunds.sqf:5 and the seed at Init_Server.sqf:443), and neither touches resistance. Consequently GetAICommanderFunds called for resistance returns nil, and ChangeAICommanderFunds for resistance — e.g. the heli fly-off refund at HandleSpecial.sqf:341, which whitelists resistance in [east,west,resistance] — would evaluate nil + _amount and throw. That is a latent risk, not the safe "all three sides have a numeric balance" an earlier draft asserted.
| Producer | File:line | Amount | Note |
|---|---|---|---|
| Income tick (under cap) | Server\FSM\updateresources.sqf:82 |
round(_income * _pcMult) |
Per-interval treasury credit; only when the side has no human commander (isNull GetCommanderTeam) and _commander_enabled. Gated by _supply < _supply_max_limit. |
| Income stipend (under cap) | Server\FSM\updateresources.sqf:90 |
WFBE_C_AI_COMMANDER_INCOME_STIPEND (default 25) |
Synthetic per-tick money drip so PvE on a near-empty server keeps the AI fielding armies. Never synthesizes supply. |
| Funds-famine credit | Server\FSM\updateresources.sqf:106 |
round(_income * _pcMult) |
TOWN-STALL fix: keeps funds flowing when _supply >= _supply_max_limit (the supply-cap gate would otherwise starve the AI's wallet to $0 and stall the war). |
| Funds-famine stipend | Server\FSM\updateresources.sqf:108 |
WFBE_C_AI_COMMANDER_INCOME_STIPEND (25) |
Stipend half of the famine branch. |
| Bootstrap stipend | Server\AI\Commander\AI_Commander.sqf:228 |
round(_stipendFunds * (_tickS/60)) |
Once-per-60s bootstrap grant scaled by elapsed time (WFBE_C_AICOM_BOOTSTRAP_FUNDS, default 100), capped at 3x. The supervisor-loop owner is AI-Commander-Execution-Loop-Reference. |
| Heli fly-off refund | Server\Functions\Server_HandleSpecial.sqf:341 |
_rCost |
Refunds a commander team's empty AIR transport build cost when it flew off-map alive and was reaped. Validates _rSide in [east,west,resistance] and _rCost > 0. Documented in Server-HandleSpecial-Request-Router-Reference. |
| Wildcard salvage / bonus |
Server\Functions\AI_Commander_Wildcard.sqf:530, :823, :1003 on current stable; current B69/B74 drift the flat grant to :1016; origin/claude/salvage-w10-manfilter@2e0242b3 drifts these to :515, :808, :988
|
_bonus / _wkTotal / 5000
|
W-series wildcard payouts (losing-side catch-up bonus, W10 salvage payback, flat grant). W10 is weight-zero/inert on current stable/B69/B74; the live salvage-w10-manfilter branch only adds a Man exclusion at AI_Commander_Wildcard.sqf:794 in both maintained roots, not a manual/truck salvage payout fix. |
| Kill bounty (W12 Spoils) | Server\PVFunctions\RequestOnUnitKilled.sqf:239 |
_bounty |
Double-bounty into the AI war chest while the W12 "Spoils of War" flag is active for that side. |
| AICOM donate | Server\PVFunctions\RequestAIComDonate.sqf:76 |
_amount |
Player-initiated donation into the AI commander treasury (read-back logged at :73/:78). |
| Consumer | File:line | Amount | What it buys |
|---|---|---|---|
| Team founding | Server\AI\Commander\AI_Commander_Teams.sqf:311 |
-_price |
Founds a new commander team (skipped under the W11 free-refound flag at :286-290). Funds gate checked at :292. |
| Upgrade purchase | Server\Functions\Server_AI_Com_Upgrade.sqf:125 |
-(_cost select 1) |
Research/upgrade unlock. _cost select 1 is the funds price (TR12 fix — was select 0, the supply price). |
| Upgrade funds-surcharge | Server\Functions\Server_AI_Com_Upgrade.sqf:132 |
-_fundsSurcharge |
Task-6 fallback: pays a dry side's supply price as a funds surcharge instead of spending shared supply. |
| Base defense build |
Server\AI\Commander\AI_Commander_Base.sqf:453, :499
|
-_defPrice |
Stationary-defense construction debits. |
| Unit production | Server\AI\Commander\AI_Commander_Produce.sqf:161 |
-_priceCharged |
Per-unit factory production charge. |
Read-only consumers (affordability checks via GetAICommanderFunds, no write) include AI_Commander.sqf:172/:264, AI_Commander_Teams.sqf:61/:280, AI_Commander_Base.sqf:451/:497, AI_Commander_Produce.sqf:153, AI_Commander_Wildcard.sqf:320/:529, and Server_AI_Com_Upgrade.sqf:42.
At side-logic init the treasury is seeded with a flat value: _logik setVariable ["wfbe_aicom_funds", (missionNamespace getVariable ["WFBE_C_AI_COMMANDER_START_FUNDS", 200000])] (Server\Init\Init_Server.sqf:603). B36 hotfix replaced the old FUNDS_START×FUNDS_MULT formula with a direct read of WFBE_C_AI_COMMANDER_START_FUNDS (default 200000). The 1.5× formula no longer applies. The surrounding V0.4.1 note codifies the design rule the whole producer set obeys: synthetic money is acceptable for PvE pacing, synthetic supply is not. Supply spending stays 100% real; only the funds pool is topped up artificially (stipend, bootstrap, famine branch).
-
Side Team State Function Reference — the player-funds counterpart (
ChangeTeamFunds/GetTeamFunds) and the side-logic seed list. - AI Commander Execution Loop Reference — the supervisor loop that owns the bootstrap stipend and the spend side.
- Commander Team Driver Reference — the heli fly-off reaping that triggers the refund credit.
-
AI Commander Tunable Constants Reference — values for
INCOME_STIPEND,START_FUNDS,BOOTSTRAP_FUNDS, and the income multiplier. - Town Economy Getter Reference — the town-supply basis the income tick reads.
Home | Agent Guide | Current live state | Release 1.2.2 (B91) | Quickstart | Progress | Lifecycle wait-chain | Join/disconnect | Parameters/build | Assets/config | SQF atlas | PV index | Modules | Support/specials | Commander/HQ | Commander vote/reassign | Construction/CoIn | Construction cleanup | WDDM compositions | Factory/purchase | Upgrades/research | Towns/camps/capture | Victory/endgame | Markers/cleanup | Server runtime | AI runtime/HC | AI commander audit | HC delegation | Town AI safety | Commander reassignment | Resistance supply | Player UI workflow | UI atlas | Respawn/death | Gear template filter | Vehicle cargo loop | Service guards | UI IDD repair | UI design inspiration | WASP overlay | Feature status | Source propagation | release readiness | Tooling readiness | Integration trust | AntiStack DB | Owner decisions | Shelved registry | Abandoned feature revival | Hardening roadmap | PVF dispatch | Server authority | ICBM authority | Attack-wave authority | Telemetry families | AICOM V2 cutover | Consumer port map | Testing workflow | Server ops | Web tools | Ecosystem repos | Arma 2 OA refs | A2 traps | OA compatibility audit | Coverage ledger | Navigation inventory | Pruning ledger | Knowledge roadmap | Agent context | Collab protocol | Worklog | Audit archive 2026-07 | Briefing reference | Utes invasion concept
- Shelved AICOM concepts - revivable someday ideas (owner-shelved 2026-07-03)
Docs rule: source-backed claims only; Arma 2 OA scripting docs only; gameplay edits start in Missions/[55-2hc]warfarev2_073v48co.chernarus.
- Getting started
- Status and coordination
- Agent context
- Agent collaboration protocol
- Agent worklog
- Agent worklog archive
- Progress dashboard
- PR cleanup and integration lab
- Shelved PR #169: gear price double-count
- Shelved PR #194: Chernarus no-trees
- Coordination board
- Codebase coverage ledger
- Bottleneck removal queue
- Current source status
- Wiki mirror reconciliation
- Navigation inventory
- Registers
- Agent orchestration
- Architecture
- Architecture overview
- Mission entrypoints and lifecycle
- Lifecycle wait chain
- Player join/disconnect and AntiStack lifecycle
- Mission parameters/localization/build inputs
- Stringtable localization key-family catalog
- Source inventory
- Content structure and maps
- Assets/config/localization/parameters
- Mission start parameters index
- Code and networking
- Gameplay systems
- Core systems index
- Gameplay systems atlas
- Commander/HQ lifecycle atlas
- Economy, towns and supply
- Economy system reference
- Balance asymmetries
- Anti-stack skill-balance mechanic
- Empty-side supply income stagnation
- Towns, camps and capture atlas
- Victory and endgame atlas
- Victory conditions reference
- Territorial victory reference
- Marker cleanup and restoration
- Marker loop engine and registries
- Map marker families content catalog
- Marker subsystem function reference
- Client marker FSM updater map
- Support specials and tactical modules
- SCUD TEL tactical munitions
- Naval HVT objectives (carriers/SCUD)
- SCUD saturation strike mechanic
- Takistan airfield FPV drone design
- Construction and CoIn systems
- Structure damage reduction & friendly-fire
- Construction logic list cleanup
- Flak tower & WDDM anchor compositions
- Resistance supply scaffold
- GUER Insurgents faction overview
- GUER Insurgents branch audit
- GUER insurgent player economy
- GUER air-defense loop (Ka-137/Mi-24)
- Upgrades and research atlas
- Supply mission architecture
- Supply mission authority cleanup
- Current supply helicopters PR1
- Respawn and death-loop lifecycle
- Vehicle theft economy pitch
- GUER tunnel network pitch
- Content, reference and catalogs
- Faction unit/vehicle roster catalog
- Auxiliary/SF/civilian unit catalog
- Gear store loadout route catalog
- Upgrade research (cross-faction)
- Gear store price and upgrade catalog
- Gear store catalog (complete, per faction)
- Defense structures catalog
- Artillery reference per faction
- AI squad team templates catalog
- Town AI lifecycle reference
- Town AI group composition catalog
- Class-skill system reference
- Player skill abilities reference
- Default gear template content catalog
- Chernarus map content reference
- Takistan map content reference
- Takistan features
- Takistan parity reference
- Takistan oilfields objective reference
- IRS IR-smoke countermeasure
- Arty module special munitions
- Zeta cargo sling-load reference
- Spawn primitive function reference
- Kill and score pipeline
- Waypoint helper function reference
- Position and proximity function reference
- Side/team state function reference
- Player AI watchdog and recovery
- AICOM stuck-recovery v2
- LoadoutManager data-model contributor guide
- Discord status bot setup and reference
- GLOBALGAMESTATS extension reference
- New player quickstart (player guide)
- Optional client mods (player guide)
- Earning funds and score (player guide)
- Vehicle service and logistics (player guide)
- Commander's handbook (player guide)
- Tactical support menu
- Paradrop player experience
- Supply missions (player guide)
- In-game briefing & Diary field manual
- Playable maps catalog
- Faction root variables reference
- Faction base structures catalog
- Counter-battery radar system
- Bank, Reserve and Artillery Radar structures
- Map ruleset model and object config
- Countermeasures module reference
- Vehicle countermeasure (flares/spoofing)
- UAV terminal and spotter system
- Artillery firing function reference
- Service Point pricing model
- Medic redeployment truck (forward spawn)
- Side-patrol runtime and convoy mechanics
- Day/night cycle and weather system
- Config lookup helper reference
- CIPHER sort utilities reference
- Modded maps status and content
- BattlEye filter setup and OA taxonomy
- Player squad/group join protocol
- AutoFlip vehicle recovery
- Engine stealth fuel toggle
- Valhalla vehicle climbing-assist
- Missile and ordnance Fired-EH reference
- Vehicle equip and rearm reference
- Array and collection utilities
- Server composition spawner reference
- Upgrade queue server loop
- Map boundaries and off-map enforcement
- Namespace/profile/diagnostic utilities
- Group bool getVariable A2-OA trap
- Vehicle weapon balance init
- View distance auto-throttle
- Camp & respawn-camp getters
- Performance audit writer
- Site clearance (bulldozer)
- Factory queue cancel & refund
- AI commander tunable constants
- Experimental feature-flag constants
- Flag system quick reference
- Mission tunable constants catalog
- Gear parsing & cargo capacity
- Structure dressing function
- Paradrop delivery functions
- ICBM nuke client VFX & radiation
- Server HandleSpecial router
- LocalizeMessage chat router
- Gear buy-menu render & price functions
- Server broadcast & telemetry loops
- Per-unit client init pipeline
- Vehicle marking & texture pipeline
- Defense category & budget
- Legacy AI order primitives
- Commander-team driver
- AICOM command verbs
- AICOM behavior fix taxonomy
- AI commander wildcard deck reference
- AICOM aircraft and airfield system
- Static-defense manning
- End-of-game stats screen
- AI commander execution loop
- Deployable bipod / weapon resting
- Town-economy getters
- Server-init deadspawn & airfield probe
- GUER VBIED detonate action
- Resource income-tick engine
- AI commander treasury accessors
- PVF send-helper contracts
- AICOM logging & AICOMSTAT telemetry
- AICOMSTAT v2 event census
- WASPSCALE v2 telemetry
- WASPSCALE v2-ext coverage audit
- Telemetry families reference
- Group lifecycle & entity reaping
- Batch AI spawner orchestrator
- Client funds/income HUD readout
- Server group GC & cap warning
- Town runtime tuning constants
- Client input/hotkey handler
- WASP base-repair system
- WASP DropRPG launcher/ordnance
- CoIn construction-interface client engine
- Town-capture garrison & airfield rebuild
- Map-control & minimap templates
- Client FPS & state telemetry
- Client service-proximity getters
- Airfield-exclusive roster & unit hints
- Unit-camera spectator system
- Town-garrison patrol/defense worker
- RequestTeamUpdate squad-discipline
- Arma2Warfare GPT assistant
- LoadoutManager build configs & defines
- GLOBALGAMESTATS extension logging
- Discord bot instrumented logging
- Eden/Everon & Taviana map content
- Cruise missile strike asset
- AI / HC
- AI headless and performance
- AI mods and pathfinding reference
- Headless client scaling and topology
- AI runtime/HC loop map
- Headless client init and stat loop
- HC delegation target selection
- Player AI caps and role balance
- Old WarfareBE FPS comparison
- AI commander autonomy audit
- Upstream BE 2073 AICOM delta
- Parent 2.073 divergence audit
- AI commander capture & fun plan
- AI commander B69 improvement roadmap
- AI commander B69 implementation sketches
- AICOM V2 cutover status
- Headless delegation and failover
- Commander reassignment call shape
- GUER Director living-resistance pitch
- Quality and operations
- Foundation perf findings & Tier-3 dead-ends
- Dead/stale code register
- Commander vote/reassignment
- Attack-wave authority
- Server runtime and operations
- Server ops runbook
- JIP enrollment & client data delivery (b74.2 lessons)
- Server gameplay runtime atlas
- PerformanceAuditAnalyzer
- Performance opportunity sweep
- Documentation plan
- Knowledge platform roadmap
- Wiki quality audit
- Wiki pruning and relevance ledger
- Audit findings queue (2026-06-03)
- Deep review findings
- Client UI / server-loop perf findings
- Performance gain simulation
- Self-host testing field notes
- Cleanup and work lanes
- Hardening and authority
- UI / player workflows
- Client UI, HUD and menus
- UI HUD and dialogs
- Player UI workflow map
- Client UI systems atlas
- UI IDD collision repair
- UI control class library reference
- UI theme palette and style macros
- UI design inspiration 2026-07
- Available-actions client gate FSM
- Gear/loadout/EASA atlas
- Gear template profile filter
- Vehicle cargo equip loop bounds
- Factory and purchase systems atlas
- Service menu affordability guards
- WASP overlay
- Class-skill system reference
- Skin selector and class swap
- Earplugs audio toggle
- Mission audio catalog
- HQ radio knowledge-base catalog
- QoL trio player hints
- Player vehicle/travel actions
- Tooling / release / integrations
- Tools and build workflow
- Warfare web tools
- Ecosystem & companion repos
- Zargabad tooling parity
- July 2026 release readiness
- Operator monitor and CPU affinity tools
- Tooling release readiness audit
- Source fix propagation queue
- Agent release readiness ledger
- Release source intake map
- Testing/debugging/release workflow
- Current RPT release gate
- RPT telemetry consumer port map
- External integrations
- Integration trust boundary audit
- AntiStack database extension audit
- Community & Dev
- Community & Dev
- Miksuu upstream wiki import / archive index
- Upstream changelog feature leads
- Developer history and upstream lessons
- Upstream Miksuu commit intel
- Upstream mining ledger
- Archive script mining v2
- Upstream BE 2073 AICOM delta
- Parent 2.073 divergence audit
- PR8 and Drone upstream lesson match
- Development lessons learned
- External research reports
- Audit archive 2026-07
- Briefing reference
- Utes invasion concept
- Miksuu archive: Home
- Miksuu archive: Welcome
- Miksuu archive: Big announcements
- Miksuu archive: Changelog
- Miksuu archive: Development process
- Miksuu archive: Discord bot
- Miksuu archive: Gameplay videos
- Miksuu archive: LoadoutManager
- Miksuu archive: Chernarus script architecture
- Base-game visual catalogs
- Compatibility and references
- HC upstream history and lessons
- Player stats branch audit
- BuyMenu EASA QoL branch audit
- Perf quick wins branch audit
- Commander positions branch audit
- Zargabad branch audit
- Quad AI Commander concept
- Arma 2 OA external reference guide
- Base-game config & image reference
- Arma 2 OA compatibility audit
- Arma 2 OA agent traps reference
- Arma 2 OA command versions
- Wiki source consistency
- External Arma 2 OA reference index