All-Aircraft-Simulations

Full Version: Canvas Knights Mission and Script Building Using the CKMMV
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

RAF209_Benge

Canvas Knights Mission and Script Building Using the CK_Mod_Mission_Vehicle.exe = CKMMV
This tutorial is for the full paid CK game only.

To build missions for Canvas Knights requires three items:
First you need CK_Mod_Mission_Vehicle.exe (CKMMV).
Second you need Note or Word Pad
Third patience and imagination
I.…Initial Setup
Open the CK_Mod_Mission_Vehicle.exe. This you should already have installed into your Canvas Knights Folder.
[Image: MainScreen.jpg]
II. Mission Building
A. Click the Free Flight Tab . All mission building is done in Free Flight Mode.
[Image: FreeFlightTab.jpg]
B. Select a WW 1 aircraft select and an airstrip and hit the start button
[Image: FreeFlightPage.jpg]
C. Once you are on the runway click the V key to open the vehicles box and begin selecting the aircraft you want for your mission. I would recommend you select the side you intend to fly with first plus one extra.
[Image: VehicleBox.jpg]
[Image: VehicleSelector.jpg]
D. Move the extra plane to an enemy base by opening the map using the M key to open the box.
1. Move your cursor to the designated base you wish the planes to spawn click so that the cross hairs are on that base.
2. Then click the tab called {go to}
[Image: MapSelector.jpg]
3. The follow step D as to vehicle selection.
4. Remove the plane you moved to the other side or select another plane and it will replace the other plane.
5. At this time you can zoom in on the runway and move the planes around using the go to button, this is pretty much a must to keep AI planes from crashing into each other on takeoff.
E. Once you have the plane sets created now it is time to move on to the waypoints. Note: All planes will fly to the same way points. As per the scripts that come with the game. I will later explain how to create or alter scripts. Most of the scripts in the stock game are two or three waypoints.
1. Click open the Map screen again
2. Move your cross hairs to where you wish the first waypoint to be then click the tab called {add}.
3. Repeat for at least two more waypoints.
4. All bombing scripts have the c waypoint as the attack waypoint.
[Image: WaypointSelection.jpg]
F. Once you have all the plane sets and waypoints built exit the game.
G. Open Windows Explorer find the Canvas Knights Game
G. Go to the situations folder find the mission called Last Mission rename the mission.
H. Script and skins input.
1. Open up the situation you renamed in a a Wordpad or Notepad
2. Scroll down to the vehicles, decide which one you are going to pilot. This one you will not put in a AI script for. However you can then select a skin you wish the vehicle to use.
Ex:
a) You select a Fokker Dr 1
This is how the script will initially look

Fokker_DR1

-78.203743 [east]
21.374146 [north]
46.767914 [alt]
0.269232 [gama]
2.57554 [beta]
0.00203076 [phi]
-0.738567 [velocity]
0 [omega]
0 [rpm_act]
11520 [fuel_left]
0 [null]
0 [null]
0 [null]
1 [control_rpm]
1 [control_pitch]
1 [control_mixture]
0 [trim_angle]
547.238 [auto_alt]
2.57 [auto_beta]
7 [pilot_flags]
0 [brakes_on]
0 [engine_on]
1 [gear_down]
0 [pilot_on]
0 [light_on]
0 [flaps_stage]
0 [abrakes_stage]
0 [next_waypoint]
0 [current_weapon]
1 [replay_pos]

b) Once you have selected the skin you will type it into the vehicle line and it will look like this
For Ex: If you want to fly as the Red Baron (Manfred Von Richtofen) you would input the following after the airplane.

You can find the proper skin names for your vehicles in the vehicles folders under skins in the particular vehichle you are interested in. In this case Fokker_DR1

Fokker_DR1#Manfred Von Richthofen

-78.203743 [east]
21.374146 [north]
46.767914 [alt]
0.269232 [gama]
2.57554 [beta]
0.00203076 [phi]
-0.738567 [velocity]
0 [omega]
0 [rpm_act]
11520 [fuel_left]
0 [null]
0 [null]
0 [null]
1 [control_rpm]
1 [control_pitch]
1 [control_mixture]
0 [trim_angle]
547.238 [auto_alt]
2.57 [auto_beta]
7 [pilot_flags]
0 [brakes_on]
0 [engine_on]
1 [gear_down]
0 [pilot_on]
0 [light_on]
0 [flaps_stage]
0 [abrakes_stage]
0 [next_waypoint]
0 [current_weapon]
0 [replay_pos]

c) Next scroll down to [my_index] & [in_cockpit]. Make sure to put which plane you are using from the order they appear in the script to signify which plane you will be piloting.

For ex.: If you your plane is the number 2 plane listed it will look this way

2 [my_index]
1 [in_cockpit]

