Road Vehicles - change wagon length?
Moderator: Graphics Moderators
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Road Vehicles - change wagon length?
I would like to reduce the lengths of some road vehicles to improve the appearance of articulated vehicles.
Can I use the wagon length callback (11) to fix situations such as displayed by the screenshots below? cheers,
Andy
Can I use the wagon length callback (11) to fix situations such as displayed by the screenshots below? cheers,
Andy
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: Road Vehicles - change wagon length?
Yes, should be possible.andythenorth wrote:I would like to reduce the lengths of some road vehicles [...] Can I use the wagon length callback (11) [?]
regards
Michael
Re: Road Vehicles - change wagon length?
Here's what I use for trams. For road vehicles it's basically the same except for the vehicle flag in the action 0. Please see file attached below.
- Attachments
-
- shortervehicle.txt
- (2.98 KiB) Downloaded 81 times
Re: Road Vehicles - change wagon length?
Code: Select all
action1
action2 cID A0
-1 * 0 02 01 A1 81 0C 00 FF 01 // callback, 1 case
02 80 11 11 // 02 shorter in CB11
A0 00 // Default cID
action3
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Road Vehicles - change wagon length?
Yes, makes sense, I haven't tried it yet, but I follow the logic ok.DJ Nekkid wrote:[
that made sense?
cheers,
Andy
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: Road Vehicles - change wagon length?
hehe, callbacks are a b**** to understand, until you suddenly get an "eureka" ... then you understand most of them 

- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Road Vehicles - change wagon length?
EDIT: Nothing to see here, the behaviour described below doesn't persist through a save / reload of a game. I'm not looking for any answers - but I've left the post intact in case anyone searches for a similar issue in future.
--
Nothing says 'Christmas day' like a varaction 2 chain right?
I have some RV code (below) which is 'correct' but should not provide what I understand to be the varaction 2 / action 2 chain that I need, but does gives me the result I need.
My intention is to reduce vehicle length by the same amount for all cargos. This code appears to provide my intended wagon length irrespective of which cargo the vehicle is refitted to. As I read it though, cargo ID AA for the cargoes should not be used (for cargos where an ID is defined), so callback 11 shouldn't be getting handled (which would leave vehicle length unchanged).
Quirk, or expected behaviour? If this is reliable it means I don't have to construct the 31 different varaction 2s I thought I'd need to set vehicle length.
If it's not reliable, obviously I'll sack it in favour of the correct method.
(I wondered if the default cargo ID always used at some point in the process of building the vehicle?)
cheers,
Andy

--
Nothing says 'Christmas day' like a varaction 2 chain right?
I have some RV code (below) which is 'correct' but should not provide what I understand to be the varaction 2 / action 2 chain that I need, but does gives me the result I need.
My intention is to reduce vehicle length by the same amount for all cargos. This code appears to provide my intended wagon length irrespective of which cargo the vehicle is refitted to. As I read it though, cargo ID AA for the cargoes should not be used (for cargos where an ID is defined), so callback 11 shouldn't be getting handled (which would leave vehicle length unchanged).

Quirk, or expected behaviour? If this is reliable it means I don't have to construct the 31 different varaction 2s I thought I'd need to set vehicle length.

(I wondered if the default cargo ID always used at some point in the process of building the vehicle?)
cheers,
Andy
Code: Select all
[...many regular action 2s with IDs 00 - 17]
362 * 14 02 01 AA // handle callbacks
81 0C 00 FF // check variable 0C
01 // range
04 80 11 11 // vehicle length callback
02 00
363 * 106 03 01 01 00 // Action 3
20 // Number of different cargo types to support
00 00 00 //
01 01 00
02 02 00
03 03 00
04 04 00
05 05 00
06 06 00
07 07 00
08 08 00
09 09 00
0A 0A 00
0B 0B 00
0C 0C 00
0D 0C 00
0E 0E 00
0F 03 00
10 03 00
11 11 00
12 05 00
13 13 00
14 05 00
15 15 00
16 03 00
17 17 00
18 18 00
19 03 00
1A 1A 00
1B 06 00
1C 0A 00
1D 06 00
1E 07 00
1F 0A 00
AA 00 // default
Last edited by andythenorth on 25 Dec 2008 14:01, edited 1 time in total.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: Road Vehicles - change wagon length?
then you either need 17 lines of "shorter" code, or make the vehicle itself shorter in the action0, and then just make the "lead vehicle" longer? 
if you use "shorter code" on each attached vehicle, you can reuse it's cID to make it easier.

