Page 1 of 1
Campaign Mode
Posted: Wed Dec 26, 2007 5:14 pm
by Grev
Could someone point me to a Campaign mode tut?
Re: Campaign Mode
Posted: Wed Dec 26, 2007 5:17 pm
by Maveritchell
There isn't really one, but the best way to learn is to figure out how to do basic objectives (using things like OnEnterRegion or OnObjectKill) and then expand on that knowledge based on what you need by looking at the stock campaign .luas.
Re: Campaign Mode
Posted: Wed Dec 26, 2007 10:16 pm
by MasterSaitek009
Yep, just pick apart the stock lua's and read the scripting doc in the "BF2_Modtools\Documentation folder".
Re: Campaign Mode
Posted: Wed Dec 26, 2007 10:50 pm
by Grev
How would I make a campaign mode?
In ze, would I have to make a campaign layer and mode? and then fool around (not literally) with the script?
Re: Campaign Mode
Posted: Wed Dec 26, 2007 11:03 pm
by Maveritchell
You can use whatever kind of layer you want in ZE, since you can change what layer the map accesses in the .lua.
If I were you, I would start making my campaign mode with an assault (eli) .lua. Assuming you're pretty familiar with how to do everything normal in .lua (like changing around units, working with memorypools, etc.), using an assault .lua is the best because assault .luas are the simplest.
The .lua is split into two parts: ScriptPostLoad and ScriptInit. Like their names imply, ScriptInit is the part of the script that initializes the level and ScriptPostLoad is the part that runs after the level has loaded.
All of the work you do (campaign-wise) is going to be in ScriptPostLoad. What you'll want to do is probably change the rules for the map to campaign. I did this at the top of my RPG .lua (which is essentially an extended campaign script):
Code: Select all
function ScriptPostLoad()
EnableSPHeroRules()
ScriptCB_SetGameRules("campaign")
-- This is the actual objective setup
--TDM = ObjectiveTDM:New{teamATT = 1, teamDEF = 2,
--multiplayerScoreLimit = 100,
--textATT = "game.modes.tdm",
--textDEF = "game.modes.tdm2", multiplayerRules = true, isCelebrityDeathmatch = true}
--TDM:Start()
AllowAISpawn(ALL, false)
I commented out (meaning the game doesn't read them, signified by the double dashes before the lines) the parts about team deathmatch starting (which is part of a normal assault .lua). You'll see I changed the rules to campaign, which means that in SP the player can only spawn on team 1 (usually the ATT team - this team is ALL in hero assault maps but usually it's REP or IMP). Additionally, I added a line that prevents AI from spawning on my team, although that's optional.
From there, I'd go ahead and try and script some simple stuff, like a goto-location kind of thing. You'll start writing in objectives (like objective1 = OnEnterRegion( etc. etc.)ShowObjectiveTextPopup is your friend (as well as ShowMessageText), and so is the scripting documentation, like Saitek mentioned. Experiment around with stuff, and if you have a specific question I'm sure we'll do our best to answer it.
Re: Campaign Mode
Posted: Wed Dec 26, 2007 11:32 pm
by Grev
Thanks, I willl try it. However, for my first map, if you possibly finish the Spira Map, (i think thats what you are working on) could you possibly mission script my first map?
If you could, thank you!
(Im sorry if I bumped the topic)
I will try your advice first!