I'm trying to make a generic notification for the player after an enemy unit is killed and turned into a slave. I have the code necessary for the switch, but don't understand how to tie a notification to it. So far, I can only get it to work when an enemy enslaves the human player's units, which is the opposite of what I want. Here's the script I'm working with: Code: print("Battle capture script loaded") include("MischaIteratingPlotsFunctions") include("CityNearbyMapDatasV4") function BattleCapture(iPlayer, iUnit, iUnitType, iX, iY, bDelay, iByPlayer) local pPlayer = Players[iPlayer] local pByPlayer = Players[iByPlayer] local teamID = pPlayer:GetTeam() local pPlayerTeam = Teams[teamID] local pUnit = pPlayer:GetUnitByID(iUnit) print("Unit destroyed") print("iPlayer = " .. iPlayer) print("iByPlayer = " .. iByPlayer) -- Must have been killed by another Player if iPlayer == iByPlayer then return end if iByPlayer == -1 then return end local pPlot = pUnit:GetPlot() for pAdjacentPlot in PlotAreaSweepIterator(pPlot, 1, SECTOR_NORTH, DIRECTION_CLOCKWISE, DIRECTION_OUTWARDS, CENTRE_EXCLUDE) do print("Checking plot") for iVal = 0,(pAdjacentPlot:GetNumUnits() - 1) do print("Checking unit") local loopUnit = pAdjacentPlot:GetUnit(iVal) if loopUnit:GetOwner() ~= iPlayer then print("Not same owner") local loopUnitOwner = loopUnit:GetOwner() local otherPlayer = Players[loopUnitOwner] local otherTeamID = otherPlayer:GetTeam() local loopDMG = loopUnit:GetDamage() if pPlayerTeam:IsAtWar(otherTeamID) then if not (pAdjacentPlot:IsCity()) then print("Target affected") local sUnitType = GameInfoTypes.UNIT_LABORER_FREE local nUnit = Players[iByPlayer]:InitUnit(sUnitType, pAdjacentPlot:GetX(), pAdjacentPlot:GetY()) nUnit:SetDamage(loopDMG) print("Laborer spawned") if pPlayer:IsHuman() then local title = "Enslaved Laborers!"; local descr = "You have successfully captured an enemy unit and enslaved them!"; pPlayer:AddNotification(NotificationTypes.NOTIFICATION_GENERIC, descr, title, pAdjacentPlot:GetX(), pAdjacentPlot:GetY()); print("Notification added") end end end end end end end GameEvents.UnitPrekill.Add(BattleCapture) I've tried adding a notification onto pByPlayer because that's the variable that specifies which player's attacking and killing the other unit, but it doesn't execute at all when I do that. I don't see any log errors either. Any suggestions?