SWBFGamers

Modding for the Original SWBF1 and SWBF2 => SWBF1 Modding Tutorials => Topic started by: Radical_Pi on April 20, 2009, 02:10:27 PM

Title: How to make mission maps
Post by: Radical_Pi on April 20, 2009, 02:10:27 PM
Alright, lets get going on the task of making mission maps in 7 Steps or less

Step 1: Create a New Map

Well, here's a simple task. Open up BFBuilder (Pro) and create a new map. Do the normal naming and era selection. Click Create and you're done

Step 2: Import Sides

First of all, if you are using a pre-existing mod, skip to step 4

Well, go through "BFBuilder Pro->Sides->Import Retail Side" then import whatever side you want to mod. Click OK then you are done

Step 3: Mod Away[/u]

Ask someone else how to do this. You shouldn't even be reading this if you don't know how to mod. shoo

Step 4: LUA editing[/u]

Now, this is the real important part of this guide. In your mod folder, go to Common\Scripts\*Mod Name here*. There is either 1 or 2 lua scripts in here, depending on what you selected in the first step. open up one of the LUA files in your favorite text editor. For simplicity, I'll use the simple modding route. In the BFBuilder folder, go to Assets\Mission LUA Samples\*Map you want to mission-ize*. In here will be a couple of LUA files. Ones with _h are the campaign scripts. If the name has a or i at the end, it's GCW. r or c is CW. Pick the script you want, copy the whole thing and put it in the other LUA file you should have open.