d) The [in_cockpit] needs to be the number 1 if it is zero { 0 } it will be outside the cockpit.
e) Once you have completed these steps your plane for said mission is ready to go. It is best after completing the steps in CKMMV to return to the aircraft you intend to pilot. This way the last steps c-d will not need to be done.
3. Setting up the AI planes
In this phase you will have to input the scripts (instructions for the AI vehicles) and the skins.
a. Start from the top and work your way down.
Our example will be another Fokker Dr. 1
Fokker_DR1
b. Select the skin for the plane as you did for your plane…in this case you choose Johann Janzen. In the skins folder it entitled Johann Janzen And will look like this when written into the situation. Fokker_DR1#Johann Janzen
c. Next you will choose the script.. Open up the scripts folder, there you will see a list of scripts that the vehicles can do. The name of the script give a brief description of what it will do.
For ex. Lofightertakeoff01, this script signifies that the plane will fly lower than 3500 ft during normal flight. It also means it will take off from an airstrip, and that it will immediately start when the mission is loaded.
Another script such as: asfighterpatrolmid02 siginifes this is an air start script, fighter patrol, and mid air around 3000 to 4000 m. For this mission we will use lofightertakeoff01.
d. When you write in the script it will look like this.
Fokker_DR1#Johann Janzen
Lofightertakeoff01.txt (Do not forget to put in the .txt without it the vehicle will not operate.)
e. Repeat step d for all the remaining vehicles then save the mission.
f. Save the mission and place it in the situations folder.
I. Testing Mission.
Test out the mission using the CKMMV, this way you can jump from vehicle to vehicle to see how they are behaving. Make sure you assign a script to your vehicle as well. This can be done via the Vehicles screen by clicking the V key.
1. Click on the Vehicles Tab and select your plane then click Adjust.
[Image: MSBUILDI.jpg]

2. The click Show Scripts and select a script; such as lofightertakeoff02 and let your plane fly.
3. Use the Vehicles interface to switch between vehicles. This is also a good way to take screen shots so that you can make a nice one to go along with your mission.
[Image: MSBUILDJ.jpg]
[Image: MSBUILDK.jpg]
4. Give the screen shot you choose the same name as the mission
J. Putting the Mission into Canvas Knights.
Once you have finished your mission and tested copy the mission to the situations folder and place it in either the axis (central powers) or allied folder also place the picture in this same file.
III. Script Building.
This is one of the exciting dynamics of this simulation. Through script building you will be able to influence the behavior of the AI vehicles. From how altitudes of aircraft to depths at which submarines will patrol. You will also be able to determine whether a vehicle repairs and spawns repeated and when it will or if it will attack others.
Lets look at a script. You can do this by opening up the scripts folder in either the CK.exe or CKMMV.exe . I would recommend you use the CKMMV.exe to experiment.
Lets look at the script lofightertakeoff01.txt as you scroll down the text you will notice all of the instructions given to the airplane.
engine off {Engines off at beginning of game}
until time 0.01 {length of time that passes before start}
stay
done
takeoff
engage all air range 2 fire 0.5 {plane is set to engage targets immediately after takeoff at a range of 2 miles from the base}
fly waypoint a
engage all air range 2 fire 0.5 {engage all enemy air targets at waypoint A}
until altitude 3500 {Alt up to 3500 m}
fly altitude 3500 {cruise at at 3500 m}
fly waypoint b
engage all air range 2 fire 0.5
until altitude 3500
fly altitude 3500
done
engage all air range 2 fire 0.5
fly waypoint c
engage all air range 2 fire 0.5
until altitude 2000
fly altitude 2000
done
engage all air range 2 fire 0.5
fly waypoint d
engage all air range 2 fire 0.5
until altitude 3500
fly altitude 3500
done
fly origin {return home}
land
repair
restart

Remember all altitudes and depths are in meters, if you try to air start your plane too high it will not start as there is not enough oxygen to fire the engine.
You can even create scripts for specific missions and do waypoints in such away where not all the vehicles will intersect at the same point. This requires some planning and a higher degree of skill and practice.
When creating start times it is best to add .04 to each start time for each new script on aircraft, in this way the planes will not run into each other on takeoff.
If you want a plane or other vehicle to respawn following its death or return home, make sure you give the script the commands
repair and restart
Once you write the script…make sure to give it a name that makes it easily identifiable. I like to give mine names that allow me to remember what it does.
For example grounndattackmissiontakeoff01
That tells me it’s a ground attack mission for the low attack planes such as the Bristol Fighter, the WB29, the Hannover, and the Avro 504L.
Remember in all that you do as far as the script building, have fun and if you feel like pulling your hair out or beating your keyboard to pieces its time to get up and take a break..
Ground vehicle Missions..
Remember all aircraft missions use a-d for waypoints, ground vehicles use different way points depending on their function.
Tanks use waypoints e-g
Automobiles, trucks, and motorcycles use waypoints h-j
Also there is a limit to how many vehicles you should put into a mission, the longer and more complex the mission the greater the load time for missions as well as a greater chance for glitches and crashes.
It is best to keep the number vehicles to around 12 to 14 at most.

