AI ignores objectives

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

Post Reply
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

AI ignores objectives

Post by wishihadaname »

For some reason when the AI reaches objective #5 in my campaign script they stop following the AI scripts and go into deathmatch mode instead. It can't be anything to do with previous objectives because objective 5 is currently where the script is starting. The AI is also ignoring the set unit count command to increase the number of rebels. I'm rather thorougly confused at this poiint, could anyone point out any mistakes I made in this code and or help me resolve this issue?
Hidden/Spoiler:
-----------------------------------------
--OBJECTIVE 5: DEFEND THE LISTENING POST
-----------------------------------------

Objective5CP = CommandPost:New{name = "cp5"}
Objective5 = ObjectiveConquest:New{teamATT = DEF, teamDEF = ATT,
text = "level.TCR.objectives.smalltext.5", popupText = "level.TCR.objectives.bigtext.5",
timeLimit = 180}
Objective5:AddCommandPost(Objective5CP)

Objective5.OnStart = function (self)
MapAddEntityMarker("cp5", "hud_objective_icon_circle", 3.0, 1, "YELLOW", true)
SetProperty("cp7", "Team", 2)
Ambush("Darktrooper_drop1", 3, 6)
SetUnitCount (ALL, 30)
ScriptCB_PlayInGameMusic("rep_kas_amb_obj1_3_explore")
--KillObject ("cp4") UNCOMMENT IN FINAL BUILD
Imbgoal5a = AddAIGoal (5, "Defend", 2, "cp5")
DRKgoal5 = AddAIGoal (6, "Deathmatch", 1)
Allgoal5b = AddAIGoal (DEF, "Deathmatch", 1)
Impgoal5b = AddAIGoal (ATT, "Defend", 2, "cp5")
Allgoal5a = AddAIGoal (DEF, "Conquest", 2, "cp5")
end

Objective5.OnComplete = function (self)
ATTReinforcementCount = GetReinforcementCount(ATT)
SetReinforcementCount(ATT, ATTReinforcementCount + 50)
ShowMessageText("game.objectives.complete", ATT)
RespawnObject ("cp8")
RespawnObject ("cp9")
RespawnObject ("cp10")
RespawnObject ("ATST")
SetProperty("cp7", "Team", 1)
DeleteAIGoal(Impgoal5)
DeleteAIGoal(Imbgoal5)
DeleteAIGoal(DRKgoal5)
DeleteAIGoal(Allgoal5a)
DeleteAIGoal(Allgoal5b)
UnblockPlanningGraphArcs("Baseroad")

end
Post Reply