Woprok / AOE4-AdvancedGameSettings

Game mode that allows more customization over standard game rules in Age of Empires IV
GNU General Public License v3.0
60 stars 23 forks source link

Enhancement - Kill Off Remaining Units Upon Elimination #79

Open Neptune3215 opened 1 year ago

Neptune3215 commented 1 year ago

Can an enhancement be made so all remaining traders and villagers instantly die when a player is eliminated?

rbrash1287 commented 1 year ago

I have been researching this, testing it, basically trying anything from my little book of .lua and moddings.. its been mentioned in main AOE discord as well as the unofficial discord.

Of the thousands of games using AGS setts and mostly Forest Nothing, this is by far the worst. Wish I could contribute and from studying lua commands I would think a clever script could be made that would remove all entities idle/defeared on a map...

Woprok commented 1 year ago

It's not that complicated to kill off remaining units. Moment player is eliminated is well known and as long as he was not yet killed by C++ calls, you can gather information about player units and buildings. EGroup/SGroup get all player entities / squads exists if I remember correctly. Only thing left is to find exact place where you want to invoke this, for AGS that would be right here:

https://github.com/Woprok/AOE4-AdvancedGameSettings/blob/master/assets/scar/coreconditions/ags_conditions_match.scar

function AGS_SetPlayerDefeated(player_id, presentation_function, defeat_reason, opt_objective_pop)
        -- most likely as first call, might work as second or third
    AGS_SetOnePlayerDefeated(player_id, presentation_function, defeat_reason, opt_objective_pop)
    Core_CallDelegateFunctions("OnPlayerEliminated", Core_GetPlayersTableEntry(player_id), defeat_reason)
end
Woprok commented 1 year ago

But as any other change to this mod, I don't have time & motivation to do it currently.