TheAppalachan Posted May 13 Posted May 13 I am getting really annoyed with how slow the walk speed is, I want to have the same speed as NPCs or at least be able to configure how fast I can walk (I tried to make a mod to use scroll wheel walking speed like in arma reforger and tarkov but that's way above my skill level) so I tried to make something, but it's not working. Before I spend another 5 hours chasing a mod that I can't make, i'd like to see if it's possible at all first. Gemini thought a LUA would be a good idea, but said "The crucial part about users needing to configure PlayerCharacterClassName, MovementComponentName, and SpeedPropertyName for their specific game build is heavily emphasized in the Config section and the initial log messages. The more verbose "how-to" and debugging example sections have been removed to streamline the script for end-users." I don't know what that means so here is the code that it wrote, if it is useful for anyone, then please use it however you wish, I just want the mod to exist in one way or another. --[[ Mod Title: Customizable Walk Speed Author: [Your Name/Nexus Mods Username] Version: 1.0.0 Date: May 13, 2025 Game: [Name of Your "Oblivion Remastered" UE5 Project] Requires: UE4SS (Unreal Engine Scripting System) Description: Allows players to customize their character's maximum walking speed in-game using hotkeys. Includes options to set a specific speed, incrementally increase/decrease speed, and log the current speed to the UE4SS console. Configuration is required for game-specific class and property names. --]] --[[--------------------------------------------------------------------------- CONFIGURATION - USER MUST VERIFY THESE FOR THEIR GAME ---------------------------------------------------------------------------]]-- local Config = { -- Hotkeys (Virtual Key Codes). Find codes at: https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes SetSpeedHotkey = Key.F5, -- Press to set walk speed to TargetWalkSpeed IncreaseSpeedHotkey = Key.PageUp, -- Press to increase walk speed DecreaseSpeedHotkey = Key.PageDown, -- Press to decrease walk speed LogCurrentSpeedHotkey = Key.F8, -- Press to log current walk speed to UE4SS console TargetWalkSpeed = 600.0, -- Desired walk speed when SetSpeedHotkey is pressed SpeedIncrement = 50.0, -- Amount to increase/decrease speed by MinWalkSpeed = 50.0, -- Minimum allowed walk speed MaxWalkSpeed = 2000.0, -- Maximum allowed walk speed -- !! CRITICAL !! These names are COMMON DEFAULTS and VERY LIKELY need to be changed -- to match the specific "Oblivion Remastered UE5" project. -- Use UUU, game-specific forums, or other tools to find the correct names. PlayerCharacterClassName = "DefaultPawn_C", -- Examples: "BP_PlayerCharacter_C", "PlayerPawn_C" MovementComponentName = "CharacterMovement", -- This is the VARIABLE NAME of the movement component on the character. -- Examples: "CharacterMovement", "MovementComponent" SpeedPropertyName = "MaxWalkSpeed" -- Property on the Movement Component for walk speed. Usually "MaxWalkSpeed". } --[[--------------------------------------------------------------------------- SCRIPT LOGIC ---------------------------------------------------------------------------]]-- -- Retrieves the player's character movement component. -- Returns the component object or nil if not found. local function GetPlayerMovementComponent() local PlayerCharacter = GetPlayerCharacter() -- UE4SS helper to get the local player character. if not PlayerCharacter then Log("WalkSpeedMod: PlayerCharacter object not found. Ensure '" .. Config.PlayerCharacterClassName .. "' is correct or GetPlayerCharacter() is working.") return nil end -- Attempt to get the movement component as a property of the PlayerCharacter. -- This is common if the component is a variable in the Character Blueprint. local MovementComponent = PlayerCharacter[Config.MovementComponentName] if not MovementComponent then Log("WalkSpeedMod: Movement component not found using property name: '" .. Config.MovementComponentName .. "'.") Log("WalkSpeedMod: Verify this name. Alternatively, if you know the component's C++ class, consider using PlayerCharacter:GetComponentByClass(...)") return nil end return MovementComponent end -- Sets the character's maximum walk speed. -- @param NewSpeed (number): The desired new walk speed. local function SetWalkSpeed(NewSpeed) local MovementComponent = GetPlayerMovementComponent() if not MovementComponent then Log("WalkSpeedMod: Cannot set speed, movement component not found.") return end -- Clamp the speed within configured min/max values. NewSpeed = math.max(Config.MinWalkSpeed, math.min(NewSpeed, Config.MaxWalkSpeed)) -- Set the speed property value on the movement component. local Success = MovementComponent:SetPropertyValue(Config.SpeedPropertyName, NewSpeed) if Success then Log("WalkSpeedMod: Walk speed set to " .. string.format("%.2f", NewSpeed)) else Log("WalkSpeedMod: Failed to set '" .. Config.SpeedPropertyName .. "'. Property not found, not writable, or incorrect component?") end end -- Changes the current walk speed by a specified amount. -- @param Amount (number): The amount to add to the current walk speed (can be negative). local function ChangeWalkSpeed(Amount) local MovementComponent = GetPlayerMovementComponent() if not MovementComponent then Log("WalkSpeedMod: Cannot change speed, movement component not found.") return end -- Get the current speed value from the movement component. local CurrentSpeed = MovementComponent:GetPropertyValue(Config.SpeedPropertyName) if type(CurrentSpeed) ~= "number" then Log("WalkSpeedMod: Could not read current '" .. Config.SpeedPropertyName .. "'. Is the property name correct? Type found: " .. type(CurrentSpeed)) return end SetWalkSpeed(CurrentSpeed + Amount) end -- Logs the current maximum walk speed to the UE4SS console. local function LogCurrentSpeed() local MovementComponent = GetPlayerMovementComponent() if not MovementComponent then Log("WalkSpeedMod: Cannot log speed, movement component not found.") return end local CurrentSpeed = MovementComponent:GetPropertyValue(Config.SpeedPropertyName) if type(CurrentSpeed) == "number" then Log("WalkSpeedMod: Current '" .. Config.SpeedPropertyName .. "' is " .. string.format("%.2f", CurrentSpeed)) else Log("WalkSpeedMod: Could not read current '" .. Config.SpeedPropertyName .. "'. Value type: " .. type(CurrentSpeed)) end end -- Main tick function, called every frame by UE4SS. -- Handles hotkey presses. function OnTick(DeltaTime) if IsKeyDown(Config.SetSpeedHotkey) then SetWalkSpeed(Config.TargetWalkSpeed) Wait(0.2) -- Brief delay to prevent multiple triggers from a single long press. end if IsKeyDown(Config.IncreaseSpeedHotkey) then ChangeWalkSpeed(Config.SpeedIncrement) Wait(0.2) end if IsKeyDown(Config.DecreaseSpeedHotkey) then ChangeWalkSpeed(-Config.SpeedIncrement) Wait(0.2) end if IsKeyDown(Config.LogCurrentSpeedHotkey) then LogCurrentSpeed() Wait(0.2) end end -- Initialization message when the script is loaded. Log("WalkSpeedMod: Customizable Walk Speed Script Loaded.") Log("WalkSpeedMod: Version 1.0.0") Log("WalkSpeedMod: Press F5 (Set), PageUp (Inc), PageDown (Dec), F8 (Log).") Log("WalkSpeedMod: CRITICAL - Verify PlayerCharacterClassName and MovementComponentName in the script's Config section for your game!")
Recommended Posts