Post by keepitsimple on Jan 31, 2013 23:31:18 GMT 1
Using Trains in BK mapping is little documented. With this thread I want to share my knowlegde about using trains succesfully.
Hope it helps
KeepItSimple
1. Laying tracks.
Laying tracks is almost as simple as laying a road. There are however a few things you need take extra care with.
First, the "Width" should be put at 6.00.
Secondly, lay if possible one continues track (Tip from Ocelo mapping tutorial). Unlike roads, breaks in a track can case problems in passiblity.
You can make a split in the track. To make this work you must make sure that the first two points of your second track fall in the middle of you first track (this means that tip of the second track is in line with the first track, the second point must lay in the middle of the first track, the track itself is already breakaway from the first). Again continue with this second track till its end. (Tip Ocelo). To start, you must first lay your second track next to the first. If it is on the map then adjusted the first two points as described here above.
Bridges
Rail bridges are only passible if you have a continues track laying below it (Tip Ocelo). This works, but you have to make sure that they are inline. This is trail and error. I reconment strongly to test it. If found that there are three possible outcomes. One, the trains won't go across the bridge. This means adjusting the underlaying track, and try again. Second, a train will pass the bridge, this doesnt mean however, that all trains will pass. So test for all possible trains that need to pass the bridge. If the is one that doesn't pass, again a little adjustment is needed to the track. Finaly, all trains pass. SAVE IT.
2. Make trains
To make a train set, first select the various parts and place them in line with the track in the right order. Secondly, take the last wagon and move to forlast wagon. A white arrow will appear. You have made the right connection if you select the forlast wagon and it is linked to the last and if you select the last wagon it is not connected!. If you have this SAVE. Now repeat the proces with forlast wagon and connect to the one before. You have the right connection if the one befor will only move the forlast wagon and not the last and forlast only moves the last. Again save and move on till the first (in most cases the locomotive).
3. Moving trains with script.
You can make train move by script.
Give the locomotive a number (here 100) and you can send it to a piont on the track (script point) or have a small area on the track (name for instead "station")
Cmd(0,100, GetScriptAreaParams("station"));
I would recomment to test first as player if the train will move to given the given point. If so, it will as work with script.
4. Trains as reinforment
You can make a train a reinforment.
5. Tank and trucks on trains
HungaryBlitz made of this happen. Of course it's a illusion but it still looks good. This is the script to make it happen.
(This is my slight adjusted script form HungaryBlitz)
To start
There must be a reinforment group 100 with one tank numbered 100.
A second reinforment group 101 with one or two soldiers both numbered 101.
A third reinforment group 102 with one tank numbered 102.
A trainwagon with the tank numbered 103.
To board a tank (or truck) you have to do the following.
-- if the tank is in area "Tankstop" a soldier appears --
-- the soldier moves to the train (enters and the tank appears on the train) --
-- the parked tank is delete (split second after it came on the train)
To get tank(s) of the train.
6. Using armed trains
Hope it helps
KeepItSimple
1. Laying tracks.
Laying tracks is almost as simple as laying a road. There are however a few things you need take extra care with.
First, the "Width" should be put at 6.00.
Secondly, lay if possible one continues track (Tip from Ocelo mapping tutorial). Unlike roads, breaks in a track can case problems in passiblity.
You can make a split in the track. To make this work you must make sure that the first two points of your second track fall in the middle of you first track (this means that tip of the second track is in line with the first track, the second point must lay in the middle of the first track, the track itself is already breakaway from the first). Again continue with this second track till its end. (Tip Ocelo). To start, you must first lay your second track next to the first. If it is on the map then adjusted the first two points as described here above.
Bridges
Rail bridges are only passible if you have a continues track laying below it (Tip Ocelo). This works, but you have to make sure that they are inline. This is trail and error. I reconment strongly to test it. If found that there are three possible outcomes. One, the trains won't go across the bridge. This means adjusting the underlaying track, and try again. Second, a train will pass the bridge, this doesnt mean however, that all trains will pass. So test for all possible trains that need to pass the bridge. If the is one that doesn't pass, again a little adjustment is needed to the track. Finaly, all trains pass. SAVE IT.
2. Make trains
To make a train set, first select the various parts and place them in line with the track in the right order. Secondly, take the last wagon and move to forlast wagon. A white arrow will appear. You have made the right connection if you select the forlast wagon and it is linked to the last and if you select the last wagon it is not connected!. If you have this SAVE. Now repeat the proces with forlast wagon and connect to the one before. You have the right connection if the one befor will only move the forlast wagon and not the last and forlast only moves the last. Again save and move on till the first (in most cases the locomotive).
3. Moving trains with script.
You can make train move by script.
Give the locomotive a number (here 100) and you can send it to a piont on the track (script point) or have a small area on the track (name for instead "station")
Cmd(0,100, GetScriptAreaParams("station"));
I would recomment to test first as player if the train will move to given the given point. If so, it will as work with script.
4. Trains as reinforment
You can make a train a reinforment.
5. Tank and trucks on trains
HungaryBlitz made of this happen. Of course it's a illusion but it still looks good. This is the script to make it happen.
(This is my slight adjusted script form HungaryBlitz)
To start
There must be a reinforment group 100 with one tank numbered 100.
A second reinforment group 101 with one or two soldiers both numbered 101.
A third reinforment group 102 with one tank numbered 102.
A trainwagon with the tank numbered 103.
To board a tank (or truck) you have to do the following.
-- if the tank is in area "Tankstop" a soldier appears --
function ArriveTank()
local num= GetNScriptUnitsInArea(100, "Tankstop");
if num == 1 then
LandReinforcement(101);
RunScript("LoadTank",1000);
Suicide();
end;
end;
-- the soldier moves to the train (enters and the tank appears on the train) --
function LoadTank() -- New --
Cmd(4,101,103);
RunScript("DelTank",100);
Suicide();
end;
-- the parked tank is delete (split second after it came on the train)
function DelTank() -- New --
local num= GetUnitState(101);
if num ==3 then
DeleteReinforcement(100);
Suicide();
end;
end;
function UnloadTrain()
local num= GetNScriptUnitsInArea(103, "Station");
if num == 1 then
DeleteReinforcement(101);
LandReinforcement(102);
Suicide();
end;
end;
6. Using armed trains
This is a small script I maked to use a train with an armed wagon intelligently for AI.
-- The train is armed with a gun in wagon numbered 102.
-- The locomotive is number 100
-- The soldiers are in wagons 103,104
With ''displaytrace" you can easily findout the number of rounds the train gun has.
The train is send to move to the station and unload the soldiers. However if the gun fires, in other words the player is near the train, the gun will fire and the soldiers will disembark. If the gun isnt fired the train will go on to the station and the soldiers disembark.
-- The locomotive is number 100
-- The soldiers are in wagons 103,104
With ''displaytrace" you can easily findout the number of rounds the train gun has.
The train is send to move to the station and unload the soldiers. However if the gun fires, in other words the player is near the train, the gun will fire and the soldiers will disembark. If the gun isnt fired the train will go on to the station and the soldiers disembark.
function DriveTrain()
local ammo = GetNAmmo(102);
local trainstop = GetNScriptUnitsInArea(100, "station");
-- DisplayTrace("Get ammo %g is %g ", 102, ammo);
GiveCommand( 0, 100, GetScriptAreaParams("station"));
-- if the traingun fires the troops disembark
-- if the traingun fires the troops disembark
if (ammo <= 499) then
Cmd(5,103,GetObjCoord(103));
Cmd(5,104,GetObjCoord(104));
Suicide();
end;
if (trainstop == 1) then
Cmd(5,103,GetObjCoord(103));
Cmd(5,104,GetObjCoord(104));
Suicide();
end;
end;