Now, go into the newly changed LUA file, and go down to the area where it says ReadDataFile("SIDE\\all.lvl", or something similar. Add dc: before the SIDE\\all.lvl so it ends up looking like ReadDataFile("dc:SIDE\\all.lvl", then repeat for the second command similar to that (should be directly below that one). Be sure to save the file!

Now, for the more technically-minded, the dc: prefix tells SWBF to start in the mod folder and not the core game file folder. This can be used on any ReadDataFile command. If you were to skip the copy part, you could go down to the Level Stats area and change the ReadDataFile there to not have dc:, making it use the original map. That line is what truly makes it a mission map, but the copy method changes it for us.

Congratulations, you're got the hardest part done!

Step 5: Munge

Do I really need to explain this?

Step 6: A little bit of LVL

This step only applies to those who are using a pre-existing mod

Now, from the BFBuilder folder, go to AddOn\*Your mod name*\Data\_lvl_pc and create a new folder called Side. Copy the mod lvls into that folder.

Step 7: Pre-Release Cleaning (Optional)

After you test your mission map a bit, and are ready to release it, here's a small thing to make the file a bit smaller. From the BFBuilder folder, go to AddOn\*Your mod name*\Data\_lvl_pc and delete everything from this folder except for core.lvl, mission.lvl, and the Side folder. Now you can compress and release the mod from the BFBuilder\AddOn folder!

Step 8: PLAY IT!!!!!!!!!

And you are now FINISHED!

Appendix:

To load another mod map (example being a few of Napseeker's maps), simply change the World ReadDataFile in the LUA to
QuoteReadDataFile("dc:../../MODID/Data/_LVL_PC/MODID/MODOID.lvl")
of course changing MODID to the id of the second mod. Make sure people know about this requirement when you distribute the map. -- ggctuk

Got additions to this guide? Post em here and I'll add them

Well, I guess this is goodbye. Feel free to post here with any questions you have.
Title: Re: How to make mission maps
Post by: Dresh on April 20, 2009, 02:54:52 PM
nice one! Saved me some typing!

For anyone that didnt get it... the 'dc:' bit just tells the game to use the files in the map directory (*Mod Name here*\Data\_lvl_pc\Side) instead of the ones shipped with the game!
Title: Re: How to make mission maps
Post by: Napseeker on April 20, 2009, 03:15:33 PM
A definite sticky IMO.  Thanks for writing this up too - hopefully other people will take advantage of this tutorial and experiment with some new missions.  I want to add that this is actually a different approach from how I do my own mission maps but if it works, that's what matters.

I think people should actually post their questions to this thread so everyone can benefit from any explanations.  There are also still more interesting places you can go with mission maps beyond just side modding pre-existing maps, but it requires a lot more work and experimentation.
Title: Re: How to make mission maps
Post by: Giftheck on April 20, 2009, 03:23:30 PM
How to get one working with a mod map though... I believe, following the DC: suffix, it should go something like:

ReadDataFile("dc:../../MODID/Data/_LVL_PC/MODID/MODOID.lvl")
Title: Re: How to make mission maps
Post by: Radical_Pi on April 20, 2009, 03:24:30 PM
yeah that should be right

Changed the last bit to say post here

Also Added an appendix for misc comments from others. I'll add them when I can. ggctuk got the first one.
Title: Re: How to make mission maps
Post by: Hardcore on April 20, 2009, 03:37:54 PM
Stick with a pin, Thanks Pi Man for posting this.
Title: Re: How to make mission maps
Post by: Ryanoceros on April 21, 2009, 12:46:24 PM
This is great. I'll give it a try when I've finished the sides mod.
There are a few custom maps that my sides won't work on, so this will solve that problem.
... I was majorly bummed when I discovered that I couldn't use the sides on Endor Confrontation.
Title: Re: How to make mission maps
Post by: Ryanoceros on May 01, 2009, 08:44:23 PM
Hiya guys,
Can someone tell me how to mission-ize a custom map?
Do I need the assets for that map? Or do I just work within the map itself. If so, how do I do it?
Thanks in advance!
Title: Re: How to make mission maps
Post by: Radical_Pi on May 02, 2009, 09:43:58 AM
If you're talking about AddOn map missionizing, look at the code near the bottom of my post. Just replace MODID with the name of the mod
Title: Re: How to make mission maps
Post by: Ryanoceros on May 02, 2009, 11:35:30 AM
Oh! I see.
Thanks Pi. :)

..Edited to add:

This doesn't work. This is not correct....
ReadDataFile("dc:../../MODID/Data/_LVL_PC/MODID/MODOID.lvl")

The slashes are backwards. And even when I change the slashes to the way they are supposed to be, ie.
ReadDataFile("dc:..\..\MODID\Data\_LVL_PC\MODID\MODOID.lvl")
It still doesn't work.

Can someone check and see exactly what it is supposed to read. Ive tried about ten possible variations. This should be easy.
I'm trying to missionize EC. So I would guess it should read, ReadDataFile("dc:..\..\EC\Data\_LVL_PC\EC\EC.lvl") ?
But that doesn't work either.
Total confusion at this point and it really should be simple.
Title: Re: How to make mission maps
Post by: Giftheck on June 12, 2009, 05:12:30 AM
Perhaps it's two slashes? IE dc:..\\..\\..\\corus1\\_lvl_pc\\corus1\\corus1.lvl ?

Edit: I was correct - it's two slashes. I got a mission map for the Death Star interior up and running.
Title: Re: How to make mission maps
Post by: Ryanoceros on June 21, 2009, 09:34:19 PM
Ah!.. I'll try it, thnx :)
Title: Re: How to make mission maps
Post by: Giftheck on June 22, 2009, 06:02:56 AM
So here's the code you use:

ReadDataFile("dc:..\\..\\..\\modID\\data\\_lvl_pc\\ModID\\ModID.lvl")
Title: Re: How to make mission maps
Post by: Giftheck on August 20, 2009, 07:42:06 AM
I notice in some maps, Napseeker has added extra CPs, collision etc (take the Death Star EvE mission maps). It seems he loads two levels, one with the extra CPs and planning, the other being the original map.
Title: Re: How to make mission maps
Post by: Radical_Pi on August 20, 2009, 08:32:33 AM
I guess what he did is create a world that was just a layer file and load it into the game, which would make it work
Title: Re: How to make mission maps
Post by: Napseeker on September 06, 2009, 09:02:35 AM
That's more or less correct - I was planning on doing an advanced mission map tutorial about this but as with many of my projects lately, it's still incomplete.  I can explain to you the general idea though and why it is far cooler than a simple mission map (i.e. just loading in the assets of someone else's map).

- in a regular mission map you just load in a base map
- in an advanced mission map, you load in the base map but you also load in an "overlay" or "underlay" map which contains the extra map items you want to put onto the base map
- the overlay/underlay map is the same map, the name just refers to the order in which you load it relative to loading the base map. For example, if you load your map BEFORE the base map, I refer to it as an underlay map; if you load your map AFTER you've loaded the base map, I refer to this as an overlay map.  The distinction is important because the map that is loaded last by the SWBF1 engine will then have elements which are retained for the mission (like for example, the mini-map), overriding elements that were initially loaded (so hence the idea of "overlaying" on top of the previously-loaded map's assets).  For example, you load the base map last, so that you use the base map's mini-map.  But if you want to override the base map's normal mini-map and use your own mini-map which may be updated to include changes that you've made to the base map then you may want to load your map last (i.e. it is an overlay map)

- the key thing I realized a long time ago is that the LUA function, ReadDataFile(), is a generic function that looks at the data "type" in the header of the LVL and says "Okay, I'm reading in a map" and pipes all of the incoming data to some data structure for defining the world. For some reason, nobody ever realized that you can call this function twice (or more) on more than one map LVL and it will load in the additional map objects without purging any pre-existing world data already loaded.  In this way, I knew I could add new map objects (CPs, invisible collision blocks, vehicle spawners, etc) to a base map quite easily.
- that said, you cannot have more than one terrain (.ter) so the last-loaded map (either the base map, or overlay map) defines what that terrain will be.  If I recall, if the last-loaded map has no terrain associated with it, then I think the mission does then still use the terrain from the first loaded map.  Either that or it purges the whole thing and you have your units falling to their deaths due to the lack of any ground at all :)  I can't remember which, it's been 2 years since I experimented with it, so give it a try and remind me!
- the fact that you can load the assets from two (or more) maps into one world is FUN: in my very first experimental advanced mission map, I loaded both the Jedi Temple and Kamino into one world and the end result was a FLOODED Jedi Temple...  try it for yourself and be amazed!

- to create the overlay/underlay map, you start with a default map in ZE and just position your new map objects as though you were editing the base map (in most cases, you probably also want to delete the two CPs that are created by default).  This requires a bit of tedious guesswork since obviously you cannot load the base map into ZE to accurately position your new map objects.  However, to get accurate coordinates to use, what I do is run SPTEST and turn on the printplayercoords() so that as I run around, I can see the approximate x,y,z coords to use to put my objects at when I get back into ZE.  I also suggest you do a printscreen (which then gives you a pic of the location along with the x,y,z printed at the bottom of the pic).
- IMPORTANT: you need to use the negative of the Z-coordinate given to you by printplayercoords()... so if you see (100,25,52), then in ZE you must put your object at (100,25,-52) for it to show up.  Don't ask me why, but that's how it works and I just saved you a few days of headscratching by telling you guys that.

So that's the gist of it.  There are other quirks and perks that I will leave to you guys to discover... the main thing is that advanced mission maps give you the ability to "edit" a compiled map without having access to the original map project.  Obviously the most easy type of editing is that you can add new map elements to the base map, but I remember also figuring out a way to suppress (or "delete") something from a base map too - although I can't remember now how I did that, only that it was tedious (well, more tedious) to do.


Title: Re: How to make mission maps
Post by: Breakdown on September 06, 2009, 09:08:22 AM
Sweet! Thanks Nap, I never thought of doing that for a mission map..
Title: Re: How to make mission maps
Post by: Led on December 25, 2010, 06:33:45 PM
ReadDataFile("dc:..\\..\\..\\..\\Data\\_LVL_PC\\BES\\bes2.lvl")


is the command to load in a standard map

if you want to load a map from another mod map *that is already in addon* use
ReadDataFile("dc:..\\..\\..\\modidofmaptouse\\Data\\_LVL_PC\\modidofmaptouse\\modidofmaptouse.lvl")

if you want to load a side from another mod map *that is already in addon* use, for example, to read from
the mod map ewok01

ReadDataFile("dc:..\\..\\..\\ewok01\\Data\\_LVL_PC\\SIDE\\ewk.lvl",
        "all_end_music",
        "ewk_inf_basic")
EhPortal 1.34 © 2024, WebDev