How to check if horse or chest is ok to activate

Post » Wed Aug 12, 2015 9:21 am

Is there a quick method to check if a horse or chest (or other Object Ref) will not trigger the crime system if the player activates it?

In Oblivion, OBSE provided a quick one-shot method, objRef.IsOffLimits (activatorRef), which checks if the objRef is ok for the activatorRef to activate.

In Skyrim, I'm currently using:

If (!horseRef.GetActorOwner () || horseRef.GetActorOwner () == playerRef.GetActorBase ()) && (!horseRef.GetFactionOwner () || horseRef.GetFactionOwner () == PlayerFaction)    //ok to activateEndIf
EDIT: I think I need to also add "&& (playerRef.IsInFaction (horseRef.GetFactionOwner ())".
User avatar
Stace
 
Posts: 3455
Joined: Sun Jun 18, 2006 2:52 pm

Post » Wed Aug 12, 2015 6:58 am

SKSE also has an IsOffLimits() function which is used in Sometimes Pick Up Books to identify books that would give a crime. I don't know how it's implemented internally, but it's probably a better starting place than all of those owner and faction tests even if you have to add in one or two more.

User avatar
Queen of Spades
 
Posts: 3383
Joined: Fri Dec 08, 2006 12:06 pm


Return to V - Skyrim