SS/RW Scripting Tutorial in English

An place for english questions !
Antworten
RT
Gefreiter
Gefreiter
Beiträge: 65
Registriert: 28.12.2008, 14:54

SS/RW Scripting Tutorial in English

Beitrag von RT »

I found this on the web site shown below. It is not complete tutorial but can help you if you want to create a map or mission in SS2 / RWM/ SSRW. Trial and error works well with scripting. Eventually you will get it :D The website below is easier to read and includes graphic instructions.

http://shadock.chez-alice.fr/mapeditor.htm#_Toc11220625


1. Basics

A playable mission in Sudden Strike II consists of a map and the actual mission. A map represents an area with its terrain and a set of static objects - trees, buildings, etc.

A mission contains the units, different elements that control their behavior (locations, gates, etc.) and other elements.

A mission takes place on a map or a certain area of a map, which makes it possible to set multiple missions on the same map.

The maps and missions you modify with the editor are also known as source files. In order to play a mission, it must first be created. There are three kinds of missions: campaign, single and multiplayer missions.




2. The Editor Interface

Sudden Strike II


Main window: This is where elements of the terrain, units, markers, etc. are placed on the map.
Tool tree: Using the tool tree, you can select the available tools (graphic elements, units, and so on) in order to position the respective elements in the main screen. The lower third of the tool tree displays possible settings for the selected tools.
Auxiliary window: This contains information or further options for tools.
Minimap: Displays an overview of the entire game map. The white rectangle denotes the area of the map currently visible in the main window. You can move the rectangle around the map by simply left-clicking on a different area to switch to that location.

3. The Menu Bar
3.1. Maps
New Map

Select the map scheme and size. A scheme is a set of graphics available for building the map (normal or island).

The following map sizes are available: 128x128, 256x256, 384x384, 512x512.


Save Map

Maps and missions are saved in numbered slots. Choose one of the slots and enter a short description (or name) for the map.

There are 255 slots available in which to save maps.

Load Map

Select the map you want to load and click "OK".


Generate Bitmap

It is possible to take a snapshot of the map and save it as a bitmap. Simply select the "Generate Bitmap" option and enter a file name. Then select a file format (.JPEG or .BMP), the JPEG quality and the scale (between 1:16 and 1:1) and click "OK".

3.2. Missions
New Mission

When creating a new mission, first determine the zone size.

This can be any of the following sizes: 128x128, 256x256, 384x384, 512x512. However, the zone size of a mission can never exceed the size of the current map. Once you have created a mission, you can move the mission zone by holding down the SHIFT key and using the arrow keys.


As Campaign Mission

This option does not require you to enter a file name or description. The created map and mission are automatically saved in the MAPS/CAMPAIGN directory. The following naming convention applies:

· NNN.ssc - map file

· NNNMMM.ssc - mission file



Here, NNN is the number of the map slot, and MMM is the number of the mission slot. The map and mission are stored in different files to save space, as there may be several missions on the same map. You cannot generate a campaign mission if you have not yet saved the map or mission.

As Single Mission

Choose a file name and the mission will immediately be created with the file extension ".ssm". This file must be saved to the MAPS/SINGLE directory so that the game can access it.

As Multiplayer Mission

This works the same as for the single mission, with the exception that the file name now ends in ".smm". This file must be saved to the MAPS/MPLAY directory so that the game can access it.


!Important! In order to play using custom made maps and missions, you must generate them as described above.




Save Mission

This works the same as saving maps. The mission is stored in one of the current map's slots. A mission can only be saved if you have already saved the current map or loaded it from a slot.

There are 15 slots in which you can save missions.

Load Mission

This works the same as loading maps. Only missions saved within the current map can be loaded.

In order to play a mission, it must first be generated. Missions can be generated as campaign, single or multiplayer missions.


Delete Mission

This erases the mission you are currently working on. This function is rarely used.


Generate Bitmap

The "Generate Bitmap" option enables you to save a screenshot of the mission zone. This works the same way as saving a map bitmap.


3.3. Mission Options
Players

Most of the options in this dialog refer to single missions only. Select a player (in the top left), then adjust the settings for that player.



Five elements of the list of players have a different meaning for single or multiplayer missions. In single missions, the first four elements refer to different players (Plr1 ... Plr4), the fifth is not used. In a multiplayer mission, the five elements refer to five nations. Settings such as "Name", "Country", "Color" and "Team" are not used. You can also use the options for planes and parachutes to set the initial amount of available planes and parachutes for the five countries.



The following settings are available:

