There is no difference between
Code: Select all
OnFinishCaptureName( function(post) end, "filter value" )
and
Code: Select all
functionToCall = function(post) end
OnFinishCaptureName( functionToCall, "filter value" )
All it does is allows you to restructure your code so its easier to read. Which way is esaier to read depends completely on the person reading it.
However, Abiter_b is correct in that you are missing
OnFinishCaptureName. When you provide a filter, you need to let the game know what the filter represents (name, team, etc...).
Both of the following code segments should work. I changed your code slightly to use
GetCommandPostTeam() compared to
GetObjectTeam(). I think I remember reading something, somewhere about the less general functions being more optimized.
Code: Select all
OnFinishCaptureName( --If this CIS captures CP 3
function(post, holding)
--if the CP was not captured by team 2, do nothing
if GetCommandPostTeam(post) ~= 2 then
return
end
CP3CIS = 1
SetProperty("cp3cam", "SpawnPath", "cp3_spawn")
ShowMessageText("level.ace.campaigncw.objectives.CP3Lost", REP)
end, "cp3cam"
)
Code: Select all
cp3Lost = function(post, holding)
--if the CP was not captured by team 2, do nothing
if GetCommandPostTeam(post) ~= 2 then
return
end
CP3CIS = 1
SetProperty("cp3cam", "SpawnPath", "cp3_spawn")
ShowMessageText("level.ace.campaigncw.objectives.CP3Lost", REP)
end
OnFinishCaptureName( cp3Lost, "cp3cam" )