IsharaMeradin Posted August 18, 2016 Share Posted August 18, 2016 I'm trying to use GetFactions to obtain an actor's list of factions. I'm having trouble with the casting. I'm using an MCM defined hotkey to provide secondary behavior on various object types using GetCurrentCrosshairRef. Mainly to avoid issues with OnCrosshairRefChange event. Tho what I'm trying to do here is a new idea and so don't have any older code to adapt from. This part passes through just fine: Ref = Game.GetCurrentCrosshairRef() If Ref != None If (Ref.GetBaseObject() as Form).GetType() == 43 I'm having trouble casting the current Ref into the necessary Actor for GetFactions.Ref.GetBaseObject() as Actor is yielding Error: Cannot call GetFactions() on a None object, aborting function callSince what I want to do may end up being a long block, I'm sending it to a custom function. i.e. Function SomeFunction(Actor TheActor) Faction[] ActorFactions = TheActor.GetFactions(-128,127) ;other stuff EndFunction Any suggestions on the proper casting? Link to comment Share on other sites More sharing options...
lofgren Posted August 18, 2016 Share Posted August 18, 2016 Actor extends reference, so you want to say (ref as actor).GetActorBase() to get the base actor form. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 18, 2016 Author Share Posted August 18, 2016 Thanks for the pointer. Turns out all I needed was (ref as actor). Link to comment Share on other sites More sharing options...
Recommended Posts