Jump to content

[LE] Preventing Companions from entering Cell/Worldspace


MesaSolar

Recommended Posts

You need to create a custom script that when you 'Fast Travel' to your worldspace will dismiss all the player's followers, but this will only work with followers npcs that are created the same way as the default vanilla followers, or the use the same follower's creation framework.


Some followers like the ones i've created will completely ignore any restrictions the modder can add to his mod, they do not follow the common followers creation method, as the matter of fact they are 'Non-Followers Followers'.


Except mine, there are also 'Summonable Followers' out there, so even if you dismiss them the player can still call them from inside your worldspace.



Some things just cannot be created in this game engine and some other that can, they are overwritten by other mods.

With the thousands of mods that exists out there you need to adapt and overcome them, innovation is the key...



Have a happy modding.

Edited by maxarturo
Link to comment
Share on other sites

" 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 don't 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 "catch up" script applied to them, since they just teleport 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 ObjectReference

All 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.

That's 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 you're fast travelling there. "

Link to comment
Share on other sites

There are ways to do this on 'Fast Travel', one way is to:

- You don't need to detect the 'Fast Travel', but the script can fire once you have 'Fast Travel', you can do this on a player's alias or a trigger box on the 'New Worldspace Location', or you can do it in an other way since there are other ways you can do this:

Event OnLocationChange(Location akOldLoc, Location akNewLoc)


and once the 'New Location' has change that equals the 'Fast Travel' target of the worldspace location, then the script can detect the player's followers and dismiss them and move them back to the 'Old Location' / worldspace.


Here are some other ways you can use to do this, you just need to think outside the box:





* You can also do it on the map's loacation when it gets clicked.

* There are also 'Followers' that the player can be carrying them in his inventory.


Have a happy modding.

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...