Page 1 of 1

Need a little more help with campaign ambush

Posted: Sun Jan 04, 2009 10:20 pm
by Commander_Fett
Well, thanks to a genorous amount of help and patience from RepSharpshooter, I now have a working ambush, sort of. The AI now spawn (yipee!), but only seven spawn for some reason, and instead of attacking the player, they just stand absolutely still. My LUA refering to the side:
Hidden/Spoiler:
ScriptCB_DoFile("MultiObjectiveContainer")
ScriptCB_DoFile("ObjectiveAssault")
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("ObjectiveGoto")
ScriptCB_DoFile("ObjectiveCTF")
ScriptCB_DoFile("ObjectiveTDM")
ScriptCB_DoFile("Ambush")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
AmbushTeam = 3
atm = AmbushTeam
________________________________________________________________________________
--objective: kill the ambushing cis
ambushers = TargetType:New{classname = "amb_inf_marine", killLimit = 8, icon = "hud_objective_icon_circle"}
Objective2= ObjectiveAssault:New{teamATT = ATT, teamDEF = amb,
text = "level.mad.campaign.2", popupText = "level.mad.campaign.2_popup"}
Objective2:AddTarget(ambushers)


Objective2.OnStart = function(self)
-- SetupAmbushTrigger("ambush_trigger_1", "ambush_path_1", 8, atm)
Ambush("ambush_path_1", 8, atm)
end

Objective2.OnComplete = function(self)
end
_____________________________________________________________________________
ReadDataFile("dc:SIDE\\atm.lvl",
"amb_inf_marine")
_____________________________________________________________________________
atm = {
team = atm,
units = 8,
reinforcements = -1,
soldier = { "amb_inf_marine",8, 8},
}
}

SetTeamAsEnemy(ATT, atm)
SetTeamAsEnemy(atm, ATT)
SetTeamAsEnemy(ATT, DEF)
SetTeamAsEnemy(DEF, ATT)
SetTeamAsFriend(atm, DEF)
SetTeamAsFriend(DEF, atm)
I've checked in ZE, there are 8 nodes on the path, but only 7 AI spawn. Can someone help?

Re: Need a little more help with campaign ambush

Posted: Wed Mar 11, 2009 11:58 am
by ForceMaster
I make a ambush in my map, the nodes begins with "node0"..."node1"..."node2"....
your "ambush_path" will be have max "node7".
hope this help you. :D

EDIT:
Try this friend:

Change this

Code: Select all

reinforcements = -1,
to:

Code: Select all

reinforcements = 0,

Re: Need a little more help with campaign ambush

Posted: Wed Mar 11, 2009 3:15 pm
by theultimat
Hmm...I used a different code for my ambush...it's the code from the Geonosis scripts. Here's what it is (and note that this has been modified for my needs):

Code: Select all

--Objective 4 - Kill the survivors
 	Scouts = TargetType:New{classname = "all_inf_rifleman_jungle", killLimit = 3, icon = "hud_objective_icon_circle"}
	
	Objective4 = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF, 
							  text = "level.cor1.objectives.campaign.2.C", popupText = "level.cor1.objectives.campaign.2.C_popup",  AIGoalWeight = 0}
	Objective4:AddTarget(Scouts)

 	
 	Objective4.OnStart = function(self)
 		Ambush("scout_ambush_spawn", 3, 4)
		  	  AICanCaptureCP("cp2", DEF, false)
			 -- AICanCaptureCP("cp2", Scouts, false)
 		scouts_goal = AddAIGoal(4, "Defend", 100, "cp2")
 	end
 	
 	Objective4.OnComplete = function(self)
 		ShowMessageText("game.objectives.complete", ATT)
 		DeleteAIGoal(scouts_goal)
 		
 	end
Then at the bottom of the LUA, where locals are normally set up:

Code: Select all

		    --Setup scout ambush team
    
    AddUnitClass(4, "all_inf_rifleman_jungle", 4)
    SetUnitCount(4, 7)
    SetTeamAsEnemy(4, ATT)
    SetTeamAsEnemy(ATT, 4)