OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

[Question] is there any way to make an animated function trigerred in route ?

Open adfriz opened this issue 2 years ago • 3 comments

Hello As title said.

I want to make a sort of the interior light is on when current car is in a tunnel, and off when passed the tunnel.

I already know how to write it if using pluginstates feature from bvec plugin, using simple on/off states.

The object is very simple long rectangle shape with a white glow transparent texture in it, so it feel like a bloom from bright object.

adfriz avatar Dec 27 '22 15:12 adfriz

Various ways of doing this, but they'd all rely on having the brightness set correctly in the routefile.

You've got the brightness[carIndex] animated variable, which wants a simple else-if to change the state when the brightness is below your preferred value. Day / night textures also work for this, but they blend between the two states, which may not be quite as good.

leezer3 avatar Dec 27 '22 18:12 leezer3

Is there other method like simply show/hide the object when in certain lenght?

I have an object a simple 1 face actually, containing a video for warn about door about to be open in gif format.

The animated file may looks like this: [Object] States = dooropen.b3d Statefunction = ????

In words let say my route is 500m in length from station A to station B, station A is the start station, station B at 400m. i place a trigger 100m before sta B and at stop position of sta B i also place a trigger, when train 100m remain from sta B show that object, but when train stop or passing stop position of sta B hide that object.

In my head there 2 may possible method

  1. Using some distance variable such as distanceStation[stationIndex]
  2. Using track.beacon or track.transpoder This may conflict if the train using safety system.

adfriz avatar Dec 28 '22 13:12 adfriz

You need to combine the distance to both the next and previous statins I would think.

Something like the following (off the top of my head, not massively tested):

if[distanceNextStation <= 500 || distancePreviousStation <= 500 , 1, 0]

This will return 1 if the distance to either the next or the previous station is below 500m, or in other words when you're within a 500m circle of any station :)

You could also start getting clever with the distanceStation[stationIndex] variable to show different videos on a per-station basis, but that isn't really reccomended, as it then ties the train to a specific route.

leezer3 avatar Jan 04 '23 18:01 leezer3