import sys, host, bf2, math, realitycore as rcore, realityadmin as radmin, realitytimer as rtimer #simple script to detect end of round on maps where there may be no end of round ticket bleed or where eor ticket bleed might be too slow,and force end of round with victory instead of draw def init(): host.registerHandler('ControlPointChangedOwner', onCPStatusChange) def eorEnum(thisCp): for cp in rcore.getControlPoints(): #if cp is capturable, and is capturable by team 2 and is not owned by team 2 then return as there's at least one capturable flag owned by bot team if cp.cp_getParam('unableToChangeTeam') != 1 and cp.cp_getParam('allowCaptureByTeam', 2) == 1 and cp.cp_getParam('team') == 1: radmin.globalMessage("bot team owns at least 1 capturable flag") return #if cp is capturable, and is capturable by team 2 and is not owned by team 2 or team 1 then return as there's at least one capturable flag that remains to be captured. if cp.cp_getParam('unableToChangeTeam') != 1 and cp.cp_getParam('allowCaptureByTeam', 2) == 1 and cp.cp_getParam('team') != 2: radmin.globalMessage("at least one flag remains to be captured.") #i.e at least one flag is neutral return #if this line is reached, all cappable cp's are owned by player team, so set bot team tickets to 0 & trigger end of round radmin.globalMessage("End Of Round Will Now Be Forcefully Invoked, As There Appears To Be No Ticket Bleed... GG") bf2.gameLogic.setTickets(1, 0) #set team 1/bot team tickets to 0 def onCPStatusChange(cp, top): #invoke end of round check N seconds after any flag status changes rtimer.fireOnce(eorEnum, 15, cp)