if you use "shorter code" on each attached vehicle, you can reuse it's cID to make it easier.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Road Vehicles - change wagon length?
Ach, nice idea, but RVs don't support prop 21 in an action 0. I tried it anyway, but unsurprisingly, and with it's usual beautiful accuracy nfo-renum was unhappy with it - rightly so because OpenTTD crashed when I tested the grfDJ Nekkid wrote:then you either need 17 lines of "shorter" code, or make the vehicle itself shorter in the action0, and then just make the "lead vehicle" longer?

Possibly there is a property that can be set for RV length, but if so I missed it in the documentation.

In this case, I need to provide a livery refit cycle for each cargo anyway, so I'll be writing varaction 2s to deal with the callback for that. It's only one line extra per varaction 2 to set the vehicle length.
cheers,
Andy
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: Road Vehicles - change wagon length?
When i checked the documentation did it seem like there is no "built in" support for shorter vehicles as you stated, so i'd just use the code i suggested first.
Code: Select all
a number of Action 1's
-1 * 0 02 01 <1st cid> 01 \w<from action1> \w<from action1>
-1 * 0 02 01 <1st cid> 81 0C 00 FF 01 04 80 11 11 <1st id>
-1 * 0 02 01 <2nd cid> 01 \w<from action1> \w<from action1>
-1 * 0 02 01 <2nd cid> 81 0C 00 FF 01 04 80 11 11 <2nd id>
-1 * 0 02 01 <3rd cid> 01 \w<from action1> \w<from action1>
-1 * 0 02 01 <3rd cid> 81 0C 00 FF 01 04 80 11 11 <3rd id>
etc
that phat action3
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Road Vehicles - change wagon length?
Well thanks DJ, but I found another way.DJ Nekkid wrote:When i checked the documentation did it seem like there is no "built in" support for shorter vehicles as you stated, so i'd just use the code i suggested first.

I hope that using var 47 will also make it easier to:
- check classes in future for compatibility with industry sets
- use different graphics according to capacity (these trailers will increase capacity over time)
cheers,
Andy
Code: Select all
[...action 0...]
[...some text strings...]
[...real sprites...]
[...regular action 2s...]
643 * 18 02 01 CE // choose sled sprites according to cargo
81 47 00 FF // var 47 in format ccccwwtt where I want tt
02 // range
21 00 01 01 //
26 00 06 06 //
// lots more cargos to add here...
25 00 // default
644 * 18 02 01 CD // choose wheeled trailer sprites according to cargo
81 47 00 FF // var 47 in format ccccwwtt where I want tt
02 // range
01 00 01 01 //
06 00 06 06 //
// lots more cargos to add here
05 00 // default
645 * 18 02 01 CC // set refit text strings
81 F2 00 FF //
02 // range
00 80 00 00
01 80 01 01
FF 80 // end callback chain
646 * 18 02 01 CB // choose sprites according to refit
81 F2 00 FF //
02 // range
CD 00 00 00 // wheeled trailers
CE 00 01 01 // sleds
05 00 // default
647 * 18 02 01 C0 // handle callbacks
81 0C 00 FF //
02 // range
04 80 11 11 // vehicle length CB
CC 00 19 19 // text suffix CB
CB 00 // graphics
648 * 49 03 01 01 08 // Action 3
00 // Number of different cargo types to support (!! reminder: use hex)
C0 00 // default
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 13 guests