Page 1 of 1

setting up a defend cp objective

Posted: Thu Mar 12, 2009 8:58 pm
by Commander_Fett
I wanted to add an objective in which wou defend your cp, but instead of having it as a defend one, it's capture and goes straight to co9mplete. what do I need to fix?

Code: Select all

 	Objective9CP = CommandPost:New{name = "cpmwp5"}
	Objective9 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.mwp.gad.mwp9", popupText = "secret",  AIGoalWeight = 0,
            	timeLimit = 120, timeLimitWinningTeam = ATT}
	Objective9:AddCommandPost(Objective9CP)
	
	Objective9:AddHint("level.geo1.hints.capture_cp")
	
	Objective9.OnStart = function(self)
		AICanCaptureCP("cpmwp5", ATT, true)
		AICanCaptureCP("cpmwp5", secret, true)
		att_obj9_aigoal = AddAIGoal(ATT, "Defend", 50, "cpmwp5")
		def_obj9_aigoal = AddAIGoal(secret, "Defend", 50, "cpmwp5")
		att_obj9_aigoal2 = AddAIGoal(ATT, "Deathmatch", 100)
		def_obj9_aigoal2 = AddAIGoal(secret, "Deathmatch", 100)
	end
		
	Objective9.OnComplete = function(self)
		ShowMessageText("game.objectives.complete", ATT)
		DeleteAIGoal(att_obj9_aigoal)
		DeleteAIGoal(att_obj9_aigoal2)
		DeleteAIGoal(def_obj9_aigoal)
		DeleteAIGoal(def_obj9_aigoal2)
		SetProperty("cpmwp5", "Team", 1)
		SetProperty("cpmwp5", "CaptureRegion", "")
    end

Re: setting up a defend cp objective

Posted: Sat Mar 14, 2009 2:48 pm
by KnightsFan
Make teamATT = DEF, and teamDEF = ATT. Change every occurence of ATT to DEF (and vice versa). But only do it for the stuff within Objective9.OnStart.