SamHe11 Posted December 11, 2017 Share Posted December 11, 2017 I have this script attached to a Quest and I'm hoping someone can inform me how to discern if the ObjectReference variable I fill with GetCurrentCrosshairRef is an Actor type or not. I've tried... Actor TargetRef (more script, then...) TargetRef = Game.GetCurrentCrosshairRef() ...but then the compiler tells me type mismatch while assigning to a actor (cast missing or types unrelated)So I change my variable to... ObjectReference TargetRef...and everything compiles just fine. But doesn't this mean that the meat of my script will happen to any reference under my crosshair? I just want it to only effect Actor references. How can I make it tell them apart? I feel like I should know this, but it's late and I'm blanking. Thanks. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 11, 2017 Share Posted December 11, 2017 Test this then adapt to your needs should it work. ObjectReference TargetRef = Game.GetCurrentCrosshairRef() If TargetRef as Actor Debug.Trace(TargetRef.GeBaseObject().GetName()+" is an actor") Else Debug.Trace(TargetRef.GeBaseObject().GetName()+" is not an actor") EndIf Link to comment Share on other sites More sharing options...
Recommended Posts