October 17, 2009

Tutorial 2 - Basic Mission



If you want to familiarize yourself with or you don't know how to load the editor, read my first post "Mission Editor Introduction" which gives a brief overview of the editor.

Tutorial Goals
  • Create a single 4 man squad
  • Create waypoints to objective
  • Create an enemy squad as the primary mission objective
  • End mission when objective is complete or when we fail
Introduction

Every mission has a few things in common; you have a player and an enemy that is the objective. In this first tutorial, we will be the most minimalistic. We will create the friendly units which will consist of you and your squad. No mission is any fun without an enemy, so we will be creating an enemy squad. Our objective will be to eliminate the enemy squad. If we die, the mission will end in failure. If we eliminate the entire enemy squad, the mission will finish. Sound simple, well it is for the most part. Putting objects on the map is pretty simple. The scripting will be a little challenging, especially if you don't have any programming experience. But, this first tutorial should be easy if you follow along carefully, so let's get started.

  1. Start by launching the Mission Editor.
  2. Zoom in on the island of Skirinka on the uppermost tip until you can see the area around the lighthouse.
  3. In the Create panel on the right hand side, select USMC, and then from Fireteams, select USMC Assault Team and place your new fireteam near that last bend leading to the lighthouse. Then press the Escape key "Esc". This will reset your cursor back to a neutral state, otherwise when you clicked again on the map you would continue to place more fireteams. There are time when you want to do that, but not right now. Let's keep this mission really simple.
  4. Zoom into your new fireteam until you can see the little white shield on the fireteam leader and select that unit.
  5. Now select Modify from from the panels on the right at the bottom and scroll down to Character. Change control mode from AI to Player. You could save your mission at this point and if you want to see what you have so far, you could run the mission. This would obviously be a pretty boring map at this point. Let's create an enemy to shoot.
  6. In the Create panel on the right hand side, select PLA, and select Fireteams, and then PLA Assault Team.
  7. Now zoom into the lighthouse, and place your fireteam between the buildings and before you deselect them select the Rotate button from the toolbar. Click in the center of the fireteam and drag to the left until they are facing the road. To get your cursor out of rotate mode, you can't just press the Escape key, you have to select a different mode from the toolbar, so go back and select the Move button. You can move and rotate the soldiers however you like. Standing in a straight line is kind of boring, but do whatever you like. If you select the fireteam Echelon shield you select the whole unit or you select the individual soldiers by selecting the AI circles.
  8. If you were to play that mission you now have some enemies, but after you kill them, you are left to wander around with nothing much to do. To keep things really simple, we are going to make our objective to get to the lighthouse and this will complete the mission. This should be pretty easy, to accomplish both in game and in the editor.
  9. In the Create panel on the right, select System > Mission > Triggers (triggerzone). Place the triggerzone on the lighthouse.
  10. In the Create panel, select System > Mission > Mission objective and place it on the lighthouse too. While the objective is still selected, in the Modify panel, we are going to change some settings to make this objective show up in our objective list. First, in the Entity section, change the name to mainObjective. Then in the Transform section, change the Altitude to 20 meters. Now in the next section Objective change the Type from Disabled to Primary Objective. Change the Objective Text (in the UI) to
    "Get to lighthouse for extraction" and the Objective Text (in the game) to "Get to Lighthouse" and that should do it.
  11. In the Create panel once again, select System > Mission > Level script and place it anywhere on the map. Now you should have a new tab on top of the map that says level.lua. Select that tab and past the following code into the editor under "-- Write your LUA script here." I will explain what the different parts of the script do at the end of the article.

    function onMissionStart()

    OFP:showLetterBoxOsd(false);
    OFP:allowPlayerMovement(true);
    OFP:allowPlayerFire(true);

    end

    function onEnter_triggerzone(zoneName, unitName)
    OFP:setObjectiveState("mainObjective", "COMPLETED");
    OFP:missionCompleted();
    end

    function onDeath_iu06usfldr(victim, killer)
    OFP:missionFailedKIA()
    end


  12. Now save and play your mission.
How the script works
Operation Flashpoint Dragon Rising has a scripting language built into it called Lua. You can find more information about Lua at lua.org.

The first function is an event handler that get run when the mission starts. The functions we are using are prefixed with on. This means, when a certain event happens, run the actions within that function.

Tutorial 1 - Mission Editor Introduction

Tutorial Goals
  • To familiarize the reader with the basic Mission Editor interface
  • Help the reader understand the different files involved and where they go
Introduction
If you have already played around with the Mission Editor, this tutorial may not be for you. I am making this lesson separate from the others in order to keep things in bite sized chunks. If you want to jump right into make a mission, skip to the next tutorial to get started. You can always come back here if you need to.

The Mission Editor is a graphical user interface (GUI) for building Operation Flashpoint: Dragon Rising missions. It is a 2D application, but it enables you to build missions for a 3D world. This can be challenging, but it is a lot of fun too.

So where is the editor. Depending on the Windows version and where you bought it, it can be in a couple of places for Steam users on Vista 64 it resides here:

C:\Program Files (x86)\Steam\steamapps\common\operation flashpoint dragon rising\Mission Editor\MissionEditor.exe

You should be able to locate it pretty easily with a little digging. If you purchased the DVD version, it might come as a separate installer on the disc (if anyone knows, please drop me a line).

Note: Depending on your installation and operating system, your path may vary. If you are a user of the non-Steam version of the game, please drop me a note where the mission editor is installed.

You might want to add a shortcut to your desktop so you don't have to drill down through all your folders in order to load the editor.

So once you have the mission editor loaded you should see a screen similar to mine. You can zoom with the wheel on your mouse. You can pan around the landscape by click-dragging with the mouse wheel.

You will also notice that when you zoom with the mouse will, it zooms towards the location your mouse is pointing.

You have a tool bar across the top. It includes buttons for New, Open, Save and Save As, Cut, Copy, Paste, Delete, Undo, Redo, Move, Rotate, Scale, Pan, Zoom, Creation location drop-down, Run, Run-Live Link, and Stop. Most of those buttons are pretty straight-forward, but for those that you may not understand, they will soon enough make sense.

The main window has tabs for the Map view, Table of Organization, Log, and other lua scripts. The map view is where you will place your units, props, waypoints, zones and more.

On the right we have the following panels:
  • Create - Allows you to select different objects and place them on the map
  • Explorer - Allows you view the mission object lists by Entity Sets, Categories and Groups
  • History - ??
  • Modify - This is where you adjust the properties of entities you have placed on the map
  • Mission Properties - This is where you the global mission properties and details. You can set the mission name, mission group, mission description, mission image, weather and many other things.
If you have read this far, I am sure you are ready to build a mission, so let's move on to the next part a basic mission!