Aside from reading up on lua, and comparing the games campaign luas to how they play out ingame, I haven't really much experience in this sort of scripting.
So, I figured I would throw up a thread, and with each objective, post my lua, or at least pertaining exerpts, and hopefully experienced lua-ers could walk me through it, and show me, along with the rest of the gametoast community, how its done.
Now, this may seem like an excuse to justify wanting specific help to this degree, but I think if people throw in and this thread keeps going, we could end up with a major, and I mean major, resource for any modder who wishes to try scripting their own campaign mode.
Now, for my first goal, I want the player to enter a given vehicle (in this case being an AAT), and firing at an enemy shield, one that will not break.
So basically, you'll enter a vehicle that is not available to other AI, shoot at a shield, and then after a certain amount of time, the objective ends and you are told to move down the hill and capture the farthest left of 3 cps.
Now, for the first goal, I'm totally lost. But for the second..heres what I've got:
Code: Select all
--Objective 2
Objective2CP = CommandPost:New{name = "c_cp12"}
Objective2 = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, text = "level.nac.objectives.campaign.2", popupText = "level.nac.objectives.campaign.2_popup", AIGoalWeight = 0}
Objective2:AddCommandPost(Objective2CP)
Objective2.OnStart = function(self)
AllowAISpawn(REP, true)
att_obj2_aigoal = AddAIGoal(ATT, "Deathmatch", 50)
def_obj2_aigoal = AddAIGoal(DEF, "Deathmatch", 50)
def_obj2_aigoal2 = AddAIGoal(DEF, "Defend", 50, "c_cp12")
--BatchChangeTeams(5, ATT, 11)
--SetUnitCount(1, 12)
AddUnitClass(1, "drd_battledroid_td", 10)
AddUnitClass(1, "drd_battledroid_cmd_td", 10)
AddUnitClass(1, "drd_battledroid_pilot_td", 10)
AddUnitClass(1, "drd_droideka_td", 10)
end
Objective2.OnComplete = function(self)
ShowMessageText("game.objectives.complete", ATT)
DeleteAIGoal(att_obj2_aigoal)
DeleteAIGoal(def_obj2_aigoal)
DeleteAIGoal(def_obj2_aigoal2)
AICanCaptureCP("c_cp12", DEF, false)
SetProperty("c_cp12", "Team", 1)
endNow, please take note that I'm totally new at this. The cp I want captured is c_cp12. The CIS is on the REP (ATT) team, and the Gungans are on CIS (DEF) team. I want the CIS's goals to be deathmatch, and I want the gungans to deathmatch, and defend. I want the gungans to be able to spawn all units, and I want the same for the CIS. Im not sure how to set up the AddUnitClass stuff, so please take a look at that.
Anyhow, I hope this doesn't fall through, and we can actually get a resource goin,
Parts


