Querying the game engine data using Requirements

greyTiger

Warlord
Joined
Oct 7, 2010
Messages
198
Location
Australia
I am trying to add a victory that checks for the total gold of the player, along with the total number of luxury resources owned compared to the number that spawned on the map.

I can see no RequirementTypes that seem to allow this, and I am uncertain if it is possible to add new RequirementTypes so I can implement the function myself.

Has anyone discovered how to access simple player data using the Requirements table? If I need to resort to lua to implement this functionality would anyone know which game files would need to be updated to allow me to perform a check at the end of each turn for the victory conditions being met.
 
Not sure if it helps, but I did see this commented out in ARXManager.lua
Code:
    -- Add custom (modded) victory types
--    for row in GameInfo.Victories() do
--        local victoryType:string = row.VictoryType;
--        if IsCustomVictoryType(victoryType) and Game.IsVictoryEnabled(victoryType) then
--            PopulateVictoryType(victoryType);
--        end
--    end

I don't think there is a requirement that checks total luxuries owned against total on map.
You could add an new turn check to most any ingame lua, or just create a new one. I haven't looked at victories, so I couldn't tell you if there is currently a command that works in ui context to trigger a victory though.
 
Not sure if it helps, but I did see this commented out in ARXManager.lua

I don't think there is a requirement that checks total luxuries owned against total on map.
You could add an new turn check to most any ingame lua, or just create a new one. I haven't looked at victories, so I couldn't tell you if there is currently a command that works in ui context to trigger a victory though.

Thanks for the info. I have taken a look at the ARXManager.lua and unfortunately I believe this does not help with my issue. Think I may have found a workaround though. Came across the Events.OnLocalPlayerTurnBegin and Events.OnLocalPlayerTurnEnd game engine events which I believe I can hook into to run my specific checks for gold amount and resources owned. If we have the ability to update the RequirementArguments in the database when the game is running I should be able to do what I need to get the victory condition updated (atleast for the human player at first).
 
Back
Top Bottom