Cities: Skylines

Cities: Skylines

Vehicle Effects 1.9.5
 This topic has been pinned, so it's probably important
Acc3ss Violation  [developer] 16 Oct, 2016 @ 6:12am
How to create config files
This mod requires config files. This page will show how to do this.

The file
  • The file has to be called VehicleEffectsDefinition.xml and it should be placed in any folder the game loads assets from. (e.g. the Assets folder or any workshop asset item folder)
  • For testing just put it in your Assets folder.
  • When uploading to the workshop, make sure you don't forget to include it! (Place it in the Content folder together with the .crp)

Note: instead of creating a file manually you can also use the UI in the asset editor:
Open the vehicle and click the Vehicle Effects button in the lower right corner to open the effect editor.

You still need to put the generated xml in the correct folder. See the "The file" section above for where exactly that is.

I recommend doing this with the sunscribed workshop item so the names in the generated file are correct. Otherwise you'll have to go in and correct the vehicle names before uploading. See the section below for vehicle naming.


Update 11-12-16:
It is now possible to create a pack with definitions for multiple vehicles by including it in a mod. Check the Github page[github.com] for an example (below the plugins part).
Just put the VehicleEffectsDefinition.xml in the mod folder and make sure the mod is enabled in the content manager. If a definition included in a mod references a vehicle that is not loaded the warning is ignored. The options menu allows you to change this setting.

An example file:
<?xml version="1.0" encoding="utf-8"?> <VehicleEffectsDefinition> <Vehicles> <Vehicle name="NS 2200 Passenger Train"> <Effects> <Effect name="Train Movement" replacement="Diesel Train Movement"> </Effect> <Effect name="Vehicle Effect Wrapper" base="Snowplow Light 2"> <Position x="0" y="0" z="6.3" /> <Direction x="0" y="0" z="1" /> <MinSpeed>0</MinSpeed> <MaxSpeed>12</MaxSpeed> </Effect> </Effects> </Vehicle> </Vehicles> </VehicleEffectsDefinition>

The vehicle definition
This defines what vehicle the effect will be added to. Just provide the asset name.
<Vehicle name="NS 2200 Passenger Train">
For workshop items (especially trailers) it is necessary to include the workshop id in the title like so:
<Vehicle name="777145927.Trailer0">
In case you want to add a set of effects to all trailers of a certain vehicle you can use the following:
<Vehicle name="NS 2200 Passenger Train" applyToTrailersOnly="true">
A vehicle entry with applyToTrailersOnly will apply all effects to all trailers of the vehicle with that name, but not to the vehicle itself. It can be used to replace sounds on all train wagons for example.


Replacing effects:
name is the name of the existing effect to be replaced, replacement is the name of the effect to replace it with.
The Diesel Train Movement effect is part of this mod, it uses the sound of a diesel engine instead of the default.

<Effect name="Train Movement" replacement="Diesel Train Movement"></Effect>

Adding effects:
If 'replacement' isn't specified an effect with the name 'name' will be added.
Here it's a Vehicle Effect Wrapper, which allows another effect to be used as a 'base' that gets positioned at a given offset, in this case the rotating light used on the snowplow from Snowfall. (Snowplow Light 2)
The wrapper is needed for any effect that you want to give a position or rotation to.

<Effect name="Vehicle Effect Wrapper" base="Snowplow Light 2">
Position and direction for a Vehicle Effect Wrapper. Not specifying these means 0,0,0 is used.
<Position x="0" y="0" z="6.3" /> <Direction x="0" y="0" z="1" />
Optional. Maximum and minimum speed in km/h the effect will show at. Defaults are 0 and 10000.
<MinSpeed>0</MinSpeed> <MaxSpeed>12</MaxSpeed> </Effect>

Removing effects
You might want to remove an effect that's already present on the vehicle. You can do this the same way as replacing an effect, just set replacement to 'Remove'. (Older versions used 'None' instead)

<Effect name="Train Light Passenger" replacement="Remove"></Effect>

Fallbacks
You might want to specify a fallback for an add or replace in case the needed effect is not present. Do this by simply adding the 'fallback' attribute with the name of the fallback effect.

<Effect name="Train Light Passenger" replacement="Some Replacement" fallback="Train Light Left"></Effect>

This would try to replace Train Light Passenger with Some Replacement. If that's not loaded then it will be replaced with Train Light Left instead.

Note: You can only specify a single fallback, so if the fallback can't be found either an error will show up. To avoid this, make sure that you only use default effects or effects included in this mod as a fallback!

You can also use None and Remove as fallbacks. None will simply do nothing (no errors either) if the effect can't be found (useful for optional or DLC bound effects) and Remove removes the original effect. Remove can only be used on replacements.

<Effect name="Snowplow Light 2" fallback="None"></Effect>

Flags
The game uses flags to indicate the state of a vehicle. Effects on vehicles can also set required and forbidden flags that determine when they are active. If all of the effect's required flags are set on the vehicle and none of the forbidden flags are, it's active.

In a config file the flags can be set as follows:
<Effect name="Some Effect"> <RequiredFlags>Arriving</RequiredFlags> <ForbiddenFlags>Underground</ForbiddenFlags> </Effect>
This would mean the effect is active when the vehicle is Arriving, as long as it's not Underground.

