Jump to content

Photo

Script Help - Fast Travel

script help fast travel if location discovered

  • Please log in to reply
7 replies to this topic

#1
Plarux

Plarux

    Enthusiast

  • Members
  • PipPip
  • 146 posts

Hello everyone,

 

I'm currently trying to create a script that teleports the player (only if they have the location discovered) via activator.

Not sure what I'm doing wrong, but I think that I've got the right idea.

 

Here's what I have (attached to an activator):

Scriptname Plarux_FastTravelMenu02 extends ObjectReference  

Message Property PL_FastTravelMenu02  Auto
Message Property PL_LND_Message_Solstheim Auto
ObjectReference Property SolstheimMapMarker Auto
ObjectReference Property SolstheimMarker Auto


Event OnActivate(ObjectReference akActionRef)
	IsLocationDiscovered()

EndEvent

Bool Function IsLocationDiscovered(ObjectReference SolstheimMapMarker)

if (SolstheimMapMarker.GetMapMarkerVisible() == 2)
    Menu()
elseif
    PL_LND_Message_Solstheim.show()
endif
EndFunction

Function Menu(int aButton = 0)
	aButton = PL_FastTravelMenu02.show()
	If aButton == 0
		Game.FadeOutGame(False, True, 2.0, 1.0)
		Game.GetPlayer().MoveTo(SolstheimMarker)
		Game.EnableFastTravel()
		Game.FastTravel(SolstheimMarker)
	ElseIf aButton == 1
		
	EndIf
EndFunction

Compile Output:

Starting 1 compile threads for 1 files...
Compiling "Plarux_FastTravelMenu02"...
E:\Program Files\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\Plarux_FastTravelMenu02.psc(18,6): no viable alternative at input '\\r\\n'
No output generated for Plarux_FastTravelMenu02, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Plarux_FastTravelMenu02

I'm not sure what the third line of the Compile Output means, and require assistance figuring out what to do next.

 

Thank You, 

Plarux


Edited by Plarux, 12 February 2020 - 03:05 AM.


#2
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 8,980 posts

Your problem is here:

if (SolstheimMapMarker.GetMapMarkerVisible() == 2)
    Menu()
elseif
    PL_LND_Message_Solstheim.show()
endif

Given what your script is doing, the 'elseif' needs to be 'else' instead.
 



#3
Ghaunadaur

Ghaunadaur

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,190 posts

Also, GetMapMarkerVisible is a condition function. For the script, use a combination of IsMapMarkerVisible and CanFastTravelToMarker.
  

if (SolstheimMapMarker.IsMapMarkerVisible()) && (SolstheimMapMarker.CanFastTravelToMarker())


#4
Plarux

Plarux

    Enthusiast

  • Members
  • PipPip
  • 146 posts

Your problem is here:

if (SolstheimMapMarker.GetMapMarkerVisible() == 2)
    Menu()
elseif
    PL_LND_Message_Solstheim.show()
endif

Given what your script is doing, the 'elseif' needs to be 'else' instead.
 

 

IsharaMeradin,

 

Thank you for replying! I was able to resolve the error in the previous post, but now have another one :/

 

Here's the updated script:

Scriptname Plarux_FastTravelMenu02 extends ObjectReference  

Message Property PL_FastTravelMenu02  Auto
Message Property PL_LND_Message_Solstheim Auto
ObjectReference Property SolstheimMarker Auto
ObjectReference Property RavenRockMapMarker Auto


Event OnActivate(ObjectReference akActionRef)
	IsLocationDiscovered()
EndEvent

Bool Function IsLocationDiscovered(ObjectReference RavenRockMapMarker)

if (RavenRockMapMarker.IsMapMarkerVisible() == TRUE && RavenRockMapMarker.CanFastTravelToMarker() == TRUE)
    Menu()
else
    PL_LND_Message_Solstheim.show()
endif
EndFunction
Function Menu(int aButton = 0)
	aButton = PL_FastTravelMenu02.show()
	If aButton == 0
		Game.FadeOutGame(False, True, 2.0, 1.0)
		Game.GetPlayer().MoveTo(SolstheimMarker)
		Game.EnableFastTravel()
		Game.FastTravel(SolstheimMarker)
	ElseIf aButton == 1
		
	EndIf
EndFunction

Compile Output:

Starting 1 compile threads for 1 files...
Compiling "Plarux_FastTravelMenu02"...
E:\Program Files\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\Plarux_FastTravelMenu02.psc(10,1): argument ravenrockmapmarker is not specified and has no default value
No output generated for Plarux_FastTravelMenu02, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on Plarux_FastTravelMenu02

The error it is giving is directly related to the line with the Bool Function. When I changed RavenRockMapMarker to something else, it will say argument "something else" is not specified. 



#5
Plarux

Plarux

    Enthusiast

  • Members
  • PipPip
  • 146 posts

I was able to compile the script successfully.

Thank you both for the help!

Scriptname Plarux_FastTravelMenu02 extends ObjectReference  


Message Property PL_FastTravelMenu02  Auto
Message Property PL_LND_Message_Solstheim Auto
ObjectReference Property SolstheimMarker Auto
ObjectReference Property RavenRockMapMarker Auto




Event OnActivate(ObjectReference akActionRef)


if (RavenRockMapMarker.IsMapMarkerVisible() == TRUE && RavenRockMapMarker.CanFastTravelToMarker() == TRUE)
     Menu()
else
     PL_LND_Message_Solstheim.show()
endif
EndEvent


Function Menu(int aButton = 0)
aButton = PL_FastTravelMenu02.show()
If aButton == 0
Game.FadeOutGame(False, True, 2.0, 1.0)
Game.GetPlayer().MoveTo(SolstheimMarker)
Game.EnableFastTravel()
Game.FastTravel(SolstheimMarker)
ElseIf aButton == 1


EndIf
EndFunction

Edited by Plarux, 12 February 2020 - 04:33 AM.


#6
Ghaunadaur

Ghaunadaur

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,190 posts
Ok, then just ignore my previous post. :happy:

Edited by Ghaunadaur, 12 February 2020 - 04:38 AM.


#7
ReDragon2013

ReDragon2013

    Old hand

  • Members
  • PipPipPip
  • 542 posts

Whenever you want to use a function in papyrus scripting there are some things you should understand right now.

(1) Parameter

FUNCTION Test1(Int param1, Float param2, ObjectReference param3)
    ; some code here
ENDFUNCTION

(2) Return value (functions may have this, events never have any return value)

Bool FUNCTION Test1(Int param1, Float param2, ObjectReference param3)
   IF (param1 == 0)
      Return TRUE
   ENDIF

   IF (param2 == 1.0)
      Return TRUE
   ENDIF

   IF (param3 == Game.GetPlayer() as ObjectReference)
      Return TRUE
   ENDIF

  Return False         ; this is the return value in case that every condition before do not match
ENDFUNCTION

You wrote: "trying to create a script that teleports the player (only if they have the location discovered) via activator."

Plarux_FastTravelMenu02

Spoiler

 

And this is the Skyrim forum, not the Skyrim SE forum !!!


Edited by ReDragon2013, 12 February 2020 - 07:57 PM.


#8
Plarux

Plarux

    Enthusiast

  • Members
  • PipPip
  • 146 posts

ReDragon2013, thank you for this reference! My apologies for not realizing this was the wrong forum :/







Also tagged with one or more of these keywords: script help, fast travel, if location discovered

Page loaded in: 1.125 seconds