Modding Battalion Wars nowadays (Left: Leverno's unit editor, right: Lua script in Notepad++) |
Modding Battalion Wars a few months ago (Left: Leverno's unit editor, right: Lua script in Notepad++) |
Contents:
News from the modding effort
The Battalion Wars Randomizer is a Python script which randomizes positions of units and objects, simply by modifying the XML "_Level" files.
You never know where the mission will begin...
What a beautiful mess!
Sometimes, cool landscapes are created.
grgrgr
Leverno's is attacking the 3d models of Battalion Wars. Already he wrote a Blender plugin so the vertices of a given model appear in the viewport.
With a bit of hex editing I also quickly try to mess things up:
I also textured the Operation POW terrain extracted by Leverno the other day, just for fun:
Now thanks to Yoshi2 aka Leverno's efforts, terrains from BW1/2 can be imported in Blender, the 3D software!
Following screenshots by Leverno:
At long last, Leverno did a terrain editor, which works with grayscale pictures: the color determines the height. If one doesn't specify any pic though... we get a flat world:
A nicely weird edit of Battle of the Coral Atolls:
And seen from afar... not so nicely weird, just weird:
It should have been a pretty easy mission to code, I guess... well, it isn't so easy, but at least there's some progress.
First, our emptying of Battle of the Coral Atolls didn't work; then we did the exact same thing as in Black Gold (see 2016-07-01 night entry) and it worked.
Then! We placed units and began scripting the mission. The script was not working. And it appears that the script was not working because of a declared variable in the Gameflow.lua file (levelend = 0). When declaring this variable in Global_Variable.lua however, the script at least accepts to unfreeze my starting grunt. The rest of the script doesn't play though. Very odd.
Also yes, there's an 's' at the end of 'Battle of the Coral Atolls'.
Following a rather odd suggestion from Pvt. Hazard on the BW modding Discord channel, using Leverno's editor we set up a small modification for Battle of the Coral Atolls (PassthePort in the gamefiles): we deleted most Western Frontier units including the Bomber and the Battlestation, and only kept one grunt, one Flame Vet and one Missile Vet.
It makes for an interesting challenge where you must avoid the enemy Battlestations rather than fight them.
Technically it was really easy to set up, so great.
It makes me want to do a mission where the player controls a battalion of Xylvanian Bazooka Vets and must destroy several WF Battlestations, like two or three. Or a single one at first, and two at a time later on.
It's now possible to delete/clone/move several objects at a time, as long as they're selected! Definitely time-saving.
Some screens of Tundran Fighters below.
Even if we're not encountering any particular trouble with our XDay custom mission, we (I) feel it's time to move on to new ideas.
We'll now make a simple mission in Black Gold where the player controls Tundran fighters and must protect the WF bombers as they are attacked by Xylvanian fighters.
As usual the first step was to empty Black Gold and keep only one unit of each type (per Army) present on the vanilla level. We did that using Leverno's editor in one pass only, then we emptied the scripts -- obviously, when we tried it, the level crashed before it finished loading.
I was about to give up and started the emptying all over again from the start, when something occured to me.
I re-imported in the Iso the original, vanilla _Level.xml file. But I kept the emptied Lua scripts. Then I tried it ingame and the level loaded properly; BUT, the camera was stuck pointed at the sky. It was the camera normally used to begin the intro cutscene.
Using Leverno's editor, I went back to my emptied (but not working) _Level.xml file, and I deleted all cameras except the player one (the CHASETARGET one).
I imported the file in the ISO and surprise, it worked! So now we have a blank Black Gold level to work in. And it went without too much trouble nor tiresome trial and error. We're getting pretty good at these things.
Oh also: I discovered the Tundran fighter was completely overpowered, maybe as much as the Solar Empire one. It fires all its four missiles at the same time, unlike the WF fighter which fires its missiles two at a time.
Here are some nice dogfighting screenshots:
Yoshi2 keeps unraving the mysteries of the .out files, and he added the possibility to toggle between the usual heightmap and the lightmap. Here's a view of XDay with lightmap toggled on:
The populating of the fortress has been done without too much trouble, and the despawning of various units not used at mission start as well (namely the air units like the Stratofortress).
All the Xylvanian units at the fortress have been set to be inactive, and the Western Frontier POWs too.
Okay after emptying XDay, we're now at the fun part of the stuff: writing the scripts. First the T-copters must come and land at specific points and unload their units, then the units must go to a specific area. At first the scripts didn't work but now they do. So it turns out that everything freezes if there's no "else WaitFor(1)" at the end of the if statement controlling the landing and unloading of the t-copters (see screen below, click to see a bit more).
Also, one of the t-copters just doesn't land; I think that's because it doesn't have enough room to do so. So, it locks the script (all t-copters must have landed for the unloaded units to advance). If it's shot down though, the script is de-locked.
Hmmm, we advance slowly but surely. I've emptied a good part of Xday now, to the point that unit wise, each army only has about one unit of each type left -- the whole point and the intended result, in fact. So this part is mostly done, and we'll probably never know why it was so hard yesterday. Especially given it was also a bit tense today, having to retry and re-retry each time a modification was made. But, that's BW modding for you.
Also Leverno has AGAIN improved his editor's terrain view feature:
And he also added Zoom in/out with mousescroll.
So yeah. Emptying XDay will be more difficult than planned. It doesn't work for some reason, and the problem most likely lies within the _Level.xml file, strangely enough.
When I import the original XDay _Level.xml, the level loads, but the unit the player controls at mission start remains freezed. I DID write an UnfreezePlayer() command in the Main_Loop.lua script though. So, very weird. Must think about it.
There are also good news fortunately: nice changes to the terrain view in Leverno's editor:
So I reverted back to the original _Level.xml file as mentionned, and now I managed to unfreeze the starting unit, by actually writing an UnfreezePlayer() command in the level_Intro.lua file.... where it originally was. So. Weird. UnfreezePlayer() [apparently] needs to remain in its original lua file.
To make a XDay custom mission, we must first follow the same process as for Plan of Attack and empty the level. Well XDay is definitely harder to empty than Plan of Attack. I wonder if we'll manage.
As planned Leverno implemented the terrain view feature in his editor. Here, a cool view of the layout of XDay:
Speaking of XDay... that will be our next custom mission. The plan is to play as Xylvania, defending Beachy Point Island from the Western Frontier invaders. First the Xylvanians will have to defend the southern beach, as in official gameplay when the player controls the WF forces; then the WF will actually land troop at the western beach and try to free the POWs in the East.
Everything is explained in this picture:
Very nice terrains view of Combat Patrol (BW1), Operation POW (Gauntlet) (BW1), and Ice Station X (BWii). Leverno will hopefully implement this new feature in his Unit Editor:
Great news from the front! Now the script works, and the Tundran T-copter actually unloads its units.
However, camera is bugged beyond repair when the T-copter is full, SO we'll just make it AI controlled. Shame, but at least the Frontier T-copter is not bugged so we'll do a proper transport mission with it.
Yoshi2 (Leverno) suggests we copy the camera data of the Frontier T-copter to the Tundran T-copter, which is clever. We'll try that.
And now Leverno's suggestion worked! The Tundran T-copter has a stable camera. For that, we had to go and modify the camera attributes of the air_vehicle base object in the _Level.xml file.
The only two things that remain to be done are
1) fix the light tank position IN the T-copter so we don't see part of it coming out in flight
2) making the victory conditions work. I don't know why but this part of the script doesn't work. Yet.
At last the code is working now thanks to a debugg suggested by Leverno. He then spotted himself a typo in the code; now it works and WF units move to castle potemkin. In other good news, defeat condition 1 works (we lose all units), but 2 (capture point at castle potemkin is captured) needs more testing.
Also, AddToGroup(group, unit) works, but not group.Add(group, unit) for some reason.
So we kept some units in a mostly empty Plan of Attack map; now it's time to make them do our will. We want the WF units to go and capture castle potemkin. So we script and the beginning of the script works but not the rest for some reason. (Note that the screenshot contains a if statement that we did not test yet)
We also renamed all units through the EntityInitialise.lua file. The way it works: open the Level.xml in Leverno's unit editor and in NotePad++; then select a unit in the editor, note its ID number, and search it in EntityInitialise.lua. From there change its name (usually it goes from something like Troop.Entity0012 to one of our own name, like Troop.wf_recon1_crew_1). We also established a nomenclature for renaming units the way we want.
AT LAST! It works! I managed to empty Plan of Attack save for a few Tundran units so we can clone them later! What I did was I emptied the script as Yoshi2 (Leverno) suggested, then for EVERY unit present in the original _Level.xml, I deleted its ID in the EntityInitialise.lua file. Also, in the xml, for the Tundran T-copter I had kept, I deleted the useless passengers of course, and for the "cReflectedUnitGroup" object I deleted all the listed IDs after the line <Pointer elements="5" name="mUnits" type="cUnit">
At last. Leverno's tip: only keep the stuff inside EntityInitialize.lua (maybe we'll have to delete it eventually though), some stuff in GameFlow.lua so the game doesn't remain stuck at the intro cutscene (see pic below), GlobalVariables.lua, ScoreScreen.lua, MusicInit.lua and MusicGlobal.lua.
Stuff to keep in GameFlow.lua: