Documente Academic
Documente Profesional
Documente Cultură
Tutorial description Use the Map Editor to: Create a 2x2 map Add 3 ScriptAreas Add 1 unit with ScriptID Add the lua script file to the map Add field tile Add a road Add a river Add some shrubs Add some trees Create text files using a text editor like notepad or UltraEdit 32 for the following: Mission script (save as lua) Script 3 Objectives (Encoding Unicode) Script 3 Reveal Objectives (Encoding Unicode) Script a Victory condition (Encoding Unicode) Script a defeat condition (Encoding Unicode) Script ShowActiveScripts for debugging purposes (Encoding Unicode)
Use the Resource Editors mission editor to: Add basic unit info Add combat music Add exploration music Add mission header, sub header and description Add Objective0 header and description Add Objective1 header and description Add Objective2 header and description Export which creates an xml file used along with the text files created earlier
For this tutorial: Click = Clicking the left mouse button to select an item. Right Click = Clicking the right mouse button to select an item.
Add the following: Map size = 2x2 Name = \blitzkrieg\Run\data\maps\tutorial Season = Summer Mod = <current MOD> A new map has been created in .bzm format. For simplicity this map will be created with little detail. Click on Terrain section in the tool tree below the menu bar,
Click Tiles, then click the Plain tile, go back to the menu bar and click on Map then click Fill Entire Map, a message will pop up click yes.
Now from the Terrain section in the tool tree click on the Light Grass Tile, go to the bottom edge of the map, click and drag all the edge from corner to corner.
Now from the Entrenchments, Roads, Rivers section in the tool tree
Click on the defualtriver Tile, go to the top edge of the map; click and then move to the opposite corner of the map then double click to set the river. Note: Red circles are pivot points and yellow circles are width points.
Now from the Objects, Fences, Bridges section in the tool tree
Click on the _BigApple Tile, go to the left hand bottom corner of the map; click and place the tree.
Click on the Bld European tab to change to the buildings tiles; click E_CTownH Tile, go towards the center of the map; click and place the house.
Click on the Bld European tab to change to the buildings tiles; click E_FrenchS Tile, go towards the upper left hand corner of the map; click and place the house.
Click and hold the button and drag on the area near the tree to create the first ScriptArea. ScriptArea = Tree
Click and hold the button and drag on the area near the tree to create the second ScriptArea. ScriptArea = Farmer_House
click and hold the button and drag on the area near the tree to create the third ScriptArea. ScriptArea = Swim
Click on Terrain section in the tool tree below the menu bar
Click on the Cube Tile then click and hold button drag in the area around the Swim House
Click on the road_cobbles Tile, go to the bottom center edge of the map; click and then move up towards the farm house set the pivot points by clicking map then double click to set the road. Note: Red circles are pivot points and yellow circles are width points.
10
Click on the Cypress01 Tile and then Cypress02 Tile, place in front of the farm house.
Click on the Obj Simple Tab and then select E_FenceB Tile click to place tiles around the farm house.
11
Click to place tile in the bottom of the far left hand corner of the map. Right click then double click to bring up the unit property menu; then click on ScriptID: ScriptID = 1
12
Blitzkrieg\Run\mods\mymod\data\scenarios\custom\missions\tutorial
Open up your text editor and create a text file named header.txt inside type the following text (minus the quotation marks): Objectives Tutorial and then save (Encoding Unicode) into your tutorial folder. Create a text file named description.txt inside type the following text (minus the quotation marks): Make sure to get your tired officer some much needed rest and relaxation. and then save (Encoding Unicode) into your tutorial folder. Create a text file named subheader.txt with no text inside and then save in your tutorial folder. Note: sub headers are optional but are required when you create your mission xml file, in this mission I chose to leave the subheader.txt file blank. Create a text file named 0h.txt inside type the following text (minus the quotation marks): 1st Objective. and then save (Encoding Unicode) into your tutorial folder. Create a text file named 0.txt inside type the following text (minus the quotation marks): There is a shade tree up a ahead... Get the officer under the shade tree before he collapses from heat stroke. and then save (Encoding Unicode) into your tutorial folder. Create a text file named 1h.txt inside type the following text (minus the quotation marks): 2nd Objective. and then save (Encoding Unicode) into your tutorial folder. Create a text file named 1.txt inside type the following text (minus the quotation marks): Now that your officer has cooled down a bit, send him over to the farmers house. and then save (Encoding Unicode) into your tutorial folder. Create a text file named 2h.txt inside type the following text (minus the quotation marks): 3rd Objective. and then save (Encoding Unicode) into your tutorial folder. Create a text file named 2.txt inside type the following text (minus the quotation marks): Now that your officer has poked around this farmers house, send him over to the river for a nice relaxing swim. and then save (Encoding Unicode) into your tutorial folder. Now you have created all of the text files needed.
13
Tutorial Mission Scripts You will need a text editor like notepad or UltraEdit32 to write the lua script for this mission. Copy and paste the following script into a text file and then name the file as tutorial.lua, save this file into your map folder. Blitzkrieg\Run\data\maps\ function Objective0() if (GetNScriptUnitsInArea (1, "Tree") == 1) then SetIGlobalVar("Tutorial.objective.0", 1); ObjectiveChanged(0, 1); RunScript( "RevealObjective1", 5000); Suicide(); end; end; function Objective1() if (GetNScriptUnitsInArea (1, "Farmer_House") == 1) then SetIGlobalVar("Tutorial.objective.1", 1); ObjectiveChanged(1, 1); RunScript( "RevealObjective2", 5000); Suicide(); end; end; function Objective2() if (GetNScriptUnitsInArea (1, "Swim") == 1) then SetIGlobalVar("Tutorial.objective.2", 1); ObjectiveChanged(2, 1); Suicide(); end; end; function RevealObjective0() if ( GetIGlobalVar("Tutorial.objective.0", 0) == 0) then ObjectiveChanged(0, 0); Suicide(); else Suicide(); end; end;
14
function RevealObjective1() if ( GetIGlobalVar("Tutorial.objective.1", 0) == 0) then ObjectiveChanged(1, 0); Suicide(); else Suicide(); end; end; function RevealObjective2() if ( GetIGlobalVar("Tutorial.objective.2", 0) == 0) then ObjectiveChanged(2, 0); Suicide(); else Suicide(); end; end; function ToWin() if ((GetIGlobalVar("Tutorial.objective.0", 1) * GetIGlobalVar("Tutorial.objective.1", 1) * GetIGlobalVar("Tutorial.objective.2", 1)) == 1) then Win(0); Suicide(); end; end; function TobeDefeated() if (GetNUnitsInScriptGroup (1, 0) <= 0) then Loose(); Suicide(); end; end; function Show() ShowActiveScripts (); Suicide(); end; function Init() RunScript( "Show", 2000); RunScript( "Objective0", 3000); RunScript( "Objective1", 3000); RunScript( "Objective2", 3000); RunScript( "ToWin", 4000); RunScript( "TobeDefeated", 4000); RunScript( "RevealObjective0", 3000); end;
15
Things to know for this mission scripting: iScriptID = 1 iPlayer = 0 Human iPlayer = 1 Computer strScriptAreaName = Tree strScriptAreaName = Farmer_House strScriptAreaName = Swim strGlobalVarName = Tutorial.objective.0 strGlobalVarName = Tutorial.objective.1 strGlobalVarName = Tutorial.objective.2 iPeriodicity = time in milliseconds 2000 = 2 seconds 3000 = 3 seconds 4000 = 4 seconds 5000 = 5 seconds iObjNum = 0bjective# iState = either 0, 1 or 2 depending on condition 0 = objective received 1 = objective completed 2 = objective failed Equal == < Less than <= Less than or equal to > Greater than >= Greater than or equal to * multiplication
16
In the properties column click in the header text row and a browse button (right hand side of row with three dots on it) now go to the folder where you saved the mission text files (Blitzkrieg\Run\mods\mymod\data\scenarios\custom\missions\tutorial) select the file named header.txt, in the values column in the header text row you should see header. Follow this same procedure for the sub header and descriptions rows. Next well add the final map by clicking in the final map row and selecting the tutorial map from the list of maps you should now have all of your basic info set. Note: The Settings file row is used for random missions.
header.txt
subheader.txt
description.txt Your basic info fields should now look like this.
17
Next from the tool tree menu on the left side of the editor right click on Combat musics; Combat musics should now be highlighted with a red arrow to the left along an Insert Items menu. Click on the + sign that is to the left of the red arrow and Music should now appear below Combat musics; in the properties column click in the Music Reference row, then click the browse button and select one of the combat music files from the list of music files.
Next go to objectives click and then right click to bring up the insert option click on the insert option to add objective, do this (3) times one for each of the objectives in your mission.
18
Just above the menu tree there is a button, click the button and a mini map of your mission will be created.
you will notice in the upper left hand corner of your mini map a blue x shaped marker, click on the 1st objective then hover the cursor over this marker click and hold down the mouse button and drag the marker over the shade tree. Note: If you do not see a mini map of youre mission see page 21. Blue X-Shaped Marker Swim Area
Farmers House
Shade Tree
19
Click on the 2nd objective then hover the cursor over this marker (marker moved back to the upper left hand corner of mini map) click and hold down the mouse button and drag the marker over the Farmers house.
Click on the 3rd objective then hover the cursor over this marker (marker moved back to the upper left hand corner of mini map) click and hold down the mouse button and drag the marker over the Swim area.
20
Note: Sometimes for no apparent reason you may get the following showing up in the display area:
If youre having this issue follow these steps to add the objective markers: Click on the Objective position rows x & y to enter the coordinates Objective0 x = 116 y = 375
Objective1
x = 265
y = 269
Objective2
x = 491
y = 105
21
Next click on the first objective to add the text files for Objective0, (Blitzkrieg\Run\mods\mymod\data\scenarios\custom\missions\tutorial). 0h.txt for Objective header and 0.txt for Objective.txt. 0h.txt 0.txt
Follow this same procedure to add 1h.txt for Objective header and 1.txt for Objective text to Objective1.
1h.txt
1.txt
Follow this same procedure to add 2h.txt for Objective header and 2.txt for Objective text to Objective2.
2h.txt
2.txt
Note: Objective script flag and Objective script ID can remain as they are.
22
Now youre ready to export the mission info to an xml file; click File and then select export. You will see the following error
Add the following path: Blitzkrieg\Run\mods\mymod\data\scenarios\custom\missions\tutorial Then click OK to export the files. You should now have an .xml file in your tutorial folder Create the following folders: Blitzkrieg\Run\data\scenarios\custom\missions\tutorial In the Blitzkrieg\Run\mods\mymod\data\scenarios\custom\missions\tutorial folder copy all files except for the current.mip Now paste them into your Blitzkrieg\Run\data\scenarios\custom\missions\tutorial folder. Start Blitzkrieg; New Game, Custom Game, Custom Missions you should see the tutorial mission in the list click it and it should run. Create a pak file using WinZip: Right click on pak file; from the menu select "open with"; then select Choose program"; then select "WinZip Executable"; then check Always use selected program to open this kind of file.. Now you can open pak files with WinZip. If you dont have WinZip get it here: http://www.winzip.com/ddchomea.htm Now you are ready to create the .pak file for this mission, go to Blitzkrieg\Run\data and highlight both the map folder and scenario folder right click and select add to zip, compress as a zip (tutorial.zip) file then click add. Once the file has been zipped in Blitzkrieg\Run\data\tutorial.zip highlight the zip file the copy and paste it into Blitzkrieg\Run\data highlight the file again and rename to tutorial.pak Thats it you now should be able to open this mission in the custom mission menu and test the mission.
23