The International Simutrans Forum

 

Author Topic: Vehicle constraints  (Read 5330 times)

0 Members and 1 Guest are viewing this topic.

Offline Aquel

  • *
  • Posts: 314
  • Jai Ho!
Vehicle constraints
« on: February 18, 2010, 06:18:07 AM »
The latest addition: a 40ft container trailer. Double the size; double the goods....

Martin

Hello

I just finished a truck for simutrans I just would like to know how I can attach this trailer to my truck?
Thansk for the feedback.
Attached are the .png and .dat of the truck.

Cheers

Offline martin

  • Web Team
  • Devotees (Inactive)
  • *
  • Posts: 66
  • Languages: EN, NL, DE
Vehicle constraints
« Reply #1 on: February 20, 2010, 02:46:41 PM »
Hello Aquel,

First you need to download the trailer .pak file. It is inside the 40ft_container.zip file a few post before this one. Also png and dat file are included in the zip file. But you probably have downloaded it and found that out yourself.

Second, you need to edit your own Renault_Magnum_Sable.dat file to allow your truck to hook up with the trailer. Add the following line to the dat file:

Constraint[Next][n]=40ft_Container_Trailer


I took a look at the dat file in your post and add the line as shown:

Constraint[Next][0]=Renault_Magnum_Sable_Piece_Goods_Trailer_finished
Constraint[Next][1]=40ft_Container_Trailer
------------------------------------

Save the changes, recompile (using makeobj or pakbuilder, which you seem to be using to make pak files - from french board :-) ) the trucks .pak file using the edited .dat file.  Then copy the new truck .pak file and the trailer .pak file to your simutrans/pak128 folder and enjoy.

Offline Aquel

  • *
  • Posts: 314
  • Jai Ho!
Vehicle constraints
« Reply #2 on: March 07, 2010, 01:26:34 PM »
Hello Aquel,

First you need to download the trailer .pak file. It is inside the 40ft_container.zip file a few post before this one. Also png and dat file are included in the zip file. But you probably have downloaded it and found that out yourself.

Second, you need to edit your own Renault_Magnum_Sable.dat file to allow your truck to hook up with the trailer. Add the following line to the dat file:

Constraint[Next][n]=40ft_Container_Trailer


I took a look at the dat file in your post and add the line as shown:

Constraint[Next][0]=Renault_Magnum_Sable_Piece_Goods_Trailer_finished
Constraint[Next][1]=40ft_Container_Trailer
------------------------------------

Save the changes, recompile (using makeobj or pakbuilder, which you seem to be using to make pak files - from french board :-) ) the trucks .pak file using the edited .dat file.  Then copy the new truck .pak file and the trailer .pak file to your simutrans/pak128 folder and enjoy.

I will try and answer you as soon as possible but I don't think there should be any problems.
By the way another question... ;D
How do you make the light appear on the truck or buses during night time?
Coz I've tried all the color possible and it's not working.
When the night is falling I got nothing. :-[
Any help? ???


Edit 1:
Listen I just tried your trailer it's attaching no prblems but then graphically the result is quite strange.
One more things I cannot attach any more my trailer...
Any idea? ;D

Please find attach the *.png and *.dat of the vehicule and its trailer.
« Last Edit: March 07, 2010, 01:37:36 PM by Aquel »

Offline martin

  • Web Team
  • Devotees (Inactive)
  • *
  • Posts: 66
  • Languages: EN, NL, DE
Vehicle constraints
« Reply #3 on: March 09, 2010, 08:25:52 PM »
First lights during nighttime. You have to use one of the special colors to make this work. Look here for all special colors:  http://graphics.simutrans.com/albums/userpics/10003/simucolors.png. Use "yellow light" R255,G255,B83 (hex: FFFF53) for headlights and "red light" R255,G33,B29 (hex: FF211D) for taillights.

Now let me try to explain how constraints work. Constraints in simutrans can be used in a few ways:

1. To keep a specific setup of vehicles. This is mostly used for multiple unit passengertrains (EMU's or DMU's).
Part A of the train is always followed by part B and then C     [__A__]-[__B__]-[__C__]     
Constraints in .dat file for A:
Constraint[prev][0]=none
Constraint[next][0]=B

Constraints in .dat file for B:
Constraint[prev][0]=A
Constraint[next][0]=C

Constraints in .dat file for C:
Constraint[prev][0]=B
Constraint[next][0]=none

2. To limit the number of trailers that may be put behind to a truck (also works for waggons/engines)
eq: [Truck]-[TrailerA]  or  [Truck]-[TrailerB]  or  [Truck]-[TrailerC]
Constraints go into .dat file for the truck:
Constraint[prev][0]=none
Constraint[next][0]=TrailerA
Constraint[next][1]=TrailerB
Constraint[next][2]=TrailerC

3. To limit the number of trucks that may be put in front of a trailer (also works for engines/waggons)
eq: [TruckA]-[Trailer]  or  [TruckB]-[Trailer]  or  [TruckC]-[Trailer]
Constraints go into .dat file for the trailer:
Constraint[prev][0]=TruckA
Constraint[prev][1]=TruckB
Constraint[prev][2]=TruckC
Constraint[next][0]=none

In your .dat form  you make use of the second type. In official pak128 the third type is used for trucks-trailers.

Another thing that is critical in constraints is the name you specify after Constraint[xxxx][y]=  It has to be exactly the same as the Name= statement in the dat file for the referenced vehicle. This the problem in your dat file why you can't attach your trailer anymore.

The following example is for type 2:
.dat file for Truck_A:
Name=Truck_A
Constraint[next][0]=Trailer_B
Constraint[next][1]=Trailer_C

.dat file for Trailer_B:
Name=Trailer_B

.dat file for Trailer_C:
Name=Trailer_C

Please try not to use spaces in vehicle names. Use underscores _ instead.

@ADMINS/MODS: Can one of you guys split this topic and move this to Help Requests... Thnx Martin

Offline Aquel

  • *
  • Posts: 314
  • Jai Ho!
Re: Vehicle constraints
« Reply #4 on: March 11, 2010, 07:54:26 PM »
@Martin:

Thanks for the explaination.
I have been starting to implement it, but it is almost 1H30 in the morning and tom work start at 6am...
So better go to bed! ;D
I'll tell you tom how it ended.

Thanks again for the feedback!
Have a good night! ;)


Hello

The problem is not there!
Seems I can't create my tractor vehicle since I took of the trailer from the *.dat... ;D
Any help? ;D
It's getting off topic please go to this one if you have an answer: http://forum.simutrans.com/index.php?topic=4382.msg46059#msg46059
Please find the *.dat attached.
Many thanks in advance.

« Last Edit: March 13, 2010, 07:08:12 PM by Aquel »