When you have more cps point increase?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: When you have more cps point increase?

Post by lucasfart »

The only other errors i can see which might cause a problem is your missing tur.lvl, although I'm not sure if that'd cause a crash...Have you munged the tur.lvl into your map?
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: When you have more cps point increase?

Post by Noobasaurus »

lucasfart wrote:The only other errors i can see which might cause a problem is your missing tur.lvl, although I'm not sure if that'd cause a crash...Have you munged the tur.lvl into your map?
This is the default map. I'll take that out of the lua and see what happens.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: When you have more cps point increase?

Post by lucasfart »

Oh. If its a default map it probably won't make a difference. Sorry but I'm not much of a pro when it comes to all this scripting, so you'll probably need someone more experienced then me to help you with this....
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: When you have more cps point increase?

Post by [RDH]Zerted »

Fix your soldier animation pool errors. That's adding another SetMemoryPoolSize line with the others. Before asking, reread the error message and think what's the name of the memory pool you need to change and how large you think it should be. This will make your map a little more stable in multiplayer and will remove all those messages from the debug log.

As for your CP problem, please fully post both your main lua script and your edited ObjectiveConquest.lua. If your main lua script is the one from your other topic, comment out (or delete) the following lines:

Code: Select all

 cp5 = CommandPost:New{name = "Local_CP"}
 cp6 = CommandPost:New{name = "acklay"}
You only need those lines if those CPs are part of your Conquest objective and since you didn't conquest:AddCommandPost() them, I'm guessing they aren't (or maybe you forgot that part?).
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: When you have more cps point increase?

Post by Noobasaurus »

[RDH]Zerted wrote:If your main lua script is the one from your other topic, comment out (or delete) the following lines:
Thanks, I never knew you had to do that for invisible ones.
Test map luas:
TESg_con.lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveConquest")

-- Empire Attacking (attacker is always #1)
local ALL = 2
local IMP = 1
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)

conquest:Start()

EnableSPHeroRules()

end


---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------

function ScriptInit()

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(40)
SetMaxPlayerFlyHeight(40)


SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo


ReadDataFile("sound\\tat.lvl;tat2gcw")
ReadDataFile("SIDE\\all.lvl",
"all_inf_rifleman",
"all_inf_rocketeer",
"all_inf_sniper",
"all_inf_engineer",
"all_inf_officer",
"all_inf_wookiee",
"all_hero_hansolo_tat")

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman",
"imp_inf_rocketeer",
"imp_inf_engineer",
"imp_inf_sniper",
"imp_inf_officer",
"imp_inf_dark_trooper",
"imp_hero_bobafett",
"imp_fly_destroyer_dome" )

SetupTeams{
all = {
team = ALL,
units = 20,
reinforcements = -1,
soldier = { "all_inf_rifleman",9, 25},
assault = { "all_inf_rocketeer",1,4},
engineer = { "all_inf_engineer",1,4},
sniper = { "all_inf_sniper",1,4},
officer = { "all_inf_officer",1,4},
special = { "all_inf_wookiee",1,4},

},
imp = {
team = IMP,
units = 20,
reinforcements = -1,
soldier = { "imp_inf_rifleman",9, 25},
assault = { "imp_inf_rocketeer",1,4},
engineer = { "imp_inf_engineer",1,4},
sniper = { "imp_inf_sniper",1,4},
officer = { "imp_inf_officer",1,4},
special = { "imp_inf_dark_trooper",1,4},
},
}

SetHeroClass(ALL, "all_hero_hansolo_tat")
SetHeroClass(IMP, "imp_hero_bobafett")

-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)

local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:TES\\TES.lvl", "TES_conquest")
SetDenseEnvironment("false")


-- Sound Stats

voiceSlow = OpenAudioStream("sound\\global.lvl", "all_unit_vo_slow")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "des_unit_vo_slow", voiceSlow)
AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)