· Name: The player name. This has no influence on the mission. By default, players in single missions are named according to their role in the mission. (Player 1 "Player", Player 2 "Enemy", Player 3 "Ally", Player 4 "Neutral".

· Country: The player nation. This has an influence only on the mission evaluation.

· Color: The color used to display the respective player's units on the minimap.

· Team: The player's team. You will normally not need to change the default setting. (Player 1 Team 1, ... , Player 4 Team 4). In single missions, Team 1 (the player) and Team 3 (AI-controlled allied units) will play against Team 2 (the enemy). Team 4 is neutral.

· Planes (please note that these settings affect "classic" planes only, i.e. planes which enter the map from outside. "New" planes located on the map (normal units) are not affected):

o Directional buttons: Set the direction from which planes will arrive.

o Type: Select the plane type you want to edit.

o Options (opens a sub menu):

§ Planes: The plane that will arrive when a certain plane type is requested.

§ Number of planes: The number of planes available to the player. This will drop whenever a plane is shot down. No more than this number of planes can ever be requested at a time.

§ Number of flights: This refers to the number of "kerosene rations" available to the player. You can request no more than this number of flights.

§ Delay: The time lag between making a request for air reinforcements and the arrival of the planes.

o Parachute (opens a sub menu): This allows you to set the parachute options. Only transport and freight planes can be used to carry paratroopers. Note: Freight and transport planes differ only in their animation. The "Parachute" option does not predefine a group of units. It is up to you to select a group of up to four unit types and their numbers. You can also define the group and experience of the parachuting units. All other unit options are set to their default values. The interface is simple: Choose a unit type on the left (as you would in the unit editor) and click on one of the four buttons to the right in order to assign the unit type to one of four slots. Enter the number of units required to the right of the button. To empty a slot, enter "0" as the amount (the slot is then cleared as soon as you click "OK"). Select the desired group and experience in the dialogs above.


Scripts

This section describes the interface only. See further down for information on how to create scripts.

Selecting "Scripts" from the menu opens a dialog with a list of triggers. This list is empty to begin with. The following operations are available:

· New - Creates a new trigger. A script window is opened, where you can edit the trigger. It consists of three parts: The condition window above, the action window in the middle and the list of available conditions and actions below. To add a condition or an action, click in the respective window and select an action or condition from the list. Right-clicking removes actions or conditions from the window.

· Edit - Allows you to modify a selected trigger. The same window appears, enabling you to edit the trigger.

· Delete - Deletes the selected trigger.

· Up/Down - Moves the trigger up or down in the list. Triggers are executed beginning with the uppermost and working downwards, though their order is only important in very specific situations (when the outcome of an action at the top of the list determines the conditions for a trigger further down).

· Copy - Copies the trigger to the clipboard.

· Paste - Pastes the trigger from the clipboard. You can use the clipboard to duplicate scripts, or to copy them from one mission to another. (This is easiest if you run two instances of the Sudden Strike II editor.)

· Save - Saves the trigger to a file.

· Load - Loads a trigger from a file. Please note that only the actual scripts are saved, not the phrases/groups, etc. they refer to.


Reinforcements

Reinforcements are sets of units which can be sent onto the map during the game using a script. They enter the map via a gate (see below).

The reinforcements dialog displays a list of available reinforcement slots. Select the desired slot, then click on "Edit". This accesses the unit editor, where you can determine which units are to be among the reinforcements. The edit box below the unit editor also allows you to change the name of the reinforcements. Reinforcements can also be deleted (select and click "Delete").

The following limits apply to the composition of reinforcements:

- Not all unit types can serve as reinforcements (e.g. stationary coastal artillery).

- Reinforcement units should be equipped with sufficient crew to man them.

- "Large" units (e.g. trains and battleships) and "normal" units cannot be part of the same group of reinforcements.

Creating Reinforcements



You can simplify the process of generating reinforcements by using templates to create them. This is particularly useful when creating multiplayer games, where the reinforcements on all sides should be equal. Balancing units manually is an extremely tedious process, and using pre-balanced templates makes it much easier.

Clicking on "Generate" opens a generator dialog box. Use this to specify the following options:

· The country for which you want the reinforcements to be created. You will normally choose a specific nation for single player missions, or "All" for multiplayer missions (where equal reinforcements are needed for all nations).

· The name of the reinforcements. When generating reinforcements for all countries, the name of each group of reinforcements receives its nation's name as a prefix.

· Several slots in which you can specify the template name and number of repeats. For example, you can select the "Medium tank platoon" and "2" as the repeat count. This means that the generated reinforcements will have 2 medium tank platoons. (When generating reinforcements for all countries, each of the reinforcements will have 2 tank platoons with national units.)

Once you click on "OK", you will have generated one (if you selected a specific nation) or five (if you selected all nations) group(s) of reinforcements.


Groups

This dialog enables you to set the options for a group. You can easily access this dialog by selecting "Units" from the tool tree and right-clicking a group in the group view. If you open this dialog via the main menu, enter the number of the group and click on "Update". This selects the group whose properties you can now view or edit.


"Troops" Section

Enables you to view the number of units belonging to this group currently on the map or on board other units.

"Reinforcements" Section

This allows you to set the automatic reinforcement properties. If the "Send Automatically" option is enabled (i.e. if this box is marked), dead units of this group are moved to a container labeled "Hell" and regenerated once certain conditions are fulfilled, to be sent back onto the map as reinforcements. The options for automatic reinforcements are self-explanatory.



Note: If you do not want units to be restored automatically, you can control their regeneration using scripts (see below).

"Behavior" Section

This section enables you to edit the behavior options of the group. The displayed values are the initial values of various options of behavior, and can later be altered using scripts. For a description of behavior options, please see the "Script Creation" chapter.


Objectives

Mission objectives are clear text displayed alongside the briefing and during a mission. Type the objectives into the text window and click "OK".


Phrases

You can edit phrases that are later used for scripts.

Up to 64 slots are available. Each phrase consists of a text and sound (both are optional).

Editing is simple: Select the phrase slot from the list, then choose a sound from the drop-down list and type text in the box below.


Generate Tactical Map

This option controls the generation of a tactical map. If enabled, a tactical map and the briefing can be displayed during the game (using the CAPS LOCK key). The tactical map increases the size of the mission file by approximately 50 - 100K (saved using JPEG compression). It also adds noticeably to the time required for mission generation.

Settings

This dialog enables you to define the minimum and maximum number of players and teams for the map. The number of players may range from two to twelve, and the number of teams from two to four. These options are not used unless the mission is generated for the multiplayer mode.

You can also set the type of weather for the mission.




4. Editing Maps

The tool tree on the left-hand side enables you to select objects or units which you can place on the map via the main window.


Placing Objects (trees, roads, houses, bridges, cliffs, craters, fences, free, vertical, horizontal objects)

The elements of the tool tree allow you to position static objects on the map.

First select the category, then pick out the object from the list in the auxiliary window (also note that there is a "RANDOM" object available as well). Click an object to select it, then left-click on the map to position it. If you selected the "RANDOM" object, an object of the selected category will be picked at random and placed on the map whenever you left-click. This can be very useful, for example when creating forests. If, however, you do not like a random object you have placed, click on "Other" or press the TAB key to change it. To delete an object, simply right-click on the object of the selected category on the map.

Some categories are further divided into sub categories. Click the "+" next to the category to view the list of numbered sub categories. If you select a sub-category, only those objects belonging to it will be displayed in the auxiliary window. Random objects are also selected from within this sub-category only. You can select multiple sub categories at a time by holding down the CTRL or SHIFT key.

Some objects can be destroyed. Their degree of destruction can be specified using the "Damage" slider or the SPACEBAR.

The "Density" slider enables you to adjust the default width of objects. Increasing the density makes it possible to fit more objects into the list, but may lead to display errors (clippings).


Terrain

Editing terrain is simple. Open the respective category in the tool tree to see the following sub categories displayed:



· Terrain: grass, ground, farmland, asphalt, dry ground, sand and water

Select a terrain type from the list and apply it to the map by holding down the left mouse button. Use the right mouse button to apply the default texture.

· Set Brightness: Enables you to adjust the brightness of the map. Use the slider to adjust the brightness, then continue to apply terrain textures to the map. The right mouse button resets the brightness to its default value.

· Lighten/Darken: This option allows you to gradually adjust the brightness of cells. Press and hold the left mouse button and move the mouse as usual. The cells you apply the tool to will gradually become lighter. Press and hold the right mouse button to reverse the effect and darken the terrain.

· Eraser: Enables you to clear any static objects of whatever type.


Save/Load Objects

This option enables you to save and load blocks of static objects.

To save a block, first select the area you want to copy, using the brush as follows:

· Select the desired brush size, as in all other modes.

· Hold down the left mouse button and drag to create a selection on the map. The selected area will be highlighted. The right mouse button cancels the selection.

· Click on "Save", type in a name and click "OK".



To load a block, proceed as follows:

· Click "Load". Choose a file and click "OK". The selection is temporarily stored.

· Press and hold the CTRL key. The cursor changes to display the image of the loaded block.

· Move the block to the desired location and left-click to place it there.

· If you are not happy with its positioning, right-click to delete the block.



The following additional options are available:

· Load Into Center: Loads the block and places it in the center of the mission. This makes sense when copying an entire mission. (load the map - load the mission - select the mission - save - create a new map - new mission - load the block in the center).

· Select All: Selects the entire map.

· Select Mission: Selects the mission zone.

· Deselect: Cancels the selection.


Automatic Generation

This tool allows you to generate elevations, cliffs or roads. Use it as follows:

· Select a cliff type from the list.

· Left-click several locations on the map to draw a polygon. Right-clicking a marked location deletes it.

· Simultaneously press and hold the SHIFT key and left-click on the map or click "Build" to create a line of cliffs.

· If you are not happy with your cliffs, simultaneously hold down the SHIFT key and right-click or select the "Delete" option to remove them.

· Set your markers clockwise to create an elevated ridge and counter-clockwise to lower the ridge. You can also click "Reverse" to change the order.

· Adjust the curve's priority setting to make the cliff closer to the polygon, or to make it straighter.

· Adjust the "Exact End" setting to allow the cliff line to deviate from the end of the polygon line to within a certain distance. More freedom to deviate in this instance often makes it possible to create straighter, far better looking cliffs.




Visibility

Characterize certain cells of the map as "Raised" or "Lowered" to define their visibility. The following rules apply to the visibility of those cells:

1. If, within an observing unit's line of sight, a lowered cell immediately precedes a raised cell, i.e. the lowered cell is closer to the unit, that unit's line of sight ends in front of the raised cell.

2. On the other hand, if the raised cell is closer to the unit, the cells beyond it are also visible and rule no. 1 does not apply.



The use of these rules on the map is simple. To create an elevated position, surround it first by raised, then by lowered cells. To create a dip in the terrain, surround it first by lowered, then raised cells.

Visibility flags are set automatically when cliffs are placed, but sometimes have to be adjusted by hand. Automatic flags can be adjusted as follows: Left-clicking reverses their value, right-clicking cancels the inversion. In other words, left-clicking deletes an automatic flag, while right-clicking reactivates it.


Locations

Locations are used for scripting, as you may want to refer to a certain position on the map. They are therefore further described in the "Scripts" chapter.

The auxiliary window contains a chart with 63 locations (numbered 1-63) available on the map. The number zero is not available, as it represents to the entire map. In order to enable the current position, click one of the cells. Assign a number to a location using the slider below the tool tree. The map displays the cells (marked blue) represented by the locations. Each cell has a number which assigns it to a specific location.

A location is a set of cells which can be defined at will, limited only by the rule that locations must not overlap. Locations can be edited using the brush, the same as when drawing terrain. The user interface is the same as when applying terrain textures: Hold down the left mouse key and move the cursor to add cells to the location. Use "+" and "-" or the spin control to adjust the brush size. Press and hold the right mouse button and move your cursor to remove cells from a location.



Markers

Markers are used for scripting, whenever you need to test the state of a certain object (e.g. building), or to specify a single cell on the map. They also denote the positions of zeppelins in multiplayer games. For further information please refer to the "Scripts" chapter.

The marker view is a chart in the auxiliary window, containing 100 markers numbered 0-99. Click a cell to select the current marker, or choose the current marker using the spin control below the tool tree. Left-click a cell on the map to place a marker there, or right-click to remove a marker.


Sounds

Ambient sounds are sounds that are played in certain areas of the map. They are used to create the impression of flowing water, birds singing in the woods, etc.

To place a new ambient sound on the map, proceed as follows:

· Click Add New .

· Select a sound from the list and click "OK".

· Adjust the sound options.

· Click on the map to place the sound.

To edit ambient sounds, proceed as follows:

· Click Edit Existing .

· On the map, click on the sound you want to edit.

· Adjust the sound options.

The following options are available:

· Radius: The radius within which the sound can be heard (in cells).

· Priority: The priority of this sound as compared to others. If there are not enough sound channels available to play all sounds simultaneously, the sounds with the lowest priority will be dropped.

· Min Delay: The minimum delay between playbacks (in seconds).

· Max Delay: The maximum delay between playbacks (in seconds).


Gates

Gates are points of entry for reinforcements. Each gate has an entry zone, where units will appear, and a destination to which they will move once they are on the map. Only gates set on the edge of a mission zone can have an entry zone larger than one cell. The entry zone and destination should never be identical, as the first units of the reinforcement group will otherwise block the access to the map for those who follow.

To edit gates, choose the Gates entry from the tool tree. Any gates already existing on the map are displayed by flags. Entry zones are represented by red and destinations by blue flags.

Gates are named A to P. Choose the gate's letter using the spin control.

Left-click to set the selected gate's entry zone and right-click to determine the destination. Click on "Clear" to remove the selected gate.

If you set the entry point correctly (just outside the mission zone), you can determine the width of the entry zone using a slider. This picture shows the correct position:

Sudden Strike Forever



Entry point A is correct, entry point B is too far away from the border of the mission zone and entry point C is within the confines of the mission zone and therefore invalid. If entry point C were applied, the reinforcements would appear to suddenly pop up out of the ground and you would not be able to set the width of the entry zone.



!Important! If you use gates to set the starting points in a multiplayer game, you must define a sufficiently large area of "locations" (see above) around the destination.


Mines

Editing mines is simple. Adjust the desired mine options, i.e. choose the mine type and the teams to whom this mine will be visible (if the mine is visible to a team, the units will avoid it). Left-click on the map to place a mine, or right-click to remove a mine you have already placed. Adjusting the brush size allows you to place an entire minefield at once.


Airfields

Airfields consist of a "territory" with runways on which planes can move and land, as well as hangars and liftoff and landing points.

To edit the territory, choose the Territory sub-category from the tool tree. Left-click and drag to create the territory, or right-click and drag to erase it. You can also adjust the brush size using the spin control or + and - . Note that the territory is just a flag on the map, indicating that planes can move here, i.e. there is no need to specify the airfield index when creating the airfield territory.

To place hangars, a liftoff point, or a landing point, choose the required sub-category from the tool tree, then select the airfield index with the spin control. Left-click on the map to place an object or use the right mouse button to remove it. You can set no more than one liftoff and one landing point and up to 16 hangars per airfield. Note that planes (which occupy 3x3 cells) should be able to move from hangars to the liftoff point, and from the landing point to the hangars through the airfield territory, or they won t be able to lift off and land correctly.


Other Flags

The following flags (and corresponding sub-categories in the tool tree) are available:

· Blocked: Blocks a cell so that units cannot move across it.

· No Waves: Wave animations are disabled for the selected cell.

· Shallows: Enables ships and landing troops to pass through the cell.

· No Pontoon Bridges: No pontoon bridges can be built in this cell.

· Full Stop: The cell cannot be crossed, viewed or fired across.

!Important! The flags "Blocked", "No Waves" and "Full Stop" are normally set automatically and only rarely require manual editing.


5. Units
Placing Units

In order to edit units, select the "Units" category from the tool tree. This takes you to the unit editing mode, and the group view appears in the auxiliary window.

Click on "Add New". A unit editing window (see "Unit Editor" below) opens, where you can choose a unit. Select the unit you want, modify the options and click "OK". This activates the adding mode and changes your cursor into an image of the new unit. Now left-click on the map to place the unit. You can remove a unit by right-clicking on it. Units' options can also be adjusted in the editing boxes below the tool tree. (Units can only be assigned to different players using the boxes below the tool tree.)

You can also switch to the unit adding mode by clicking the "+" next to the "Units" category to expand the list. Expand the desired nation's options, and choose the unit. This unit can now be placed on the map using default options. You can also edit and adjust the options as described above.


Editing Units

Selecting "Edit Existing" enables you to modify units already on the map. To enter this mode, either click on "Edit Existing" or press the SPACEBAR. To select units, hold down the left mouse button and drag a selection box around all units you wish to edit. You can also select single units by left-clicking on them, or press and hold the SHIFT key, then click units to add them to the current selection. Having selected the units you want to modify, you can now adjust their options using the editing boxes below the tool tree.

Unit Editor







The unit editor is an important component of the game. You will see it in when placing units on the map, editing reinforcements, or parachute drops.

The window is divided into three parts: The list of unit types, the unit options and a so-called container. You will also see the buttons "OK" and "Cancel", as well as a text box where you can enter a group name (for reinforcements only).


Unit List

On the left is a list of various different unit types. It contains buttons determining the units' nationality and class, as well as a units list box.

To choose a unit, you should first select the appropriate country and class the unit belongs to. Then click the buttons to open a selection of units belonging to that nation and class in the list box. Click on the desired unit. Its picture will now appear in the window.

If you like, you can select more than one class and country to choose from. To do so, press and hold the SHIFT key when you click on the buttons. For example, having selected "Germans" and "Infantry", you can select the "Crew" class as well and open a list of all units belonging to these categories.


Unit Options

The unit options section consists of the following:

· An image window displaying a picture of the edited unit. It also contains these symbols:

· Question mark: Unit not selected.

· Right arrow: Edit options of selected units in container (see below).

· A unit description text.

· An options box for editing the unit's six basic options.

· "Crew" and "Passengers" buttons for editing a unit's crew and passengers.

· "Place" and "Get" buttons for working with the unit pool.



The options boxes will normally display options for the currently selected unit (the new unit you are about to place on the map or in a container). The exception is when editing units inside a container (see below).

Each unit on the map has the following options:

· HP (hit points): Indicates the unit's percentage of damage. HP=100 (default) means the unit is intact, HP=0 means it has been destroyed.

· Ammunition: Indicates the unit's ammo supply in percent. ammo=100 means the unit has a full supply of ammunition, ammo=0 means it has run out of ammo. Some units use more than one ammo type, so the value refers to all types of ammunition.

· Experience: Indicates the unit's percentage of experience. Experience=0 (default) means the unit is inexperienced and unskilled. Experience=100 means the unit is as experienced as it will ever be; it is highly dangerous and battle-hardened.

· Morale: Indicates the unit's morale in percent. Morale=50 is the default value. If it drops below 50, the unit's experience will deteriorate. If it is over 50, it has the opposite effect.

· Group: Indicates the group the unit belongs to. Group indexes may vary between "A0" to "J9" (a total of 100 groups is possible). Units must be assigned to groups for AI scripting purposes.

· Lives: Indicates the amount of extra lives a unit has. This can vary between 0 and 255. When a unit with extra lives is destroyed, it is moved to a container labeled "Hell". Units in this container can later be revived by scripting or enabling automatic reinforcements.



The "Crew" and "Passengers" buttons allow you to edit a unit's crew and passengers. Each of these units represents a class. When you select a class, the container on the right is replaced by the units you wish to edit. The number of places available when editing classes is limited. In other words, you cannot assign more passengers or crew members than the unit can hold. Your selection is not limited to crew and passenger unit types. You can use any units listed in the container. Units which are not available are simply disabled.

Container

The left part contains the list box with the contents of the container you re editing and a few editing buttons. This section is disabled when editing a single unit.

When describing the edit commands, the following terms are used:

· Current unit - The unit displayed in the center of the window.

· Selected unit - The unit that is currently selected in the container.



The following editing commands are available:

· Add - Adds the current unit to the container.

· Copy - Copies the selected unit as a current unit and deselects it. Only available when a single unit has been selected.

· Delete - Deletes the selected unit(s).

· Cut - Copies the selected unit and then deletes it.

· Up - Moves the unit up the list. Only available when a single unit has been selected.

· Down - Moves the unit down the list. Only available when a single unit has been selected.

· Save - Saves the contents of the container.

· Load - Loads container contents (current contents are lost).

· Deselect - Deselects the unit in the container.

· OK - Applies the changes to the unit.



You can also edit the options for the units inside the container. To do so, proceed as follows:

· Select a unit by clicking on it. (Or press SHIFT and click to select multiple units.)

· An arrow pointing to the right (to the container) will appear in the image window, and the options of the selected units are displayed in the options boxes. (If the value for an option is the same for all the units, it will be displayed. If some of the selected units have a different value for this option, the box remains empty.)

· You can now edit the options for the selected unit(s).

· Click on "Set". This applies the changes made.

This only allows you to adjust the units' six basic options. To modify a unit's passengers or crew, proceed as follows:

· Click on the unit you wish to edit.

· Click "Cut". The unit is copied as a current unit and removed from the container.

· You can now edit the crew, passengers and other options.

· Click on "Add". The unit is returned to the container.

· You can optionally use the "Up" and "Down" commands to move the unit to a certain position inside the container.




Editing Groups

When editing a mission using scripts, you will need to set a group to add your units to. To do this you must use the group view in the auxiliary window.

The group view consists of a chart containing 100 group. Each panel of the chart displays the number of units in a group and the color of the player the group is assigned to. The colored bar above the number indicates the player. The selected group is the one the selected unit will be added to.



While in adding mode, you can left-click to select the desired group. All units are now added to that group.

While editing existing units, the following options are available:



· Left-click to transfer all selected units (including passengers) into the group (selected by clicking).

· Press SHIFT and left-click to transfer ONLY the passengers of the selected units.

· Press ALT and left-click to select the units in the group and cancel previous selection.

In both modes, right-click on a group to view its properties (see "Groups").

For further information on groups, see the "Script Creation" section.


6. Scripts
Models of Behavior

Each group of units in a mission has a model of behavior, which influences the way all computer units (AI-controlled) act. Five values are used to describe a group's behavior. These are: AI_BEHAVIOR, AI_LOC1, AI_LOC2, AI_GRP1 and AI_GRP2.

AI_BEHAVIOR saves the actual actions, dependent on behavior models and their options. Each model of behavior has a list of options you can enable or disable.

AI_LOC1 and AI_LOC2 save the numbers of two places which are particularly important to the group. How these values are generated depends on the behavior model, i.e. if a certain behavior has been set, the units will move to one of these locations.

AI_GRP1 and AI_GRP2 save the numbers of certain unit groups, e.g. if another group is to be followed or supported.



Here is a list of all available models and their descriptions. The options for each of these models are not described in detail here, as they tend to be self-explanatory. Only potentially uncertain cases are mentioned here.








********

AI_BEHAVIOR


None

AI_LOC1, AI_LOC2


Not used

AI_GRP1, AI_GRP2


Not used

Description:


No special actions. The units maintain position and will only attack if the enemy comes into view.








********

AI_BEHAVIOR


Infantry - Guard zone

AI_LOC1, AI_LOC2


Guarded zones

AI_GRP1, AI_GRP2


Not used

Description:


The infantry moves to the specified locations and guards them.



In addition to infantry, this group can hold AT guns, howitzers, MGs, mortars and jeeps.

The infantry will use this equipment and never attempt to give it up. Guns of other groups are only used if they happen to be in the specified zone, and only if the appropriate option was set previously.



If the "Don't move to new zone" option has been enabled, crews will leave their guns when the infantry leaves a zone (its position), either because this behavior has been set or because AI_LOCx has changed. If the "Don't leave" option has also been enabled, the crew will continue to maintain its position.



If neither "Don't drag to new zone" nor "Don't move to new zone" have been enabled, the crew waits for a truck for about 15 seconds and then drags the gun by hand. If only "Don't drag to new zone" is enabled, the crew will leave the gun. If "Don't move to new zone" has also been enabled, the crew will continue to maintain its position.



All of these settings refer ONLY to guns of other groups. All except the "Don't leave" option are ignored for all guns belonging to the group itself.








********

AI_BEHAVIOR


Infantry - Pursue

AI_LOC1, AI_LOC2


Guarded zones

AI_GRP1, AI_GRP2


Pursued groups

Description:


The same as "Guard zone". If units belonging to AI_GRP1 or AI_GRP2 come into view, they will be attacked. All "Move to zone only if ..." options are used only in connection with moving to AI_LOC1 and AI_LOC2. Guns are never dragged and only used if they are nearby.






********

AI_BEHAVIOR


Infantry - Crew howitzer

AI_LOC1


Guarded zone

AI_LOC2


Howitzers' vision range

AI_GRP1, AI_GRP2


Not used

Description:


The same as "Guard zone", except that only AI_LOC1 is guarded, AI_LOC2 describes the vision range of the howitzers. Jeeps are not used.








********

AI_BEHAVIOR


Tanks - Guard zone

AI_LOC1, AI_LOC2


Guarded zone

AI_GRP1, AI_GRP2


Not used

Description:


Tanks remain in the specified locations and guard them. Only tanks and armored units (gun carriages and APCs) are allowed.








********

AI_BEHAVIOR


Trucks - Support

AI_LOC1, AI_LOC2


Rest zones

AI_GRP1, AI_GRP2


Groups to follow and provide support for

Description:


Transport vehicles support the players units and those of his allies by pulling/dragging artillery.



Infantry units inside the transports are immediately unloaded.



If the "Move to zone only if there are no support units" option is enabled, the unit will move to the specified location, provided there are no guns to be moved. If this option is not enabled, the unit will follow AI_GRP1 and AI_GRP2.



If "Support only the selected groups" is enabled, only AI_GRP1 and AI_GRP2 will be supported; if the option is disabled, the players own units and those of his allies will be supported.



Once the gun has been hitched up, the truck will obey the commands of the gun crew and thus adapt to their behavior, until the gun is uncoupled.








********

AI_BEHAVIOR


Trucks - Move to zone

AI_LOC1, AI_LOC2


Target zones (uses closest point)

AI_GRP1, AI_GRP2


Not used

Description:


Transport vehicles move straight to the specified zone. If there are infantry units in the transports, they are immediately unloaded on arrival. (The trucks transport infantry units.)






********

AI_BEHAVIOR


Trucks - Transport Infantry

AI_LOC1


Transport's departure

AI_LOC2


Transport's arrival

AI_GRP1, AI_GRP2


Not used

Description:


Transport vehicles move to AI_LOC1, wait until they are at least 70% full and move to AI_LOC2, unload the units and repeat the process.








********

AI_BEHAVIOR


Supply Trucks - Repair

AI_LOC1, AI_LOC2


Locations of repair jobs

AI_GRP1, AI_GRP2


Not used

Description:


Supply trucks will repair units.

If "Repair objects" is enabled, the truck will also repair bridges, but only at AI_LOC2 and only if the bridge has a marker. Trucks will also repair railroad tracks and airfields in AI_LOC1 and AI_LOC2.



If "Repair only inside zone" is enabled, only units at AI_LOC1 or AI_LOC2 will be repaired. If this option is disabled, all the players own units and those of his allies are repaired.



If there is nothing to repair, the truck will move to AI_LOC1.



In order to construct pontoon bridges with this behavior selected, enable the "Build pontoon bridges" option. The location of pontoon bridges should be AI_LOC2 and should have a marker.








********

AI_BEHAVIOR


Missile launchers - Move to location

AI_LOC1, AI_LOC2


Target locations (uses closest location)

AI_GRP1, AI_GRP2


Not used

Description:


If "Hold fire" is enabled, you should use scripts in order to fire. If it is disabled, missile launchers will attack autonomously, targeting groups of enemies.








********

AI_BEHAVIOR


Planes - Move to location

AI_LOC1, AI_LOC2


Target locations (uses closest location)

AI_GRP1, AI_GRP2


Not used

Description:


Planes will take off and move to the specified location to carry out their mission (scouting, bombardment, dropping paratroopers).



For bombers, the first two flags are the other way around, i.e. "Bomb only if there are no friendly troops there" and "Bomb only if there are enemy troops there". Transport planes will wait until they are at least 70% full before they lift off.








********

AI_BEHAVIOR


Trains - Guard zone

AI_LOC1


Guarded zone

KI_LOC2


Location for repairing tracks

AI_GRP1, AI_GRP2


Not used

Description:


Trains repair tracks at AI_LOC2 (only if "Repair track" is enabled), then move to AI_LOC1 and guard it.



Script Creation

Scripts are at the heart of every mission. They are essential for the definition of precise behavior patterns for AI-controlled units and creating exciting, eventful missions for Sudden Strike II.

The scripting engine used in Sudden Strike II is easy to understand and largely self-explanatory.

A mission script contains a series of triggers. Each trigger consists of a condition and one or several actions. Here's how a script works: While a mission is played, all conditions of a trigger are checked regularly (several times a second). If a condition is met, the respective trigger's actions are performed. Examples of the triggers' logic: "If all units in group A1 are killed, the player loses", or "If the player's units reach a certain location, tell the player to look out for enemy troops, dispatch reinforcements to that location and disable trigger to prevent it being activated again".

Triggers are modified in the script editor, described above. (To access it, select "Options" > "Scripts" from the main menu.)

The following chapter describes all conditions and actions you can use in the scripts, sorted by subjects.


User Interface

To have a text displayed for the player during a mission, create a phrase containing that text and employ the "say phrase <Phrase>" action. Here, <Phrase> should be substituted by a mission phrase. A phrase can contain text as well as sound.

While the phrase is being "played back", you can highlight a specific point on the map. To do so, set a marker at that location and employ the action "say phrase <Phrase> with pointer to an object <n>". <n> represents the number of the marker.

Text can also be displayed in a dialog module (i.e. the game is paused and the text appears in a new dialog box in the main screen, until the player clicks "OK"). Use this method for vital messages you do not want the player to miss. Dialogs can be displayed using the "show modal dialog <Phrase>" or "show modal dialog <Phrase> with a pointer to object <n>" actions. It is used the same as a phrase.

You can also enter "move screen to location <n>" to automatically scroll the screen. The screen will then center around the defined location.

Timers and Timing

The simplest way of determining the time you want a certain action to be performed is using the "time from start of mission is <comp-op> <Time>" condition. <Comp-op> can have any of the following values: "equals", greater than" and "less than".

If you want more control over actions (e. g. to have an action performed within a certain period of time after the condition has been met, or if you want it performed at regular intervals), you should use timers. A timer will let you set the action to be performed at a particular time or with a specified delay. There are 100 timers available, numbered from 0 to 99. Timers are independent of one another and can work in parallel.

A timer works as follows: Use the action "set timer <n> to <Time>", where <n> is the number of the timer. Once the time specified has elapsed, the condition "timer <n> elapsed" is fulfilled. If the action "stop timer <n>" is performed in between, the timer is stopped and not activated. Note that the condition "timer <n> elapsed" remains met until the timer is reinitiated. If you only want this condition to enable one action, you should disable the trigger afterwards.

In the preset, the timer only works once. If it is to be activated again, it must be reinitiated. If you want actions to be performed on a regular basis, set the timer accordingly. You can do this using the "set timer <n> period to <Time>" action. As soon as this action is performed, the timer activates regularly within the period specified, i.e. the condition "timer <n> elapsed" is fulfilled ONCE within the specified time span. There would be no point in disabling a trigger with this component once its action has been performed, as doing so would interrupt the cycle.

A special timer is the so-called countdown timer. If this is set, its value is displayed in the upper left corner of the screen, so that the player can see how much time he has left. To set this timer, use the action "start countdown from <Time>". You can check the current value with the condition "countdown is <comp-op> <Time>".


Checking Units' Positions

You can use the following conditions to check the locations of your units:

"there is <comp-op> <n> units of group <Group> in location <Location>"

"there is <comp-op> <n>% of units of group < Group > in location <Location>"

"there is <comp-op> <n> units of player <Player> in location <Location>"

"there is <comp-op> <n>% of units of player <Player> in location <Location>"

"the number of <Unit Class> units of group <Group> is <comp-op> <n>"

"the number of <Unit Class> units of player <Player> is <comp-op> <n>"

"the number of <Unit Class> units of player <Player> in group <Group> is <comp-op> <n>"



The conditions are self-explanatory. Unit class in this context may be a combination of four primary unit classes: "Active" (normal units on the map - infantry and machines with crews), "Container" (manned and unmanned artillery and machines without crews), "In Hell" (killed units that can be restored) and "Underway" (units which have been dispatched as reinforcements, but have not yet reached the map).




Controlling Units' Behavior

To control units' behavior, use the actions "set AI_BEHAVIOR for group <n> to <Behavior>", "set AI_LOC1 for group <n> to <m>", "set AI_LOC2 for group <n> to <m>", "set AI_GRP1 for group <n> to <m>" and "set AI_GRP2 for group <n> to <m>". The actions are self-explanatory.

You may use the "patrol" mechanism to have zones patrolled. The action "add patrol locations <AI_LOC1> <AI_LOC2> for group <n>" adds both locations to a group's cyclic patrol buffer. The action "clear patrol locations for group <n>" clears the buffer. The "shift patrol locations for group <n>" action takes the next set of locations from the buffer and assigns them to AI_LOC1 and AI_LOC2 for that group. This lets you easily alter the AI locations for groups. Using these actions combined with a periodic timer enables you to have a number of different locations patrolled regularly.


Controlling Reinforcements in Single Player Games

To employ reinforcements in single missions, use the action "send to player <Player> reinforcement of type <Reinforcement> via gate <Gate> into location <Location> with delay <Delay>".

The arguments used in this actions stand for the following:

· <Player> - The player you want the reinforcements to be sent to (select from list).

· <Reinforcement> - The actual reinforcement (select from list). You should use the reinforcement editor to generate reinforcements before enabling this action (main menu > "Options" > "Reinforcements").

· <Gate> - The gate through which the units will appear.

· <Location> - The location you want the units to move to once they appear.

· <Delay> - The delay between the performance of the action and the appearance of the first units.

You can also provide the player with additional aircraft using the following actions:

"give planes to player <Player>: <n> <Plane Type>" assigns n additional aircraft of the specified type to the player.

"give plane fuel to player <Player>: <n> for <Plane Type>" assigns n additional fuel supplies for planes of the specified type to the player.

Another, more "elegant" way of assigning aircraft to a player is to place neutral planes on the map and transfer control to the player. For further information, refer to the "Controlling Planes" section below.


Controlling Reinforcements in Multiplayer Missions

In single player missions, reinforcements are automatically dispatched when a player reaches a zeppelin. In multiplayer missions, zeppelins are generated wherever a marker is positioned. Zeppelins are grouped by colors as described in the following script actions. These actions control automatic reinforcements:

"set initial reinforcements, Russians - <xx> Germans - <xx> British - <xx> Americans - <xx> Japanese - <xx> delay = <Time>" lets you determine the reinforcements for each player at the beginning of the game.

" set reinforcements for zeppelins <zzz>, Russians - <xx> Germans - <xx> British - <xx> Americans - <xx> Japanese - <xx> delay = <Time>" sets the reinforcements for all players when the respective team captures a group of zeppelins.

"set planes for zeppelins <zzz>, <n> <Plane Type>" enables you to specify the number and type of additional planes a player will obtain when capturing these zeppelins.

"set plane fuel for zeppelins <zzz>, <n> for <Plane Type>" determines the number of additional fuel cargoes for the specified plane type that a player will obtain when capturing these zeppelins.

"set message for zeppelins <zzz>, <Phrase>" allows you to determine phrases that are displayed as soon as a group of zeppelins is reached.

These actions should be set at the beginning of a mission. All of these settings are stored, and the reinforcements specified are generated automatically.

"set infinite reinforcements mode". In multiplayer missions, this action activates a mode in which reinforcements are regularly sent for zeppelins, for as long as those zeppelins remain in the player's possession (unlike in the normal mode, where reinforcements for zeppelins are dispatched only once per team). The delay between the generation of new reinforcements is set in the game options.


End of Mission and Order of Events



"end of mission: <Result>". This action ends the mission and evaluates the outcome. The value of <Result> can be either "Victory", "Defeat", or "Draw". This is the most commonly used action of all, and is required in every single player mission (otherwise the mission cannot end). The action should be employed in combination with the condition that checks on the amount active units a player still has (i.e. the mission ends if he loses all units (defeat) or if the enemy loses all units (victory)).

This action is not used in multiplayer games, as they end automatically.

"set next mission to <nextmis>" This action is used in campaign missions only. It determines which mission is to follow next within the campaign. The following options are available: a mission (enter the number of the map and mission slots), "Campaign complete", "Campaign failed" and "Forced replay".


Controlling Planes

"Send <n> <Plane Type> of player <Player> to marker <m> and land to airfield <af>" and "send <n> <Plane Type> of player <Player> to location <Location> and land to airfield <af>" are the basic scripts used to control aircraft. They operate as follows: If the player does not have enough planes of the given type or enough fuel for them, nothing happens. If these conditions are fulfilled, planes will be sent to the specified marker to carry out their orders (transport planes drop paratroopers, bombers drop bombs, scout planes perform reconnaissance missions). The planes will then land on the specified airfield or, if airfield 0 was selected, leave the map.

The action "send <n> planes of group <grp> to airfield <af>" enables you to transfer planes from one airfield to another. This action will only work if the planes are on the ground. If the planes of the group you enter are airborne, the action will be delayed until they land.

Flight routes can be precisely determined using the following actions: "start plane route" begins a new route (and deletes previously created routes), "add route point over marker <m>" and "add strike point over marker <m>" add waypoints and attack points. Once a route has been created, it can be employed using the "send <n> <Plane Type> of player <Player> via plane route" command. Any route can be used an unlimited number of times, until it is redefined using the "start plane route" action.

The following conditions will check on the number of planes a player possesses:

"player has <comp-op> <n> <Plane>" is true, if the player has "exactly", "more than" or "less than" n planes of the type specified.

"player has <comp-op> <n> fuel loads for <Plane Type>" is true, if the player has "exactly", "more than" or "less than" n fuel loads for planes of the type specified.


Controlling Indirect Firing



"launch rockets by RL of group <n> to location <Location>"

"launch rockets by RL of group <n> to marker <Object>"

"fire a howitzer of group <n> to location <Location>"

"fire a howitzer of group <n> to marker <Location>"

"launch static rocket of group <n> into location <Location>"

These actions allow you to fire single shots with long-range weapons (e.g. missile launchers, howitzers and static rockets (V2s)). If there is more than one missile launcher, howitzer or static rocket in a group, a random one will be chosen. The target can be either a location (a randomly selected target point) or a marker.


Controlling Fog of War

"Show zone around marker <m> in radius <r> for player <Player>" lifts the fog of war for the specified player. The revealed zone is the vision range of an imaginary unit with a vision radius of <r> (i.e. all locations within the radius <r> measured from the center of the circle are revealed).

This reveals a circular area with a fixed radius whose center is the designated marker. The zone remains uncovered ONLY until the next script query. This means you should have this action performed regularly by a trigger that you do not turn off. Here is an example of the correct use of the action:



Condition:

time from start of mission is more than 05:00:00 and time from start of mission is less than 06:00:00

Actions:

show zone around marker 0 in radius 10 for player Player



Note that no "turn off this trigger" action has been set.

You can also use timers and variables to control this action.
wingman1985
Newbie
Beiträge: 4
Registriert: 08.05.2013, 04:48

Re: SS/RW Scripting Tutorial in English

Beitrag von wingman1985 »

This is quite useful. Thanks!
Antworten

Zurück zu „English Sudden Strike Forum“