Jump to content

Help me with a script


Cloen

Recommended Posts

I'm close to release my first follower mod but while I'm good with textures and other stuff I have no idea how to write a script. I would like to give to this npc the ability to teleport the player to every major city, she is supposed to teleport as well. I don't know how difficult this can be but I suppose it's similar to how carriages work, just that instead of having a different carriage in every city the npc teleports with you. Is it possible to do? Can anyone help me?
Link to comment
Share on other sites

Adapted from my Road Signs mod which allows fast travel to the city/town on the targeted sign. You can make additional tweaks as necessary.

 

Add this to your dialogue quest handler as a separate quest script. The ImageSpaceModifier properties will auto-fill. Then all you need to do is call upon this function from your TopicInfo fragments.

ScriptName FollowerFastTravelScript Extends Quest

Import Game

ImageSpaceModifier Property FadeToBlackImod  Auto  
ImageSpaceModifier Property FadeToBlackHoldImod  Auto  
ImageSpaceModifier Property FadeToBlackBackImod  Auto  

Function TravelMethod(ObjectReference DestinationREF)
	DisablePlayerControls()
	utility.wait(2)
	FadeToBlackImod.Apply()
	utility.wait(2)
	FadeToBlackImod.PopTo(FadeToBlackHoldImod)
	utility.wait(2)
	FastTravel(DestinationREF)
	utility.wait(2)
	FadeToBlackHoldImod.PopTo(FadeToBlackBackImod)
	FadeToBlackHoldImod.Remove()
	EnablePlayerControls()	
EndFunction

TopicInfo fragment example:

(GetOwningQuest() as FollowerFastTravelScript).TravelMethod(TargetLocation)

;first create an ObjectReference property that is used to target the marker used by either the carriages or standard fast travel
;then change the 'TargetLocation' variable name to match what you used for the ObjectReference property
;repeat for all dialog entries with fast travel destinations

NOTE: Because it calls upon the stock FastTravel function/command the follower will automatically be transported with the player. Time will also lapse as it does with normal fast travel.

Also, taking a look at the discussion on the FastTravel page... You'll want to set up a way to prevent your follower from allowing fast travel from interior locations. It is intended to work from exterior to exterior rather than interiors.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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