Creating a Scenario

From Conflict of Heroes Wiki
Revision as of 05:12, 8 May 2012 by Michaelz (talk | contribs) (Created page with "Before you work on a scenario you should create the map you want to use with the scenario. Maps and scenarios are independent entities in "Conflict of Heroes." You can have ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Before you work on a scenario you should create the map you want to use with the scenario.

Maps and scenarios are independent entities in "Conflict of Heroes." You can have one map that is shared by multiple scenarios, for instance.

To edit a scenario, launch the game in editor mode. There should be a link for this in the main game directory.

If you have successfully launched in editor mode, then you should see a new "Edit Map / Scenario" link on your main menu as shown below:

Here's the main editor screen.

Some useful keyboard commands:

Delete - deletes units under the mouse cursor, may also delete scenery but don't worry about this CTRL+SHIFT+N - sets bottom left limit of defined map region under the mouse cursor CTRL+SHIFT+M - sets upper right limit of defined map region under the mouse cursor E - opens AI editor for piece under mouse cursor F# - F1, F2, etc. the function keys can be programmed in the AI editor to attach assigned scripts to units under the cursor V - test line of sight by showing what the hex under the cursor can see. Use only on a map with a LOS table. Num Pad 7,8,9,4,5,6 - change facing for unit under cursor. Note that numlock must be on.

Note that while you can use CTRL+SHIFT+N/M to set map boundaries, this is normally done on the input map, and if it's been done there you don't need to do it again in the editor.

The base scenario editor.

Keep the water plane turned off unless you've got a map with water on it.

The human preferred player is the default human player when the scenario loads. Generally the human preferred player should be the player that has to make the more complicated decisions in the firefight, often the attacking player, or the player who has to figure out how to get wagons across the map safely, or similar.

Victory editor lets you specify scoring conditions for a firefight.

I find the easiest way to edit scenarios is to write down all the x,y coordinates I want to use in the scenario on a piece of paper so that I can reference them in the tools without having to go back and forth between the editors and the maps.

Regions are named collections of hexes on the map. Regions are used to define artillery strikes, reinforcement entry points, etc.

When you refer to a region in another editor (such as the Artillery Editor), you supply a reference to the name of a region. You can then change the parameters of that region later without having to update the reference. However, if you rename the region, then you'll break all references to it. Beware of renaming regions after you've created references to them.

Scripts for describing regions in greater detail are usually located in Data\Scenarios\Scripts. If you look at the scripts I've got, you'll notice that the first few firefights exclusively used scripts. When I was first developing the game, that was the *only way* of defining region data. That quickly proved to be impractical :)

Some types of terrain are obviously exclusive with other types of terrain, however some terrain features can co-exist in a hex with other features. Here's a zoomed-in shot showing how to add more than one type of terrain to a hex when designing an input map. This shows a road, some woods, and a height all in the same hex.

The Artillery Editor lets you define artillery strikes.

I just noticed that the region isn't displayed in the strike list box. I should probably add this there for a future build.

The Reinforcement Editor:

AI scripts are a bit tricky to explain. I should start another thread dedicated to their explanation.

Placement Editor, for doing things like letting a player setup mines or barbed wire at the start of a game.

Here's text from a region script that invalidates all hexes that cannot be seen by friendly units. I post it merely to give you an idea of what these scripts look like. Time permitting, I can write more scripts if there are particular requests. The goal is to build up a little library of scripts that can be reused in ongoing firefight development, both for this game and for any sequels or expansions.

Someone with a basic knowledge of C# might be able to figure out the script structures well enough to modify existing scripts or even to write his own.


// CONFLICT OF HEROES // Selection Script // Copyright Western Civilization Software 2010 using HexGame.ModelSpace.Map.Coordinates; using HexGame.ModelSpace.ContextSpace; using HexGame.ModelSpace.Pieces; using HexGame.Controllers.GameScene;

namespace HexGame.WCS.Script {

  public class CallReinforcementScript : IScriptContext 
  { 
      public string RunScript(Context context) 
      { 
          // invalidate all hexes 
          context.GameScene.LineOfSight.InvalidateAll(context.GameScene.HexMap); 
          context.GameScene.LineOfSight.Clear(); 
          // remove invalid hexes wherever player can has a unit that can see 
          foreach (Piece pc in context.PieceManager.GetPiecesOfPlayer(context.ActivePlayer)) 
              context.GameScene.LineOfSight.Build(context, pc.MapPos, null, false, false, null); 
          foreach (MapCoord co in context.GameScene.LineOfSight.VisibleHexes.Keys) 
              context.GameScene.LineOfSight.RemoveInvalid(co); 
          return ""; 
     } 
  } 

}