Besiege

Besiege

Not enough ratings
ACS System Manual
By UNITGX48
This Guide details my Arcade Control Script that works with the Lua Scripting mod to give World of Tanks style controls to combat machines, and has instructions on how to install and set up this script for new machines.
   
Award
Favorite
Favorited
Unfavorite
Initial Info :
ACS is a script that was intended to hook into my standard Budget Tank controls and make them handle far easier by mimicking the standard 3rd person arcade control method used in games like World of tanks or Warthunder.

The script's main intended feature is its ability to control a weaponized turret & the camera at the same time to allow far better target acquisition times, far better accuracy, and far better situational awareness. However once I figured out how to get it working I couldn't stop from going the whole 9 yards. This thing has just about every control feature from world of tanks that I could think of down to a cruise control and freelook.

Script Features :

Fully Mouse Controlled Turret
With click to fire
A Built In Reload System
Active if Infinite Ammo is ticked on
Hud Elements
Showing reload speed and magazine size
A Raycasted Reticle
Snaps to terrain in a straight line where the gun aims
Functioning Range Finder
That goes up to 4 digits
Single key Camera Swapping
Switch aim modes without ever leaving a camera
3rd Person Orbit Camera
Freely rotating, no RMB required.
Working Siege Mode
Trade mobility for reload speed
Freelook with Turret Lock
Easily look around, or snap the camera to line up with the gun
WASD Driving Binds
With correct reverse controls
R / F Bound Cruise Control
3 Speed forward / 2 Speed Backward
Directional Indicator
Showing Hull / Gun / & Camera direction
Mouse Lock
Locks mouse to center of screen in sim

‏‏⠀‎
A chunk of this guide will also be dedicated to each feature and how to make changes to the script so it more suits whatever vehicle you may be putting this on..
Installing ACS on a Machine :
The script can be shoved into any machine however there are some important things that are required or it won't run. Follow these steps and it should work.

Step 1 : Mod Dependency
Make sure you actually have the Lua mod installed.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2383785201
Step 2 : Add The Script
Load the machine you want to add ACS to.
Press Ctrl+L to bring up this menu , then click this button.

⠀‎
This will tab you out, and open a folder with a lua script named Main.lua in it. Open this file in a text editor of your choice, then copy the ACS code from this paste bin.
https://pastebin.com/qxcMJGEz
In the text editor Ctrl-A to select everything, then Ctrl-V to paste in the ACS code.
Save the file. You can keep it open for editing later, or close it.

