Besiege

Besiege

52 ratings
Lua Scripting Mod
3
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.099 MB
Feb 4, 2021 @ 12:09am
Jul 27, 2021 @ 4:59am
41 Change Notes ( view )

Subscribe to download
Lua Scripting Mod

Description

What is this mod?
This mod allows you to create really cool machines using in-game Lua scripting with multiplayer and other mod support.

Join Besiege official discord server, there are so few members who plays with Lua mod. I`ll be waiting for you.

Main features at this stage of development
  • Almost full multiplayer support.
  • Key emulation.
  • Changing slider values in simulation.
  • Setting steering angle.
  • Module system for using same scripts for different machine parts.
  • Handling and writing chat messages.
  • Getting information about level entities (soldiers etc.).
  • Getting info of specified block of specified player such as position, velocity, rotation and so on.
  • Getting info of machine of specified player.
  • Creating GUIs based on Unity3D GUIs.
  • Raycasting, sphere overlapping and more.
  • Handling input from mouse, keyboard, joysticks.
  • Other usefuls things like screen info, FPS cursor mode and so on.
  • Documentation[github.com] provided.
  • Scripting examples provided.
  • In-game scripting, no need to compile, rejoin or restart.

How to start?

  1. Press Ctrl+L in building mode.
  2. See documentation.
  3. Download some examples.
  4. Press "Open LuaRoot folder".
  5. Open "main.lua" with some nice code editor.
  6. Examine it.
  7. Create!

Examples
https://steamcommunity.com/sharedfiles/filedetails/?id=2558577515
https://steamcommunity.com/sharedfiles/filedetails/?id=2396766820
https://steamcommunity.com/sharedfiles/filedetails/?id=2393945683
https://steamcommunity.com/sharedfiles/filedetails/?id=2383786648
https://steamcommunity.com/sharedfiles/filedetails/?id=2383799572
https://steamcommunity.com/sharedfiles/filedetails/?id=2383802295
https://steamcommunity.com/sharedfiles/filedetails/?id=2383834423

Warning
Mod still in development and can contains a lot of bugs, but i will try to fix them as soon as they appear.
121 Comments
ilyshk4  [author] Jul 26 @ 10:53am 
I feel like its not related to the mod itself, but how the Unity game engine handles gamepad/joystick input. You can try and google for the correct axes names.
Neanod Jul 26 @ 5:00am 
I encountered a problem when connecting a gamepad: the script via input.get_key() sees pressing some digital buttons (for example, Joystick8Button9), but input.get_axis_raw() does not read the main axes of the sticks and triggers. I tried all possible options (JoystickAxis1-28, Joystick1Axis1, etc.), but they are not registered.

Please tell me if there is a known limitation of the mod, or am I doing something wrong?
ilyshk4  [author] Jun 2 @ 7:47am 
It depends on how game develoeprs implemented the block, sometimes they precalculate values and save them so changing the source variables like rocket power doesnt affect the rocket
Neanod May 31 @ 6:41pm 
Very good mod for programmers and war crimes lovers. For some reason, after ignition you cant edit rocket power, but everything else is ok.
Antarctic_Singularity Nov 9, 2024 @ 11:27am 
truposjigatel Certain values you can't change while the simulation is running, not sure if the ones you mentioned are unchangable but that might be why it's not working.
truposjigatel Nov 9, 2024 @ 7:49am 
У клиента не работает set_slider('speed',..) для колес и вращающихся блоков. При этом у сервера все ок - тот же скрипт, та же техника - колеса крутятся без проблем. Было раньше такое или это после обновы бесиджа? Что можно поделать? Ошибок никаких не выдает.
孩子们我回来了 Jun 4, 2024 @ 4:18am 
support message simulate please. and new DLC blocks
ilyshk4  [author] Jan 21, 2024 @ 12:53am 
Some blocks do not support changing its speed during simulation.
To detect presses on xbox controller you have to use input.get_key_down("JoystickButton0"). Joystick buttons are kind-of randomly mapped, so you have to google "unity xbox one controller mapping"
Antarctic_Singularity Dec 2, 2023 @ 7:38pm 
Or how to detect button presses on xbox controller?
Antarctic_Singularity Dec 2, 2023 @ 3:20pm 
Hi do flying blocks work with set speed slider? I tried yaw.set_slider("speed", 3) and using local yaw = machine.get_refs_control("yaw") but it is not working. Are they broken or am I doing it wrong : P