I was working on a campaign map, and I set up 2 ambush regions, but I was wondering, how could I make it an objective to kill the units in the ambush? I'm not sure how, since the assault script calls for cps. Example:
--objective: assault
Objective2= ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF,
text = "level.mad.campaign.2", popupText = "level.mad.campaign.2_popup"}
Dclass = TargetType:New{classname = "amb_inf_marine", killLimit = 8}
Objective2:AddTarget(Dclass)
Objective2.OnStart = function(self)
Objective2.Dclass_cpGoal1 = AddAIGoal(ATT, "Defend", 100, "ambush cp one name here")
Objective2.Dclass_cpGoal2 = AddAIGoal(amb, "Defend", 100, "ambush cp one name here")
end
Objective2.OnComplete = function(self)
DeleteAIGoal(Objective2.Dclass_cpGoal1)
DeleteAIGoal(Objective2.Dclass_cpGoal2)
end
How would I edit this so it's just a deathmatch, and not calling for cps to deffend?
EDIT: Also, if I wanted the Attacking teakm to destroy 2 technounion ship cps, both the same type, and both with different names (cp_tec_1 and cp_tec_2), would the script be like this?
Regarding the ambush, that looks like it should be okay. The only reference to cp's in that is in AI goals. If you don't want the AI to follow those goals, you can just delete them. I have a similar objective set up in one of my maps; here's what it would look like without AI goals:
--Objective X: destroy objects (put whatever you want on this line, it doesn't really matter)
name of first target = Target:New{name = "name of object in ZE"}
name of second target = Target:New{name = "name of object in ZE"}
ObjectiveX = ObjectiveAssault:New{teamATT = ATT, teamDEF = DEF, text = "name of text", popupText = "name of popup text", AIGoalWeight = 0}
ObjectiveX:AddTarget(name of first target)
ObjectiveX:AddTarget(name of second target)
ObjectiveX.OnStart = function(self)
end
ObjectiveX.OnComplete = function(self)
end
Where "X" is the numerical designation of your objective (or whatever else you use to designate them) and "name of first/second target" is whatever you want to use to designate the target in the script. AIGoalWeight refers to whether or not the AI try to complete the same objective, with "0" meaning they ignore the goal, and higher numbers meaning they're more likely to try to complete the goal (I think). The rest should be pretty self-explanatory.
C:\BF2_ModTools\ToolsFL\Bin\luac.exe: ..\..\common\scripts\MAD\MADc_c.lua:224: `)' expected near `"cp_tec_1"'
ERROR[scriptmunge scripts\MAD\MADc_c.lua]:Could not read input file.ERROR[scriptmunge scripts\MAD\MADc_c.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings
Re: Campaign ambush as objective?
Posted: Wed Dec 31, 2008 9:39 pm
by Eggman
Hm, I don't know for sure if I had the right set up for the AI goals, so try removing them from the objective. If you no longer get the error message, you'll know that those lines are the problem. If they are what's causing the problem, try setting up the goals for each ship separately, rather than specifying both within the goals. In other words, give each team two goals, one for each ship.
Re: Campaign ambush as objective?
Posted: Thu Jan 01, 2009 12:51 am
by Commander_Fett
Okay, I edited that code out, and now it munges. So, could I just add them in like this:
Or would I have to add in the other technounion ship as objective 5?
EDIT: Wow, my campaign seems really bugy. I got to the part in the mission where you have to fight an AI ambush, but no units apear. Tidbits of the LUA for it:
As for why the ambush isn't working, I'm not sure exactly. Did you have it set up and working before, or did you just add it in? If it was working before, then some other mistake is probably interfering with it, so fixing that mistake would allow the ambush to work again. If the ambush is new, then just double check the tutorials on setting up ambushes to see if you missed something. I'll admit, I've never been good at setting up ambushes with the method you used. I use this function:
It doesn't require a region, so I find it easier to deal with. You can just tie it in with some other event, such as "ObjectiveX.OnStart." Try using that function in place of "SetupAmbushTrigger" and see if it works.
--objective: kill the ambushing cis
Objective2= ObjectiveAssault:New{teamATT = ATT, teamDEF = amb,
text = "level.mad.campaign.2", popupText = "level.mad.campaign.2_popup"}
amb = TargetType:New{classname = "amb_inf_marine", killLimit = 8}
Objective2:AddTarget(amb)
Objective2.OnStart = function(self)
-- SetupAmbushTrigger("ambush_trigger_1", "ambush_path_1", 8, amb)
Ambush(ambush_path_1, 8, amb)
end
Objective2.OnComplete = function(self)
end
But that doesn't seem to work either. I'm not sure why, IU set up the path and the side's odf and reqs are right...
Campaign ambush problem
Posted: Fri Jan 02, 2009 12:03 am
by Commander_Fett
I was working on setting up a campaign ambush, but the ai never spawn. I checked the side by adding the unit to conquest, and it worked fine, and there's nothing wrong with the paths, so I figured it must be the LUA. However, I can't seem to find the problem.
My LUA (only the parts that refer to the team, amb)
all you need to change is that.
ambushers are the target
amb is the team number
Re: Campaign ambush as objective?
Posted: Fri Jan 02, 2009 3:04 pm
by Commander_Fett
okay, I set up an ambush path, and tried to make ai spawn from it. (team was amb, renamed atm) I want the objective to be destroying the ambushing units. However, the AI won't spawn.
Re: Campaign ambush as objective?
Posted: Fri Jan 02, 2009 5:29 pm
by RepSharpshooter
Ok I keep repeating the same answer, and you keep ignoring and repeating the same problem and this is going nowhere.
This is from the geo1c_c.lua It is the objective that ambushes droids and killing them is the objective, which is exactly what you are doing.