UE4SS-RE / RE-UE4SS

Injectable LUA scripting system, SDK generator, live property editor and other dumping utilities for UE4/5 games
http://docs.ue4ss.com/
MIT License
1.21k stars 158 forks source link

[BlackMythWukong] BPMod not work #628

Closed AnnznnA closed 2 weeks ago

AnnznnA commented 3 weeks ago

Thank you to the developer for providing it version for BlackMythWukong,I can correctly obtain objects in the game, but there is a strange problem here, and I don't know if it's because Denuvo has taken effect After I packaged the blueprint installation package with the PostBeginPlay method from ModActor, the game was able to correctly locate it after running, but it did not take effect. In order to achieve the same effect, I tried to obtain a specific Lua Actor in the game, executed a piece of code, and the script did not report any errors,it seems work, but it also did not take effect Finally, LineTraceMod was modified and tested. The code still runs correctly, but it seems that its functionality is limited and it cannot hit static mesh bodies

-- LineTrace
local UEHelpers = require("UEHelpers")

-- Importing functions to the global namespace of this mod just so that we don't have to retype 'UEHelpers.' over and over again.
local GetKismetSystemLibrary = UEHelpers.GetKismetSystemLibrary
local GetKismetMathLibrary = UEHelpers.GetKismetMathLibrary

local IsInitialized = false

local function Init()
    if not GetKismetSystemLibrary():IsValid() then error("KismetSystemLibrary not valid\n") end

    print(string.format("KismetSystemLibrary: %s\n", GetKismetSystemLibrary():GetFullName()))

    if not GetKismetMathLibrary():IsValid() then error("KismetMathLibrary not valid\n") end

    print(string.format("KismetMathLibrary: %s\n", GetKismetMathLibrary():GetFullName()))

    IsInitialized = true
end

Init()

local function GetActorFromHitResult(HitResult)
    if UnrealVersion:IsBelow(5, 0) then
        return HitResult.Actor:Get()
    elseif UnrealVersion:IsBelow(5, 4) then
        return HitResult.HitObjectHandle.Actor:Get()
    else
        return HitResult.HitObjectHandle.ReferenceObject:Get()
    end
end

local player= nil
RegisterHook("/Script/Engine.PlayerController:ClientRestart", function(self)
    player= self:get()
end)

local function GetObjectName()
    if not IsInitialized then return end
    local PlayerController = wukong
    local PlayerPawn = PlayerController.Pawn
    local CameraManager = PlayerController.PlayerCameraManager
    local StartVector = CameraManager:GetCameraLocation()
    local AddValue = GetKismetMathLibrary():Multiply_VectorInt(GetKismetMathLibrary():GetForwardVector(CameraManager:GetCameraRotation()), 50000.0)
    local EndVector = GetKismetMathLibrary():Add_VectorVector(StartVector, AddValue)
    local TraceColor = {
        ["R"] = 0,
        ["G"] = 0,
        ["B"] = 0,
        ["A"] = 0,
    }
    local TraceHitColor = TraceColor
    local EDrawDebugTrace_Type_None = 0
    local ETraceTypeQuery_TraceTypeQuery1 = 0
    local ActorsToIgnore = {
    }
    print("Doing line trace\n")
    local HitResult = {}
    local WasHit = GetKismetSystemLibrary():LineTraceSingle(
        PlayerPawn,
        StartVector,
        EndVector,
        ETraceTypeQuery_TraceTypeQuery1,
        false,
        ActorsToIgnore,
        EDrawDebugTrace_Type_None,
        HitResult,
        true,
        TraceColor,
        TraceHitColor,
        0.0
    )

    if WasHit then
        HitActor = GetActorFromHitResult(HitResult)
        print(string.format("HitActor: %s\n", HitActor:GetFullName()))
    else
        return print("Nothing hit.\n")
    end
end

RegisterKeyBind(Key.F3, GetObjectName)

Based on my understanding, I don't seem to be able to find a suitable solution because I don't have the ability to know the reason. He didn't report any error messages or give me some dmp files, so I tried to seek your help. Thank you

game: BlackMythWukong

version: UE4SS - v3.0.1 Beta #0 - Git SHA #0e84e2e8

Mythical-Github commented 3 weeks ago

I have the same issue, the loader seems to need an update

Buckminsterfullerene02 commented 2 weeks ago

The mod on Nexus has been updated to fix BPModLoader.