The_Space_Cows
Chieftain
- Joined
- Mar 18, 2023
- Messages
- 19
So I've successfully implemented a feature where a player gains Science from enemy unit kills equal to their combat strength, and it does indeed update the progress toward the next technology like I want it to. I want the amount of Science gained to display on the screen after the battle, exactly like it does after you adopt Honor with the amount of Culture or Gold or from Montezuma's unique ability.
I just want a little toast to pop up, "+8 *beakers*", above the tile where the enemy unit was just killed. The No Quitter's Balance Mod has this feature, but I don't know how to de-compile a DLL yet to look at their code.
In case it helps or someone wants to see it, here is my Lua Code:
I have made use of an event hook from a modded DLL made by Whoward69 (DLL - Various Mod Components) for GameEvents.UnitPrekill
Can anyone help me out or point me in the right direction? This community has been very helpful and supportive, especially considering this game is over ten years old
I just want a little toast to pop up, "+8 *beakers*", above the tile where the enemy unit was just killed. The No Quitter's Balance Mod has this feature, but I don't know how to de-compile a DLL yet to look at their code.
In case it helps or someone wants to see it, here is my Lua Code:
Code:
function GiveScienceFromKills(iPlayer, iUnit, iUnitType, iX, iY, bDelay, iByPlayer)
print("Called GiveScienceFromKills")
if (iByPlayer == 63 or iByPlayer == -1) then
return
end
print("Player was not Barbarians")
local player = Players[iByPlayer]
if (not player:HasPolicy(GameInfoTypes.POLICY_HONOR_FINISHER)) then
return
end
print("Player has adopted all policies in the Honor tree")
local research = Teams[player:GetTeam()]:GetTeamTechs()
local unitCombatStrength = GameInfo.Units[iUnitType].Combat
research:ChangeResearchProgressTimes100(player:GetCurrentResearch(), 100 * unitCombatStrength);
print("Added beakers ", unitCombatStrength)
end
GameEvents.UnitPrekill.Add(GiveScienceFromKills)
print("Science from Kills.lua loaded successfully")
I have made use of an event hook from a modded DLL made by Whoward69 (DLL - Various Mod Components) for GameEvents.UnitPrekill
Can anyone help me out or point me in the right direction? This community has been very helpful and supportive, especially considering this game is over ten years old
Last edited: