KartKraft

KartKraft

评价数不足
Mouse Steering Script for KartKraft
由 fyall 制作
Leider gibt es bis jetzt keine eingebaute Mauslenkungsfunktion. Solange könnt ihr diese Methode benutzen, die ich hier beschreibe. (funktioniert auch für andere Spiele!)

English:
So sad there is no inbuilt mouse steering method. Till it is fixed you can use this method, that i describe here. (it also works for other games!)
   
奖励
收藏
已收藏
取消收藏
Download der nötigen Software // Download of necessary software
Deutsch:
Ladet das Paket in dem Link dieses Youtube Videos herunter (Link in der Beschreibung des Videos zu Google Drive):
https://youtu.be/DE9x2CNdFAc

English:
Download the software from the google drive link in the video description:
https://youtu.be/DE9x2CNdFAc
Installieren // Installation
Deutsch:
Ladet alle drei Dateien von Google Drive runter am besten in einer Zip.
Installiert Vjoy und danach Free Pie. Öffnet einen Text Editor und kopiert folgendes rein: (nach dem englischen Textabschnitt!) Speichert die Datei zum Beispiel als "MausLenkung.py" ab, vergesst dabei nicht beim speichern im Editor "alle Typen" auszuwählen, damit ihr sie nicht als .txt Datei abspeichert!

English:
Download all three parts of the google drive folder. Execute Vjoy and install FreePie after that.
Now open a text editor and paste following code inside and save as "MouseSteering.py".
Dont forget to save it not as a text file, but select "all types" in the editor.

if starting:
system.setThreadTiming(TimingTypes.HighresSystemTimer)
system.threadExecutionInterval = 5

def set_button(button, key):
if keyboard.getKeyDown(key):
v.setButton(button, True)
else:
v.setButton(button, False)

def calculate_rate(max, time):
if time > 0:
return max / (time / system.threadExecutionInterval)
else:
return max

int32_max = (2 ** 14) - 1
int32_min = (( 2** 14) * -1) + 1

v = vJoy[0]
v.x = (int32_min) * 8

# =============================================================================================
# Axis inversion settings (multiplier): normal = 1; inverted = -1
# =============================================================================================
global throttle_inversion, braking_inversion, clutch_inversion
throttle_inversion = 1
braking_inversion = 1
clutch_inversion = 1

# =============================================================================================
# Mouse settings
# =============================================================================================
global mouse_sensitivity, sensitivity_center_reduction
mouse_sensitivity = 3.5

sensitivity_center_reduction = 1.0

# =============================================================================================
# Ignition cut settings
# =============================================================================================
global ignition_cut_time, ignition_cut_elapsed_time
ignition_cut_enabled = True
ignition_cut_time = 100
ignition_cut_elapsed_time = 0

global ignition_cut, ignition_cut_released
# Init values, do not change
ignition_cut = False
ignition_cut_released = True

# =============================================================================================
# Steering settings
# =============================================================================================
global steering, steering_max, steering_min, steering_center_reduction
# Init values, do not change
steering = 0.0
steering_max = float(int32_max)
steering_min = float(int32_min)
steering_center_reduction = 1.0

# =============================================================================================
# Throttle settings
# =============================================================================================
global throttle_blip_enabled
throttle_blip_enabled = True

# In milliseconds
throttle_increase_time = 50
throttle_increase_time_after_ignition_cut = 0
throttle_increase_time_blip = 50
throttle_decrease_time = 70

global throttle, throttle_max, throttle_min
# Init values, do not change
throttle_max = int32_max * throttle_inversion
throttle_min = int32_min * throttle_inversion
throttle = throttle_min

global throttle_increase_rate, throttle_decrease_rate
# Set throttle behaviour with the increase and decrease time,
# the actual increase and decrease rates are calculated automatically
throttle_increase_rate = calculate_rate(throttle_max, throttle_increase_time)
throttle_increase_rate_after_ignition_cut = calculate_rate(throttle_max, throttle_increase_time_after_ignition_cut)
throttle_increase_rate_blip = calculate_rate(throttle_max, throttle_increase_time_blip)
throttle_decrease_rate = calculate_rate(throttle_max, throttle_decrease_time) * -1

