Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] Teleporting Book script help


Brecca
 Share

Recommended Posts

Hey,
 
I'm currently trying to work on a script that when reading a book a message will pop up saying:
 
(1.Don't Read)   (2. Read).
 
Not reading the book will cancel the script while reading will teleport the player to a marker in a dungeon.  This is what I currently have:

 

 

Scriptname OghmaInfiniumScript extends ObjectReference

 
ObjectReference Property "location" auto
Message Property ChoiceMessage auto
 
Event OnRead(Actor akActor)
 
          if akActor == Game.GetPlayer()
 
                  int choice = ChoiceMessage.Show()
                  if     (choice == 0)
                           ; do nothing
                  elseif (choice == 1)
                              Game.GetPlayer().moveto("location")
                  endif
           endIf
EndEvent
 

*This originally was the Ogh.Inf. script*

 

Currently this isn't compiling though, so I'm checking to see if I had done anything wrong.  Also note that my experience with scripting goes back to Monday :P

 

Besides that I'm also wanting to add a Return function to the script so that when the book is read again it sends the player back to the original location.  I am not so sure on where to start.

Link to comment
Share on other sites

Scriptname CHANGEYOURSCRIPTNAME!!!!! extends ObjectReference
 
ObjectReference Property TeleportLocation auto
Message Property ChoiceMessage auto
 
Event OnRead()
 
          if Game.GetPlayer() == True
 
                  int choice = ChoiceMessage.Show()
                  if     (choice == 0)
                           ; do nothing
                  elseif (choice == 1)
                              Game.GetPlayer().moveto(TeleportLocation)
                  endif
           endIf
EndEvent

 
First, make sure you change the Script name, or you will overwrite the oghma book script... very bad for your mod and anyone who plays it.
 
You don't need the quote marks on the "location" of the property or in the script.
 
OnRead() does not require the (Actor AkActor) stuff. I removed that and changed the script to make sure the player can activate it.
 
We will tackle one thing at a time.
 
See if you can compile this without any issues. If the compiler gives an error, copy that complete error and post it here, please.
Edited by DsoS
Link to comment
Share on other sites

Great news!

 

It compiled successfully and worked on the first try in game.  

 

So, for the Return function, apparently I would need to make a script that drops a marker in my place before teleport then reference back to it when the book is read again? So would I need to use a true/false set up?

 

Also, is there a way I can delay the script to wait for the book to open before the choice?  Right now the choices pop up before the book opens.  Really a nitpick, if its too much work I won't bother.

Link to comment
Share on other sites

The return function, I'm not sure about. I have not tried anything like that. Maybe Ghaunadaur or WillieSea can chime in on that.

 

For a wait time, place the line below the "if Game.GetPlayer() == True" line and above the "int choice .... " line

Utility.Wait(MyWaitTime)

 

Below the Message Property:

 

Int Property MyWaitTime Auto
Link to comment
Share on other sites

There are probably several ways to do this. I would make two states in the script, the first state to teleport to the 'TeleportLocation', the second to return to the original location. For the delay, WaitMenuMode would be better in this case I believe, because the game is in menu mode while a book is opened. You could try with this script:

 

ScriptName YourScriptName extends ObjectReference

ObjectReference Property TeleportLocation auto
Message Property ChoiceMessage auto
Static Property XMarkerHeading auto
ObjectReference ReturnMarker
Actor Property PlayerRef auto

auto State TeleportState
Event OnRead()
		Utility.WaitMenuMode(1.0)		
		int choice = ChoiceMessage.Show()
        if (choice == 0)
			; do nothing
        elseif (choice == 1)
			ReturnMarker = PlayerRef.PlaceAtMe(XMarkerHeading, 1)
			PlayerRef.MoveTo(TeleportLocation)
			GotoState("ReturnState")
        endif    
EndEvent
EndState

State ReturnState
Event OnRead()
		Utility.WaitMenuMode(1.0)
		int choice = ChoiceMessage.Show()
        if (choice == 0)
			; do nothing
        elseif (choice == 1)
			PlayerRef.MoveTo(ReturnMarker)
			ReturnMarker.Delete()
			GotoState("TelePortState")
		endif
EndEvent
EndState

 

Link to comment
Share on other sites

When you teleport 'to' your location, you first drop an XmarkerHeading that you placed in the world, with a reference name and an ObjectReference in the script pointing to it.

 

When you decide to teleport 'back' from whence they came, you move to the marker.

 

You only move your 'marker' when you go 'home'.

Link to comment
Share on other sites

ScriptName aaBookTeleportScript extends ObjectReference

ObjectReference Property TeleportLocation auto
Message Property ChoiceMessage auto
Static Property XMarkerHeading auto
ObjectReference ReturnMarker
Actor Property PlayerRef auto

auto State TeleportState
Event OnRead()
		Utility.WaitMenuMode(1.0)		
		int choice = ChoiceMessage.Show()
        if (choice == 0)
			; do nothing
        elseif (choice == 1)
			ReturnMarker = PlayerRef.PlaceAtMe(XMarkerHeading, 1)
			PlayerRef.MoveTo(TeleportLocation)
			GotoState("ReturnState")
        endif    
EndEvent
EndState

State ReturnState
Event OnRead()
		Utility.WaitMenuMode(1.0)
		int choice = ChoiceMessage.Show()
        if (choice == 0)
			; do nothing
        elseif (choice == 1)
			PlayerRef.MoveTo(ReturnMarker)
			ReturnMarker.Delete()
			GotoState("TelePortState")
		endif
EndEvent
EndState

Here we are, one teleporting book script :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...