Step 3 : Block Requirements
Make sure you have at least one of each of these blocks on the machine. Yes there are three camera's, one is an orbit camera, and the other two are scopes.
⠀‎
Next only the Cannon, Drive wheels, and Cameras need these key binds.
Also anything used to steer the vehicle should use left / right arrow keys.
‏‏⠀‎
But if you want to use other keys for some reason (IE you don't have a number pad), the emulated keys can be changed at the top of the script in this block of code.
‏‏⠀‎
Step 4 : Ref Keys
Next enter the appropriate ref keys into the blocks you want to use. Example : If you have 12 hinges for turning your turret left / right, then all 12 will need to be labeled with turret_ring in their ref key field.

Notes :
Scope cameras don't use ref keys.

The "main_gun" ref key is used to mark the cannon for the script to raycast the reticle from. If you don't want to use a cannon, then this can be given to any block.

The "drive_wheel" ref key can be used on anything that is similar to a wheel such as steering blocks and drills. Only the wheels that drive you forward should have ref keys added to them.

Block Name
Lua Ref Key
What Does This Key Do
Cannon
main_gun
Marks a block for racasting the aiming reticle.
Hinge (Horizontal)
turret_ring
Marks what hinges the script should use to turn the turret
Hinge (Vertical)
gun_mount
Marks what hinges the script should use to aim a weapon up or down
Wheel
drive_wheel
Marks what wheels are used to move the machine forward or backwards.
Camera
camera
Marks what camera is used for the main 3rd person view

If you don't know where to put the Ref Keys, they go in this box when editing a block's values.

‏‏⠀‎
If the gun aims down while looking up, the turret is rotating the wrong direction, or the gun is twisting, then a hinge is mirrored the wrong way.

This can be fixed by mirroring the problem hinge on it's own Y axis.

If It Still Doesn't Work...

Double check the ref key's and make sure you have all of them.
Advanced Setup & Features :
Please note, most code that is intended to be changeable has a -- description note next to it.

I have labeled almost everything in the script as well as I can. If something can be changed there is probably a note nearby saying what can be changed.

Under this outlines the major stuff that can be changed, most of the other script features do not require changes or there is nothing really to customize.

If I missed something important or loused something up, tell me please.
Mouse Controlled Turret :
‏‏⠀‎
Starting off with the features, The mouse controlled turret. Keep in mind that the way this works is all purely relative to the vehicle's hull and It does not have a built in stabilizer...

Out of the box the script is set to have about 10 degrees of gun depression and 18 degrees of elevation. The turret also has roughly 45 degrees / s traverse speed. It's horizontal traverse angles are also not restricted by default.

Traverse Speed customization

Changing the traverse speed of the turret is very easy and can be done simply by changing this number. Assuming you are not using a fancy editor, this line is just under the huge block of gibberish code near the top of the script, and is with a bunch of other settings options.

‏‏⠀‎
Default it is set to 10 which is about 0.45 on a hinge, I don't know the full conversions for this but adding 3 to the value is roughly the same as adding 0.1 to the hinge. This is used both for horizontal traverse speed as well as vertical.

Turret Traverse Limit customization

Because this script does not use steering hinge angle limits, they have to be set in the script itself. (This also means that steering blocks can be used and will have the limits applied)

Elevation / Depression and Horizontal limit values are specified here.

‏‏⠀‎
1 degree on a steering hinge is = to 20 in script. So a Depression of 10 degrees would be 200.

The Horizontal traverse limit is disabled by default, if you don't want a fully rotating turret, change this line to true

‏‏⠀‎
If horizontal limits are active, the direction panel will automatically have indicators placed showing hull relative limits, the default left / right turret traverse with the limit on is 50 degrees left or right.

Reload System :
⠀‎
I decided to integrate a reload system into the script itself because it would give budget tanks reload independence from my maps, meaning I can phase out the level logic and fine tune reloads based on the vehicle instead. The system has 2 different settings.

  • Single Shot Mode - Straight forward one shot and then reload
  • Autoloader Mode - Has a magazine with a fast inter clip reload, then a full reload

Both of these can be configured to suit the vehicle the script is used on.

Single Shot configuration

Single shot is active by default and only has one changeable setting, the reload speed.

⠀‎
If you don't want to use a cannon and would rather use a flame thrower activated projectile...

Place a timer block and give it the same activate key as the cannon (default number pad 0) then have the timer block run a flamethrower for however long you need it to.

Reason : The input from the script only lasts one in game tick and is not long enough to make a flame thrower set offta rocket.*

Autoloader configuration

To use the autoloader this 1 at line 65 must be changed to a 2

⠀‎
The autoloader has 3 settings that can be changed. Reload, mag size, and Interclip Reload. Both reload types use the same reload setting* only the autoloader uses mag size and interclip. They can be changed in the same area.

⠀‎
Note. The magazine size can be any number above 0, however the in game GUI will only show up to 10 shells in the side bar as is.
Hud Elements :
⠀‎
This script has its own built in Base64 encoded images to be used in a gui specific to the vehicle.

⠀‎
The huge block of text salad at the top of the script might look daunting, however It is just a png image converted into text so it can be stored in the script. This block of green is the code for this part of the gui.

⠀‎
This means that if you want to change one of these, or all of them, you can change them to literally anything you might want. Useful if your vehicle has s specific style you want its gui to adhere to.

For example in this image from an older version of my script, I've changed the reticle into a moth.

⠀‎
To change one of these images first you will need the image you want to use. Personally I would recommend making a custom one with an image editor.

However you can use random images off the internet.
There are some nice reticle images floating around (Just make sure its transparent...).

Your image needs to be converted into Base64 language so the script can read it. There are a few encoders around but the one I used is here.

https://www.base64encode.org/

Upload the image to that and encode, it will then spit out a text file you can save wherever. Open this file and copy everything.

In the script find the block of text responsible for the image you want to replace, and select everything between the two apostrophes inside the parentheses, replace it with the code from your encoded text file.

⠀‎
Your new image is likely to be a different size and therefore not placed correctly in game. At the bottom of the script there is a large area dedicated to setting gui stuff. Making an example mainly for changing the snapping reticle, the version used in 3rd person orbit camera is here.

⠀‎
The first two orange numbers are screen positions, for the reticle they should be half the image size. For all the other gui parts the first two numbers are screen positions relative to the center of the screen.

The last two numbers in that are the image's actual size in pixels. That goes for all gui parts.
Known Issues
None atm. If you find one report it to me.
2 Comments
FentanylFein 8 Nov, 2021 @ 12:35am 
this is amazing
ilyshk4 7 Nov, 2021 @ 7:33am 
incredible!!!!!!!