If no flags are given in the config file, the effect will always be active.

For more info about flags, check this discussion page.

Multi effects

Definition for a custom multi effect. Multi effects can be used to combine multiple effects, with the added bonus of being able to set a start and end time for each sub effect. You can use it to make a looping timeline of effects, like the alternating emergency lights on police cars.

Requirements Multi Effect
  • A custom multi effect is called Vehicle Effect Multi.
  • Duration tag with the duration in seconds. (defaults to 0)
  • List of SubEffects.

Requirements SubEffect
  • StartTime tag with start time in seconds. (defaults to 0)
  • EndTime tag with end time in seconds. (defaults to 0)
  • Effect tag with the actual effect. This is the same as normal effect tags except it may not use a Vehicle Effect Multi or replacement.

<Effect name="Vehicle Effect Multi"> <MaxSpeed>45</MaxSpeed> <Duration>1</Duration> <ForbiddenFlags>Reversed Inverted</ForbiddenFlags> <SubEffects> <SubEffect> <StartTime>0</StartTime> <EndTime>1</EndTime> <Effect name="Train Bell"></Effect> </SubEffect> <SubEffect> <StartTime>0</StartTime> <EndTime>0.5</EndTime> <Effect name="Vehicle Effect Wrapper" base="Train Ditch Light"> <Position x="-0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> <SubEffect> <StartTime>0.5</StartTime> <EndTime>1</EndTime> <Effect name="Vehicle Effect Wrapper" base="Train Ditch Light"> <Position x="0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> </SubEffects> </Effect>

This is an example that's using several multi effects to create alternating ditch lights on a train below a certain speed. At night both lights are on above that speed. (Large Car Light Right2 is used for that. Train Ditch Light is a new effect that looks the same but is visible during the day as well)

<Vehicle name="BNSF Short Passenger"> <Effects> <Effect name="Train Movement" replacement="Diesel Train Movement"> </Effect> <Effect name="Vehicle Effect Wrapper" base="Diesel Smoke"> <Position x="0" y="4.07" z="1.76"/> <Direction x="0" y="1" z="0"/> </Effect> <Effect name="Vehicle Effect Wrapper" base="Train Horn"> <MaxSpeed>28</MaxSpeed> <RequiredFlags>Leaving</RequiredFlags> </Effect> <Effect name="Train Light Passenger" replacement="None"> </Effect> <Effect name="Vehicle Effect Multi"> <MaxSpeed>45</MaxSpeed> <Duration>1</Duration> <ForbiddenFlags>Reversed Inverted</ForbiddenFlags> <SubEffects> <SubEffect> <StartTime>0</StartTime> <EndTime>1</EndTime> <Effect name="Train Bell"></Effect> </SubEffect> <SubEffect> <StartTime>0</StartTime> <EndTime>0.5</EndTime> <Effect name="Vehicle Effect Wrapper" base="Train Ditch Light"> <Position x="-0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> <SubEffect> <StartTime>0.5</StartTime> <EndTime>1</EndTime> <Effect name="Vehicle Effect Wrapper" base="Train Ditch Light"> <Position x="0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> </SubEffects> </Effect> <!-- Lights are fully on at night when not alternating (above a certain speed) --> <Effect name="Vehicle Effect Multi"> <MinSpeed>45</MinSpeed> <ForbiddenFlags>Reversed Inverted</ForbiddenFlags> <SubEffects> <SubEffect> <Effect name="Vehicle Effect Wrapper" base="Large Car Light Right2"> <Position x="-0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> <SubEffect> <Effect name="Vehicle Effect Wrapper" base="Large Car Light Right2"> <Position x="0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> </SubEffects> </Effect> <!-- Fix for inversed rear engines --> <Effect name="Vehicle Effect Multi"> <Duration>1</Duration> <MaxSpeed>45</MaxSpeed> <RequiredFlags>Reversed Inverted</RequiredFlags> <SubEffects> <SubEffect> <StartTime>0</StartTime> <EndTime>1</EndTime> <Effect name="Train Bell"></Effect> </SubEffect> <SubEffect> <StartTime>0</StartTime> <EndTime>0.5</EndTime> <Effect name="Vehicle Effect Wrapper" base="Train Ditch Light"> <Position x="-0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> <SubEffect> <StartTime>0.5</StartTime> <EndTime>1</EndTime> <Effect name="Vehicle Effect Wrapper" base="Train Ditch Light"> <Position x="0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> </SubEffects> </Effect> <!-- Lights are fully on at night when not alternating (above a certain speed) --> <Effect name="Vehicle Effect Multi"> <MinSpeed>45</MinSpeed> <RequiredFlags>Reversed Inverted</RequiredFlags> <SubEffects> <SubEffect> <Effect name="Vehicle Effect Wrapper" base="Large Car Light Right2"> <Position x="-0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> <SubEffect> <Effect name="Vehicle Effect Wrapper" base="Large Car Light Right2"> <Position x="0.74" y="1.6" z="0" /> <Direction x="0" y="0" z="1" /> </Effect> </SubEffect> </SubEffects> </Effect> </Effects> </Vehicle>
Last edited by Acc3ss Violation; 21 Feb, 2017 @ 1:39am