Campaign Mode

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
Grev
Hoth Battle Chief
Hoth Battle Chief
Posts: 3132
Joined: Sun Dec 09, 2007 11:45 pm
Projects :: No Mod project currently.
Games I'm Playing :: Minecraft
Location: A Certain Box Canyon

Campaign Mode

Post by Grev »

Could someone point me to a Campaign mode tut?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Campaign Mode

Post 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.
MasterSaitek009
Black Sun Slicer
Posts: 619
Joined: Wed Aug 23, 2006 4:10 pm

Re: Campaign Mode

Post by MasterSaitek009 »

Yep, just pick apart the stock lua's and read the scripting doc in the "BF2_Modtools\Documentation folder".
Grev
Hoth Battle Chief
Hoth Battle Chief
Posts: 3132
Joined: Sun Dec 09, 2007 11:45 pm
Projects :: No Mod project currently.
Games I'm Playing :: Minecraft
Location: A Certain Box Canyon

Re: Campaign Mode

Post 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?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Campaign Mode

Post 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.
Grev
Hoth Battle Chief
Hoth Battle Chief
Posts: 3132
Joined: Sun Dec 09, 2007 11:45 pm
Projects :: No Mod project currently.
Games I'm Playing :: Minecraft
Location: A Certain Box Canyon

Re: Campaign Mode

Post 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!
Post Reply