voiceQuick = OpenAudioStream("sound\\global.lvl", "all_unit_vo_quick")
AudioStreamAppendSegments("sound\\global.lvl", "imp_unit_vo_quick", voiceQuick)

OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\tat.lvl", "tat2")
OpenAudioStream("sound\\tat.lvl", "tat2")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")

SetBleedingVoiceOver(ALL, ALL, "all_off_com_report_us_overwhelmed", 1)
SetBleedingVoiceOver(ALL, IMP, "all_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, ALL, "imp_off_com_report_enemy_losing", 1)
SetBleedingVoiceOver(IMP, IMP, "imp_off_com_report_us_overwhelmed", 1)

SetLowReinforcementsVoiceOver(ALL, ALL, "all_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(ALL, IMP, "all_off_victory_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, IMP, "imp_off_defeat_im", .1, 1)
SetLowReinforcementsVoiceOver(IMP, ALL, "imp_off_victory_im", .1, 1)

SetOutOfBoundsVoiceOver(2, "Allleaving")
SetOutOfBoundsVoiceOver(1, "Impleaving")

SetAmbientMusic(ALL, 1.0, "all_tat_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_tat_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_tat_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_tat_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_tat_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_tat_amb_end", 2,1)

SetVictoryMusic(ALL, "all_tat_amb_victory")
SetDefeatMusic (ALL, "all_tat_amb_defeat")
SetVictoryMusic(IMP, "imp_tat_amb_victory")
SetDefeatMusic (IMP, "imp_tat_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.974338, -0.222180, 0.035172, 0.008020, -82.664650, 23.668301, 43.955681);
AddCameraShot(0.390197, -0.089729, -0.893040, -0.205362, 23.563562, 12.914885, -101.465561);
AddCameraShot(0.169759, 0.002225, -0.985398, 0.012916, 126.972809, 4.039628, -22.020613);
AddCameraShot(0.677453, -0.041535, 0.733016, 0.044942, 97.517807, 4.039628, 36.853477);
AddCameraShot(0.866029, -0.156506, 0.467299, 0.084449, 7.685640, 7.130688, -10.895234);
end
[/code]
ObjectiveConquest.lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("Objective")

self.bleedBaseRate = 0.3 --rate at which points are added


local UpdateBleedRate = function(team)
--count how many CPs each team has
local cpCount = {0, 0}
for i, cp in pairs(self.commandPosts) do
local cpTeam = GetObjectTeam(cp.name)
cpCount[cpTeam] = (cpCount[cpTeam] or 0) + 1
print("CP '"..cp.name"' counted. Team "..cpTeam.." now has "..cpCount[cpTeam].." cps")
end

--find team with the highest count (only looking at teams 1 and 2)
local bleedTeam = 1
local otherTeam = 2
if cpCount[1] == cpCount[2] then
--no team has more CPs than the others, so stop this team's bleeding
StopTimer(self.bleedTimer[team])

return
elseif cpCount[2] > cpCount[1] then
bleedTeam = 2
otherTeam = 1
end
print("Bleed team, other team:", bleedTeam, otherTeam)

--UpdateBleedRate is called on both teams, so make sure not to start the bleed timer twice (only one team can bleed in this mod)
if bleedTeam ~= team then return end

--increases the bleed rate based on how many more CPs the bleed team has over the other team
local bleedRate = self.bleedBaseRate * (cpCount[bleedTeam] - cpCount[otherTeam])
print("Bleed rate:", bleedRate)

--setup the bleedrate display (i.e. how fast the score flashes in the HUD)
SetBleedRate(team, bleedRate)

--start bleeding reinforcements
StopTimer(self.bleedTimer[team])
SetTimerValue(self.bleedTimer[team], 1.0)
SetTimerRate(self.bleedTimer[team], bleedRate)
StartTimer(self.bleedTimer[team])
end

local InitBleedTime = function(team)
self.bleedTimer[team] = CreateTime("bleed" .. team)

OnTimerElapse(
function(timer)
--bleed/increase points for the given team
local points = GetTeamPoints(team) + 1
SetTeamPoints(team, points)
print("Bleed a point to team, points:", team, points)

--restart the timer
SetTimerValue(timer, GetTimerValue(timer) + 1.0)
StartTimer(timer)
end, self.bleedTimer[team])
end

[/code]
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: When you have more cps point increase?

Post by [RDH]Zerted »

If your CPs are not part of the Conquest objective, they shouldn't be in the lua.

The code I posted replaces only the functions with the same names (UpdateBleedRate and InitBleedTime). You replaced the entire ObjectiveConquest file with that code. Copy the original ObjectiveConquest.lua from your mod tools (or from a different map you're working on) and make those two replacements only. If it doesn't work after that, post your new ObjectiveConquest again.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: When you have more cps point increase?

Post by Noobasaurus »

[RDH]Zerted wrote:The code I posted replaces only the functions with the same names (UpdateBleedRate and InitBleedTime). You replaced the entire ObjectiveConquest file with that code. Copy the original ObjectiveConquest.lua from your mod tools (or from a different map you're working on) and make those two replacements only. If it doesn't work after that, post your new ObjectiveConquest again.
Well, I used search to find those but I wasn't really sure what part of the new code to replace them with, but I tried and got this error:

Code: Select all

M:\BF2_Modtools\data_TES\_BUILD\Common\..\..\..\ToolsFL\Bin\luac.exe: ..\..\common\scripts\ObjectiveConquest.lua:35: `}' expected (to close `{' at line 33) near `='
ObjectiveConquest.lua
Hidden/Spoiler:
[code]-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("Objective")

--=============================
-- CommandPost
-- Class representing a specific CP, allowing some measure of customization
-- of what happens at each post when it is captured
--=============================
CommandPost =
{
-- fields that need to be specified when calling New()
name = "noname", --name of the CP

-- Overridable functions
OnCapture = function()
--override me to customize behavior when the command post is captured
end,
}

function CommandPost:New(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end

--=============================
-- ObjectiveConquest
--=============================
ObjectiveConquest = Objective:New
{
icon = "hud_objective_icon_circle",
self.bleedBaseRate = 0.3
}

function ObjectiveConquest:GetOpposingTeam(team)
if team == self.teamATT then
return self.teamDEF
else
return self.teamATT
end
end


function ObjectiveConquest:AddCommandPost(cp)
--make sure we have a table to add the cp to
self.commandPosts = self.commandPosts or {}

--do all the error checking we can on the cp
assert(cp.name, "WARNING: no name supplied for the command post")
cp.name = string.lower(cp.name)

self.commandPosts[cp.name] = cp

--keep a running tally of the bleedValue relative to each team
if not self.totalBleedValue then
self.totalBleedValue = {}
self.totalBleedValue[self.teamATT] = 0
self.totalBleedValue[self.teamDEF] = 0
end
self.totalBleedValue[self.teamATT] = self.totalBleedValue[self.teamATT] + GetCommandPostBleedValue(cp.name, self.teamATT)
self.totalBleedValue[self.teamDEF] = self.totalBleedValue[self.teamDEF] + GetCommandPostBleedValue(cp.name, self.teamDEF)
end


--Add a threshold value for bleeding. Basically
function ObjectiveConquest:AddBleedThreshold(team, threshold, rate)
--assert(team == self.teamATT or team == self.teamDEF, "invalid team!")

if not self.bleedRates then
--initialize the bleedRates two-dimensional array
self.bleedRates = {}
self.bleedRates[self.teamATT] = {}
self.bleedRates[self.teamDEF] = {}
end

self.bleedRates[team][threshold] = rate
end

-- Get game time limit as set in game options menu, if any. 0 if none.
function ObjectiveConquest:GetGameTimeLimit()
return ScriptCB_GetCONMaxTimeLimit()
end

function ObjectiveConquest:GameOptionsTimeLimitUp()
local team1pts = GetReinforcementCount(1)
local team2pts = GetReinforcementCount(2)
if ( team1pts > team2pts ) then
MissionVictory(1)
elseif ( team1pts < team2pts ) then
MissionVictory(2)
else
--tied, so victory for both
MissionVictory({1,2})
end
end

function ObjectiveConquest:Start()
--===============================
-- Local functions
--===============================

local UpdateBleedRate = function(team)
--count how many CPs each team has
local cpCount = {0, 0}
for i, cp in pairs(self.commandPosts) do
local cpTeam = GetObjectTeam(cp.name)
cpCount[cpTeam] = (cpCount[cpTeam] or 0) + 1
print("CP '"..cp.name"' counted. Team "..cpTeam.." now has "..cpCount[cpTeam].." cps")
end

--find team with the highest count (only looking at teams 1 and 2)
local bleedTeam = 1
local otherTeam = 2
if cpCount[1] == cpCount[2] then
--no team has more CPs than the others, so stop this team's bleeding
StopTimer(self.bleedTimer[team])

return
elseif cpCount[2] > cpCount[1] then
bleedTeam = 2
otherTeam = 1
end
print("Bleed team, other team:", bleedTeam, otherTeam)

--UpdateBleedRate is called on both teams, so make sure not to start the bleed timer twice (only one team can bleed in this mod)
if bleedTeam ~= team then return end

--increases the bleed rate based on how many more CPs the bleed team has over the other team
local bleedRate = self.bleedBaseRate * (cpCount[bleedTeam] - cpCount[otherTeam])
print("Bleed rate:", bleedRate)

--setup the bleedrate display (i.e. how fast the score flashes in the HUD)
SetBleedRate(team, bleedRate)

--start bleeding reinforcements
StopTimer(self.bleedTimer[team])
SetTimerValue(self.bleedTimer[team], 1.0)
SetTimerRate(self.bleedTimer[team], bleedRate)
StartTimer(self.bleedTimer[team])
end

local InitBleedTime = function(team)
self.bleedTimer[team] = CreateTime("bleed" .. team)

OnTimerElapse(
function(timer)
--bleed/increase points for the given team
local points = GetTeamPoints(team) + 1
SetTeamPoints(team, points)
print("Bleed a point to team, points:", team, points)

--restart the timer
SetTimerValue(timer, GetTimerValue(timer) + 1.0)
StartTimer(timer)
end, self.bleedTimer[team])
end



--==========
-- Set the number of guys in the level to number in game options
--==========
ScriptCB_SetNumBots(ScriptCB_GetCONNumBots())

--===============================
-- Initialization logic
--===============================
--initialize the base objective data first
Objective.Start(self)

--initialize internal values
self.commandPosts = self.commandPosts or {}

self.bleedTimer = {}
InitBleedTimer(self.teamATT)
InitBleedTimer(self.teamDEF)

InitDefeatTimer()

if self.multiplayerRules then
self.disallowDefensiveVictory = false
else
self.disallowDefensiveVictory = true --in single player/co-op, the defense can't win by capping all the CPs
end

numCPs = 0
for i, cp in pairs(self.commandPosts) do
if not self.multiplayerRules then
MapAddEntityMarker(cp.name, self.icon, 4.0, self.teamATT, "YELLOW", true)
end
numCPs = numCPs + 1
end
if(numCPs == 0) then
print ("ERROR: no valid CommandPosts were added to the ObjectiveConquest")
return
end

--set AI goals
self.AIGoals = {}
if self.AIGoalWeight > 0.0 then
table.insert(self.AIGoals, AddAIGoal(self.teamATT, "Conquest", 100*self.AIGoalWeight))
table.insert(self.AIGoals, AddAIGoal(self.teamDEF, "Conquest", 100*self.AIGoalWeight))
end

--do an initial update on the state
UpdateState()

--=======================================
-- Event responses
--=======================================
-- command post captures
OnFinishCapture(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

UpdatePostMapMarker(postPtr)
UpdateState()
end
)

-- command post neutralize
OnFinishNeutralize(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

UpdatePostMapMarker(postPtr)
UpdateState()
end
)

-- command post spawn
OnCommandPostRespawn(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

UpdatePostMapMarker(postPtr)
UpdateState()
end
)

-- command post kill
OnCommandPostKill(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

if not self.multiplayerRules then
MapRemoveEntityMarker(postPtr, self.teamATT)
end

UpdateState()
end
)
end

function ObjectiveConquest:Complete(winningTeam)
if not self.multiplayerRules then
--remove all the cp markers
for i, cp in pairs(self.commandPosts) do
MapRemoveEntityMarker(cp.name)
end
end

--then call the default objective complete method
Objective.Complete(self, winningTeam)
end
s) do
local cpTeam = GetObjectTeam(cp.name)
cpCount[cpTeam] = (cpCount[cpTeam] or 0) + 1
print("CP '"..cp.name"' counted. Team "..cpTeam.." now has "..cpCount[cpTeam].." cps")
end

--find team with the highest count (only looking at teams 1 and 2)
local bleedTeam = 1
local otherTeam = 2
if cpCount[1] == cpCount[2] then
--no team has more CPs than the others, so stop this team's bleeding
StopTimer(self.bleedTimer[team])

return
elseif cpCount[2] > cpCount[1] then
bleedTeam = 2
otherTeam = 1
end
print("Bleed team, other team:", bleedTeam, otherTeam)

--UpdateBleedRate is called on both teams, so make sure not to start the bleed timer twice (only one team can bleed in this mod)
if bleedTeam ~= team then return end

--increases the bleed rate based on how many more CPs the bleed team has over the other team
local bleedRate = self.bleedBaseRate * (cpCount[bleedTeam] - cpCount[otherTeam])
print("Bleed rate:", bleedRate)

--setup the bleedrate display (i.e. how fast the score flashes in the HUD)
SetBleedRate(team, bleedRate)

--start bleeding reinforcements
StopTimer(self.bleedTimer[team])
SetTimerValue(self.bleedTimer[team], 1.0)
SetTimerRate(self.bleedTimer[team], bleedRate)
StartTimer(self.bleedTimer[team])
end

local InitBleedTime = function(team)
self.bleedTimer[team] = CreateTime("bleed" .. team)

OnTimerElapse(
function(timer)
--bleed/increase points for the given team
local points = GetTeamPoints(team) + 1
SetTeamPoints(team, points)
print("Bleed a point to team, points:", team, points)

--restart the timer
SetTimerValue(timer, GetTimerValue(timer) + 1.0)
StartTimer(timer)
end, self.bleedTimer[team])
end

[/code]
EDIT: Found out what you meant and got this:
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("Objective")

--=============================
-- CommandPost
-- Class representing a specific CP, allowing some measure of customization
-- of what happens at each post when it is captured
--=============================
CommandPost =
{
-- fields that need to be specified when calling New()
name = "noname", --name of the CP

-- Overridable functions
OnCapture = function()
--override me to customize behavior when the command post is captured
end,
}

function CommandPost:New(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end

--=============================
-- ObjectiveConquest
-- Handles the logic for a conquest game (A.K.A. capture the command posts)
--=============================
ObjectiveConquest = Objective:New
{
-- external values
icon = "hud_objective_icon_circle",

-- internal values
self.bleedBaseRate = 0.3 --rate at which points are added


}

function ObjectiveConquest:GetOpposingTeam(team)
if team == self.teamATT then
return self.teamDEF
else
return self.teamATT
end
end


function ObjectiveConquest:AddCommandPost(cp)
--make sure we have a table to add the cp to
self.commandPosts = self.commandPosts or {}

--do all the error checking we can on the cp
assert(cp.name, "WARNING: no name supplied for the command post")
cp.name = string.lower(cp.name)

self.commandPosts[cp.name] = cp

--keep a running tally of the bleedValue relative to each team
if not self.totalBleedValue then
self.totalBleedValue = {}
self.totalBleedValue[self.teamATT] = 0
self.totalBleedValue[self.teamDEF] = 0
end
self.totalBleedValue[self.teamATT] = self.totalBleedValue[self.teamATT] + GetCommandPostBleedValue(cp.name, self.teamATT)
self.totalBleedValue[self.teamDEF] = self.totalBleedValue[self.teamDEF] + GetCommandPostBleedValue(cp.name, self.teamDEF)
end


--Add a threshold value for bleeding. Basically
function ObjectiveConquest:AddBleedThreshold(team, threshold, rate)
--assert(team == self.teamATT or team == self.teamDEF, "invalid team!")

if not self.bleedRates then
--initialize the bleedRates two-dimensional array
self.bleedRates = {}
self.bleedRates[self.teamATT] = {}
self.bleedRates[self.teamDEF] = {}
end

self.bleedRates[team][threshold] = rate
end

-- Get game time limit as set in game options menu, if any. 0 if none.
function ObjectiveConquest:GetGameTimeLimit()
return ScriptCB_GetCONMaxTimeLimit()
end

function ObjectiveConquest:GameOptionsTimeLimitUp()
local team1pts = GetReinforcementCount(1)
local team2pts = GetReinforcementCount(2)
if ( team1pts > team2pts ) then
MissionVictory(1)
elseif ( team1pts < team2pts ) then
MissionVictory(2)
else
--tied, so victory for both
MissionVictory({1,2})
end
end

function ObjectiveConquest:Start()
--===============================
-- Local functions
--===============================
local UpdateBleedRate = function(team)
--count how many CPs each team has
local cpCount = {0, 0}
for i, cp in pairs(self.commandPosts) do
local cpTeam = GetObjectTeam(cp.name)
cpCount[cpTeam] = (cpCount[cpTeam] or 0) + 1
print("CP '"..cp.name"' counted. Team "..cpTeam.." now has "..cpCount[cpTeam].." cps")
end

--find team with the highest count (only looking at teams 1 and 2)
local bleedTeam = 1
local otherTeam = 2
if cpCount[1] == cpCount[2] then
--no team has more CPs than the others, so stop this team's bleeding
StopTimer(self.bleedTimer[team])

return
elseif cpCount[2] > cpCount[1] then
bleedTeam = 2
otherTeam = 1
end
print("Bleed team, other team:", bleedTeam, otherTeam)

--UpdateBleedRate is called on both teams, so make sure not to start the bleed timer twice (only one team can bleed in this mod)
if bleedTeam ~= team then return end

--increases the bleed rate based on how many more CPs the bleed team has over the other team
local bleedRate = self.bleedBaseRate * (cpCount[bleedTeam] - cpCount[otherTeam])
print("Bleed rate:", bleedRate)

--setup the bleedrate display (i.e. how fast the score flashes in the HUD)
SetBleedRate(team, bleedRate)

--start bleeding reinforcements
StopTimer(self.bleedTimer[team])
SetTimerValue(self.bleedTimer[team], 1.0)
SetTimerRate(self.bleedTimer[team], bleedRate)
StartTimer(self.bleedTimer[team])
end

--hide the timers (HACK: this way of displaying the lose timer should be updated to use new HUD code)
SetDefeatTimer(nil, self.teamATT)
SetVictoryTimer(nil, self.teamATT)
SetDefeatTimer(nil, self.teamDEF)
SetVictoryTimer(nil, self.teamDEF)
end


local UpdateState = function()
if self.multiplayerRules then
UpdateBleedRate(self.teamDEF)
UpdateBleedRate(self.teamATT)
end

--check to see if one team (the winningTeam) has all the CPs
self.winningTeam = 0
for i, cp in pairs(self.commandPosts) do
--NOTE: destroyed CP's aren't supposed to count against the win/loss accounting
if IsObjectAlive(cp.name) then
local cpTeam = GetObjectTeam(cp.name)

if cpTeam == 0 then
--can't have a winner if one of the CPs is still neutral
DisableWinnerDoodads()
return
elseif self.winningTeam == 0 then
--start tracking this team that might be winning
self.winningTeam = cpTeam
elseif self.winningTeam ~= cpTeam then
--there is no winner, since we just found two CP's that don't match
DisableWinnerDoodads()
return
end
end
end

if self.winningTeam ~= 0 then
if self.disallowDefensiveVictory and self.winningTeam ~= self.teamATT then
return
end

if self.multiplayerRules then
--start the defeat timer to end the game in a few seconds
SetTimerValue(self.defeatTimer, self.defeatTimerSeconds)
StartTimer(self.defeatTimer)

--tell the C++ code about the defeat/victory timer (which will display it on the HUD)
SetDefeatTimer(self.defeatTimer, self:GetOpposingTeam(self.winningTeam))
SetVictoryTimer(self.defeatTimer, self.winningTeam)
else
--end the objective immediately
self:Complete(self.winningTeam)
end
end
end

local InitBleedTime = function(team)
self.bleedTimer[team] = CreateTime("bleed" .. team)

OnTimerElapse(
function(timer)
--bleed/increase points for the given team
local points = GetTeamPoints(team) + 1
SetTeamPoints(team, points)
print("Bleed a point to team, points:", team, points)

--restart the timer
SetTimerValue(timer, GetTimerValue(timer) + 1.0)
StartTimer(timer)
end
end, self.bleedTimer[team])
end



--==========
-- Set the number of guys in the level to number in game options
--==========
ScriptCB_SetNumBots(ScriptCB_GetCONNumBots())

--===============================
-- Initialization logic
--===============================
--initialize the base objective data first
Objective.Start(self)

--initialize internal values
self.commandPosts = self.commandPosts or {}

self.bleedTimer = {}
InitBleedTimer(self.teamATT)
InitBleedTimer(self.teamDEF)

InitDefeatTimer()

if self.multiplayerRules then
self.disallowDefensiveVictory = false
else
self.disallowDefensiveVictory = true --in single player/co-op, the defense can't win by capping all the CPs
end

numCPs = 0
for i, cp in pairs(self.commandPosts) do
if not self.multiplayerRules then
MapAddEntityMarker(cp.name, self.icon, 4.0, self.teamATT, "YELLOW", true)
end
numCPs = numCPs + 1
end
if(numCPs == 0) then
print ("ERROR: no valid CommandPosts were added to the ObjectiveConquest")
return
end

--set AI goals
self.AIGoals = {}
if self.AIGoalWeight > 0.0 then
table.insert(self.AIGoals, AddAIGoal(self.teamATT, "Conquest", 100*self.AIGoalWeight))
table.insert(self.AIGoals, AddAIGoal(self.teamDEF, "Conquest", 100*self.AIGoalWeight))
end

--do an initial update on the state
UpdateState()

--=======================================
-- Event responses
--=======================================
-- command post captures
OnFinishCapture(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

UpdatePostMapMarker(postPtr)
UpdateState()
end
)

-- command post neutralize
OnFinishNeutralize(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

UpdatePostMapMarker(postPtr)
UpdateState()
end
)

-- command post spawn
OnCommandPostRespawn(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

UpdatePostMapMarker(postPtr)
UpdateState()
end
)

-- command post kill
OnCommandPostKill(
function (postPtr)
if self.isComplete then return end
if not self.commandPosts[GetEntityName(postPtr)] then return end

if not self.multiplayerRules then
MapRemoveEntityMarker(postPtr, self.teamATT)
end

UpdateState()
end
)
end

function ObjectiveConquest:Complete(winningTeam)
if not self.multiplayerRules then
--remove all the cp markers
for i, cp in pairs(self.commandPosts) do
MapRemoveEntityMarker(cp.name)
end
end

--then call the default objective complete method
Objective.Complete(self, winningTeam)
end
[/code]
Not sure if that's the same but I got what you were saying! Still same error though.
Post Reply