Freezing the vehicle during countdown

Freezing the vehicle during countdown

From BeamNG

While your scenario introduction sequence is being shown, and while the countdown is taking place, you usually want to prevet the user from manipulating the vehicle in any way. This avoids unfair advantages when the scenario finally starts.

Default behaviour

By default, the user's vehicle drivetrain will be automatically manipulated, to prevent the vehicle from advancing forward or backwards, even if the player is using the throttle and brake controls. However, most other actions are still possible by default.


Custom behaviour

Starting at v0.7.0.0, it is possible to specify a list of vehicle functions that you want to ignore during this scenario start-up procedure.

A different list can be defined for each vehicle in your scenario json file. For example:

[...]
    "vehicles": {
        "scenario_player0": {
            "extensions": {
                "functionFreezer": [
                    "custom_input.fire",
                    "custom_input.liftBarrel"
                ]
            }
[...]

In this example, "custom_input.fire" and "custom_input.liftBarrel" are two functions located in the file cannon/lua/custom_input.lua, and they manage the firing of ball and the barrel movement respectively.


All functions listed under "functionFreezer" will have absolutely no effect during the introduction phase and during the countdown timer.

Once the scenario starts, the functions will start working normally, so the user will be able to use them.