RE-UE4SS icon indicating copy to clipboard operation
RE-UE4SS copied to clipboard

Fixes for LUA helpers and types

Open Kein opened this issue 1 year ago • 3 comments

Missing global functions for Types.lua

Kein avatar Apr 20 '25 21:04 Kein

Why is GetPlayer deprecated and replaced by GetPawn?
I just added the function recently.
Have you guys decided it in Discord?
I understand that GetPawn might sound more logical, since a APawn from AController can be basically anything like a vehicle.
But in 90% of the time it's the player pawn and a new mod author who don't know Unreal Engine specifics won't know what GetPawn even does.
So the same way GetPlayerController can actually return a AController type instead, I find it much more user-friendly to call it GetPlayer.

igromanru avatar Apr 23 '25 12:04 igromanru

Why is GetPlayer deprecated and replaced by GetPawn? I just added the function recently. Have you guys decided it in Discord? I understand that GetPawn might sound more logical, since a APawn from AController can be basically anything like a vehicle. But in 90% of the time it's the player pawn and a new mod author who don't know Unreal Engine specifics won't know what GetPawn even does. So the same way GetPlayerController can actually return a AController type instead, I find it much more user-friendly to call it GetPlayer.

As far as I know it wasn't decided on Discord, but regardless, Player is distinctly different from Pawn in UE so I think this change makes sense. I think people need to learn the correct names for things, or else a lot more confusion and frustration will arise. I don't have a problem with GetPlayerPawn if you think that makes more sense than just GetPawn.

UE4SS avatar Apr 23 '25 12:04 UE4SS

GetPlayerPawn does not make any sense in the context of UE. What Player Pawn? Which Player it belongs to? Actually does not belong to any Player, only AController can own a Pawn in this context. And there can be dozens of Player/AI Controllers in [online] games, the concept of THE PlayerController is incorrect, even if this assumption works as it is in majority of cases ("default UE singleplayer games").

GetPawn should be then GetFirstPawn. Being essentially static it does not behave behave the way GetControlledPawn does. Right now it fetches the first PC with StaticFind which does not guarantee order, where as UPlayer array that holds all players - does.

Kein avatar Apr 23 '25 23:04 Kein