------------------------------------------------------------------------------------------------------


This document details the use and syntax of the scripting language.

The scripting language is used for controlling vehicles only and is loaded
through the scripts dialog inside the program, scripts names are saved and
loaded in the situation files, but the scripts themselves are kept insdie
the scripts directory.

It is designed to be very simple and high level, close as possible to natural english.

It is not structural and not object oriented in any way.
The language controls a state machine in which some states can be turned
on or off and all commands are executed in the order they appear.

Some commands have immediate effect, while others execute until some
conditions are met, these conditions are set and reset by the script.

All scripts commands must be in lower case, commands may be entered
one command per line, or multiple commands per line, when the syntax of
one token is not identified the program tries to read the next token and
construct a meaningful script.


The language Syntax
===================

1) Comments:
============

Comments may be added once per line, each line which contains
double slash is marked as a comment and not interpreted.

Example:

// This is a comment

2) State commands
==================

2.1 engage

This command tuns on engagement mode which is active inside the
fly, go, turn, stay, commands.

Engagement causes the vehicle to fly or go in the direction of the
engaged target, and shoot when the range is smaller than the engagement range.

The choice of weapon to use depends upon the range from the target, when smaller
than 1000 meters - cannon will be used, when larger a guided weapon is used.

Syntax:

engage [who] [where] range [max] fire [min]

[who] - who to engage : all, me
[where] - where to engage : land, sea, air, all
[max] - range in nm to engage target
[min] - range in nm to shoot target

Example:

engage all air range 10 fire 3

2.2 disengage

This command turn off engagement mode.

Example:

disengage

2.3 until

This command turns on one or more limit checks on which to terminate the fly, go, turn
stay, commands, until commands can be repeated to turn on multiple check types.

Syntax:

until [type] [size]

[type] - type of check to activate :
distance - stops when segment distance is greater than [size] in nm.
time - stops when segment time is greater than [size] in minutes.
altitude - stops when altitude is greater than [size] in ft.
kills - stops when number of targets killed is greater than [size]
fuel - stops when fuel is less than [size] in decimal fraction.

2.4 done

This command clears all until check modes.

2.5 verbal

This commands turns on/off verbal reports by vehicle running script, when
speech is enabled this also speaks the verbal messages.

Syntax:

verbal [on]

[on] - activates the verbal mode : on, off

Example:

verbal on

3) Mode commands
================

3.1 fly / go

This command flies or goes to a direction or position, engages other vehicles,
and stops when this position is readed or one of the until conditions is met.

Syntax:

fly [type] [size] [altitude] [alt]

[type] - type of flight: heading, position, waypoint, origin, airport, ahead
[alt] - altitude in which to fly in ft

Example:

fly heading 260 altitude 2000
fly waypoint a
fly origin
fly position 32.45 35.45
fly airport altitude 1000
fly ahead

3.2 turn

This commands instructs the vehicle to turn to either side, engages other vehicles,
until a condition is met.

Syntax:

turn [side]

[side] - side to turn : left, right

Example:

turn left

3.3 stay

This command stops the vehicle in place, engages other vehicles,
until a condition is met.

Example:

stay

3.4 takeoff

This commands makes the vehicle take off flying straight ahead untill a hight of
500 ft above ground level is reached.

Example:

takeoff

3.5 land

This command lands the vehicle at the nearest runway or at the origin point,
makes a landing circuit and touches down perfectly.

Example:

land

4) Immediate commands
=====================

4.1 bomb

This command instructs the vehicle to bomb the current position,
when this command follows immediately after fly command the vehicle
will bomb the target of the fly command, and fly to CCIP ( continuous
compound impact point ) position.

Syntax:

bomb [count]

[count] - number of bombs to drop.

Example:

fly waypoint a
bomb 2

4.2 refuel

This command refuels the vehicle.

Example:

refuel

4.3 break

This command explodes and brakes the vehicle.

Example:

break

4.4 repair

This command repairs the vehicle.

Example:

repair

4.5 eject

This command ejects the pilot from the vehicle.

Example:

eject

4.6 lights

This command turns the lights of the vehicle on or off.

Syntax:

lights [on]

[on] - state of lights : on, off

4.6 engine

This command turns the engine of the vehicle on or off.

Syntax:

engine [on]

[on] - state of engine : on, off

4.7 horn

This command sounds the horn of the vehicle.

Example:

horn

4.8 print

This command prints and speaks a short message.

Syntax:

print [message]

[message] - a short text message.

Example:

print unknown vehicle please turn back

4.9 restart

This command restarts the scrip, or goes back to the start.

Example:

restart