How to change forcefield strength?

Discussion in 'Programming' started by mrwallace888, Feb 19, 2025.

  1. mrwallace888

    mrwallace888
    Expand Collapse

    Joined:
    Jun 17, 2015
    Messages:
    534
    I came across this video testing the limits of the forcefield feature (which is really fun to mess with haha), and in the video he changed a value to increase its strength, but I don't know what file the value is in, as he doesn't show it, only the small snippet of code he was changing that was cropped in view.

    Where can I find this value?
     
  2. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    241
    The force field code is located in lua/ge/extensions/gameplay/forceField.lua
    The values you can see in the video are at the top of the file.

    You can also change the force field strength by executing the following code in the console:
    Code:
    gameplay_forceField.setForceMultiplier(value)
    gameplay_forceField.activate()
    Instead of value, input a number. Positive values push objects away from you, negative values pull objects toward you.
     
  3. trollboi

    trollboi
    Expand Collapse

    Joined:
    Mar 23, 2025
    Messages:
    47
    i do not understand what exactly you said so can i get a bit more simple/better understanding, sorry for the bump
     
  4. MegaKnight

    MegaKnight
    Expand Collapse

    Joined:
    Sep 12, 2024
    Messages:
    241
    The best way to understand how it works would probably be to copy these commands into the console and executing them one after another, so you can see what they do:
    • gameplay_forceField.activate()
    • gameplay_forceField.setForceMultiplier(0)
    • gameplay_forceField.setForceMultiplier(10)
    • gameplay_forceField.setForceMultiplier(-10)
    • gameplay_forceField.setForceMultiplier(50)
    • gameplay_forceField.setForceMultiplier(-50)
    The first command activates the forcefield with standard strength. The second one sets the strength to 0, so that there is no more force pulling/pushing other vehicles. The next commands change direction and strength of the force field. The higher the number, the stronger the forcefield. Negative values (eg. -10) pull vehicles toward the player, positive values (eg.10) push vehicles away from the player.

    I hope that's explained well enough.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice