ruddy88 Posted February 22, 2018 Share Posted February 22, 2018 (edited) G'day folks.Quite regularly I help people with modding problems on a facebook group I am in.Decided I'd start posting some of the stuff I help with as mini tutorials on the forums here if it's something I see asked a lot or that just may come in handy.Todays topic:Preventing a follower from entering a cell with you.NOTE: There is a vanilla script already that does this, however it does seem to have some flaws so I have modified it to be a bit more reliable.The problem with the vanilla script is that your follower still remains your follower, they just dont enter the door.If you enter combat while inside however, sometimes your follower auto teleports to you.This can also happen with modded followers that have a "catchup" script applied to them, since they just telkeport and never actually go through the door (which is what we use to block access).So my solution was to also add a dismiss feature to the script so that the follower actually leaves your service.The best part, is that we don't need to actually write that script, we can just utilise the vanilla follower script to do it.Lastly, this should work on both actual followers, as well as NPCs that are following you via an ai package (and arent actually added to the follower faction.the caveat with that is, if a follower is simply using an AI package, then they wont leave your service.They will instead remain a follower but will wait outside (as they cannot activate the door) and will go back to following you once you leave that cell/worldspace.So lets get to it:In the creation kit, double click on your door reference.This can be a physical door, or it can be an automatic door (such as with cave entrances) or it can even be an activator (like a port key that you activate to be teleported to a location).On the reference window, go to the scripts section, add a new papyrus script, name it whatever you want.Then right click the script, select EDIT SOURCE.You will have:Scriptname WhateverYouCalledYourScript extends ObjectReferenceAll you have to do is paste the below script in: Faction Property CurrentFollowerFaction auto Faction Property DismissedFollowerFaction auto Quest Property pDialogueFollower Auto Event OnInit() BlockActivation() EndEvent Event OnActivate(ObjectReference akActionRef) if IsActivationBlocked() == False Debug.Trace("Door is currently unblocked") return endIf if IsActivationBlocked() == True if akActionRef == Game.GetPlayer() Activate(akActionRef, True) else Actor actorRef = akActionRef as Actor if !(actorRef.IsInFaction(DismissedFollowerFaction)) (pDialogueFollower as DialogueFollowerScript).DismissFollower(0, 0) actorRef.ModFactionRank(CurrentFollowerFaction, -2) actorRef.AddtoFaction(DismissedFollowerFaction) endIf endIf endif EndEvent Finally, from your reference window, click on properties, and Auto-Fill All.Thats it.Repeat this process for any other doors or activators that lead in to your cell.NOTE:This should work for cells as well as worldspaces.But be aware, if you create a "door" to another worldspace, the script will work fine. But if the player fast travels from the vanilla worldspace to a location in your new worldspace, then neither the player or any followers will end up activating the door so they will NOT be dismissed in this case.The only solution to this is to disable fast travel locations in your new worldspace.Unfortunately there is no vanilla script function to detect onFastTravel (at least none I am aware of) so there would be no easy way to prevent followers from following you to your worldspace if youre fast travelling there. Edited February 22, 2018 by ruddy88 Link to comment Share on other sites More sharing options...
FaegenFeorhlif Posted February 25, 2018 Share Posted February 25, 2018 Thanks, that's very helpful. Always good to have scripting resources on hand! Link to comment Share on other sites More sharing options...
TheWormpie Posted February 25, 2018 Share Posted February 25, 2018 Yup, thanks :) This has been bookmarked. Link to comment Share on other sites More sharing options...
Recommended Posts