# =============================================================================================
# Braking settings
# =============================================================================================
# In milliseconds
braking_increase_time = 200
braking_decrease_time = 200

global braking, braking_max, braking_min
# Init values, do not change
braking_max = int32_max * braking_inversion
braking_min = int32_min * braking_inversion
braking = braking_min

global braking_increase_rate, braking_decrease_rate
# Set braking behaviour with the increase and decrease time,
# the actual increase and decrease rates are calculated automatically
braking_increase_rate = calculate_rate(braking_max, braking_increase_time)
braking_decrease_rate = calculate_rate(braking_max, braking_decrease_time) * -1

# =============================================================================================
# Clutch settings
# =============================================================================================
# In milliseconds
clutch_increase_time = 0
clutch_decrease_time = 5

global clutch, clutch_max, clutch_min
# Init values, do not change
clutch_max = int32_max * clutch_inversion
clutch_min = int32_min * clutch_inversion
clutch = clutch_min

global clutch_increase_rate, clutch_decrease_rate
# Set clutch behaviour with the increase and decrease time,
# the actual increase and decrease rates are calculated automatically
clutch_increase_rate = calculate_rate(clutch_max, clutch_increase_time)
clutch_decrease_rate = calculate_rate(clutch_max, clutch_decrease_time) * -1


# assign button
vJoy[0].setButton(0,int(keyboard.getKeyDown(Key.S)))
vJoy[0].setButton(1,int(keyboard.getKeyDown(Key.D)))
vJoy[0].setButton(2,int(keyboard.getKeyDown(Key.C)))
vJoy[0].setButton(3,int(keyboard.getKeyDown(Key.W)))
vJoy[0].setButton(4,int(keyboard.getKeyDown(Key.E)))
vJoy[0].setButton(5,int(keyboard.getKeyDown(Key.R)))
vJoy[0].setButton(6,int(keyboard.getKeyDown(Key.T)))
vJoy[0].setButton(7,int(keyboard.getKeyDown(Key.Y)))

# =================================================================================================
# LOOP START
# =================================================================================================

# =================================================================================================
# Steering logic
# =================================================================================================
if steering > 0:
steering_center_reduction = sensitivity_center_reduction ** (1 - (steering / steering_max))
elif steering < 0:
steering_center_reduction = sensitivity_center_reduction ** (1 - (steering / steering_min))

steering = steering + ((float(mouse.deltaX) * mouse_sensitivity) / steering_center_reduction)

if steering > steering_max:
steering = steering_max
elif steering < steering_min:
steering = steering_min

v.x = int(round(steering))
# =================================================================================================
# PIE diagnostics logic
# =================================================================================================
diagnostics.watch(v.x)
diagnostics.watch(v.y)
diagnostics.watch(v.rz)
diagnostics.watch(v.slider)
diagnostics.watch(steering_center_reduction)
diagnostics.watch(throttle_blip_enabled)
diagnostics.watch(ignition_cut_enabled)
Ausführen des Script und konfigurieren im spiel // Run the script and config ingame
Deutsch:
Öffnet nun FreePie und öffnet in FreePie das Python Script "MausLenkung.py". Dann klickt auf "Script" und dann "Run Script". Geht nun in das Spiel in die Optionen und weißt Eure X Achse der Lenkung zu, indem ihr nach rechts lenkt und eine Taste drückt, dann nach links und eine Taste drückt. Zum Gas geben nutze ich persönlich die W-Taste und zum Bremsen die S-Taste. Für die Gangschaltung benutze ich das Mausrad (hoch ein Gang vor / runter ein Gang tiefer). Viel Spaß.
Was mich halt noch stört ist der Mauszeiger im Bild während der Fahrt.

English:
Open FreePie and open the MouseSteering.py file. Select Script -> Run Script. Now configure ingame with the steering x axis. First right then press a button, then left and press a button. For throttle i use the W-Key and for Braking the S-Key. For Transmission i use up mouse wheel and down mouse wheel. Have fun. Only the mouse icon is disturbing me a lil bit.
1 条留言
Kobrilan 2022 年 10 月 16 日 上午 3:11 
Super erklärt und vielen dank für die mühe