redscript icon indicating copy to clipboard operation
redscript copied to clipboard

Components

Open striderxfossility opened this issue 4 years ago • 3 comments

Greetings,

Do you have any idea how to get components scripts?

for example FppCameraComponet exist ingame, and there is also a class/function for it.

But, for example vehicleTPPCameraComponent, wich you call by FindComponent("vehicleTPPCameraComponent"), does not have any script ingame, but Cyber Engine Tweaks can Dump it, so there must be something.

striderxfossility avatar Feb 11 '21 10:02 striderxfossility

From a cursory glance it seems like both FPPCameraComponent and TPPCameraComponent are both native classes baked into the game's source code. This is slight conjecture on my part, so anyone please feel free to correct me if I'm mistaken.

When CDPR's scripting engine needs to expose native classes it typically uses the native keyword to do so, along with any methods/functions needed by the scripters. It seems like whoever wrote the scripts for the game exposed FPPCameraComponent but not TPPCameraComponent (unless it's missing from the decompiled repo, but that seems unlikely).

I'm not sure there's any way to expose the native TPPCameraComponent functions in Redscript right now unfortunately. You might mimicking the pattern used with FPPCameraComponent, but I have my doubts that it'll work.

public native class FPPCameraComponent extends CameraComponent {
  public final native func ResetPitch() -> Void
}

dreamstride avatar Feb 11 '21 15:02 dreamstride

i can change the cameraComp, this will also effect the tppComp, but this is just a example i gave, some components are hidden and do not have a parent for example, so i cant change/access those.

its to bad that we cant change the native classes, because its looking that it would hold all the good stuff.

striderxfossility avatar Feb 11 '21 16:02 striderxfossility

just encountered this issue too, trying to wrap the native func RPGManager.CalculateSellPrice

ownlyme avatar Mar 08 '23 19:03 ownlyme