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

Papyrus: Menu Teleport Script


Zuhon
 Share

Recommended Posts

Before I explain, let me preface the fact that I know sub zero about scripting. Everything within the 'spoiler' was ripped right from the creation kit website.

Okay, I'm creating a teleport orb in which if you press E on it, it brings up an options menu asking you to select either cities or towns. If you select cities, it shows all the cities. Towns, the towns. Then if you click on one of those, it will teleport you to the appropriate location. I found something on the creation kit website about sub-menus', which this is, but I don't understand one line of it. Plus, it isn't finished.

I would greatly appreciate it if somebody would write/finish this script for me and tell me what to do step by step. For the destinations I'd probably want to use XMarkers', right?

Here's the script from the website:

ScriptName OptionsMenuScript Extends ObjectReference

Message Property MainMenuMESG Auto

Message Property BreakfastMESG Auto

Message Property LunchMESG Auto

Message Property DinnerMESG Auto

Event OnRead()

Game.DisablePlayerControls(False, False, False, False, False, True) ; Ensure MessageBox is not on top of other menus & prevent book from opening normally.

Game.EnablePlayerControls(False, False, False, False, False, True) ; Undo DisablePlayerControls

Menu()

EndEvent

Function Menu(Bool abMenu = True, Int aiButton = 0)

While abMenu

If aiButton != -1 ; Wait for input (this can prevent problems if recycling the aiButton argument in submenus)

aiButton = MainMenuMESG.Show() ; Main Menu

abMenu = False ; End the function

If aiButton == 0 ; Breakfast

aiButton = BreakfastMESG.Show()

If aiButton == 0 ; Sweet Roll & Coffee

ElseIf aiButton == 1 ; Pancakes, Bacon & Eggs

ElseIf aiButton == 2 ; Chicken Fried Pony Steak

EndIf

ElseIf aiButton == 1 ; Lunch

aiButton = LunchMESG.Show()

If aiButton == 0 ; Glazed Turkey Sandwich

ElseIf aiButton == 1 ; Grilled Ham Sandwich

ElseIf aiButton == 2 ; Shredded Pony Sandwich

EndIf

ElseIf aiButton == 2 ; Dinner

aiButton = DinnerMESG.Show()

If aiButton == 0 ; Filet Mignon

ElseIf aiButton == 1 ; Pony Fajitas

ElseIf aiButton == 2 ; Lobster

EndIf

EndIf

EndIf

EndWhile

EndFunction

(Note, this is a repost on here because nobody on the Nexus was willing to help me. Thought I'd try here!)

(Also, I apologise for the terrible indenting. The spoiler thing automatically does that. )

Link to comment
Share on other sites

When I get home from work I can give more help. In the meantime you could look at my levelers tower mod on the nexus, it has a fully functioning teleport spell with several menus just like your asking about.

Awesome thanks! I couldn't find anyone anywhere who could help. Can we do it through private messaging? Because I have a feeling it will be long and descriptive and there isn't any reason to bump over and over.

Link to comment
Share on other sites

I do not like helping with scripts in PM's, and I am pretty busy with life, so I am not on here all the time. A thread is best.

First of all, you need to learn how to attach properties to papyrus scripts. This is the beginners class on how to do this. Learn it.

http://tesalliance.o...ere-for-basics/

Second, there is nothing in the spoiler tag. :lol:

After you take the basics class, you should know how to attach properties to it.

1. Since this is a spell script we are making, make a new script that extends 'activemagiceffect'.

2. You need to attach each teleport destination to your script as an 'objectReference' property, and you will use that to move the player to its location. Thus, a teleport.

At each location you want to be able to telport to, add a new ObjectReference property to your script and link it to an existing XMarker in the location you want to go to. This is the best method because it keeps you from making changes to that cell, which is clean. Be careful when you attach the script to the xmarker, so you don't move the Xmarker, thus making a cell change.

Now that you have all the locations attached to your script, you need make the menus and attach them to the script.

The script name and extend, and the xmarker properties of the locations you want to teleport to:


Scriptname LevelersSpellHomeScript extends activemagiceffect
{Teleport Home Spell Script}
ObjectReference property HomeTarget auto
ObjectReference Property WhiterunMarker Auto
ObjectReference Property RiftenMarker Auto
ObjectReference Property WindhelmMarker Auto
ObjectReference Property WinterholdMarker Auto
ObjectReference Property DawnstarMarker Auto
ObjectReference Property SolitudeMarker Auto
ObjectReference Property MarkarthMarker Auto
ObjectReference Property FalkreathMarker Auto
ObjectReference Property MorthalMarker Auto
ObjectReference Property RiverwoodMarker Auto
ObjectReference Property IvarsteadMarker Auto
ObjectReference Property RoriksteadMarker Auto
ObjectReference property UniqueTarget auto
[/code] Make some new 'Message' objects and enter around 5 or so options per menu.
[code]
Message Property Question01MSG Auto
Message Property Question02MSG Auto
Message Property Question03MSG Auto
Message '01' will be the main menu. Make sure the 'message box' is checked. Message Text could be "Select an option:" The Menu Buttons could then be: 0 Go Home 1 Cities 2 Unique 3 Cancel Message '02' will be the cities menu. 0 Whiterun 1 Riften 2 Windhelm 3 Winterhold 4 Dawnstar 5 Solitude 6 More Message '03' would finish the cities menu. 0 Markarth 1 Falkreath 2 Morthal 3 Riverwood 4 Ivarstead 5 Rorikstead 6 Cancel Now, you should have marker locations and messages attached to your script. We need some integers to hold our button selections, so lets add a few.

int Button1
int Button2
int Button3
[/code] Now, since this is a spell, you need an event type that is used by spells. 'OnEffectStart'. I am using 'IF/ELSE/ENDIF' logic to display the correct menu (message##) and get the correct response from the player so I know what they want to do.
[code]
Event OnEffectStart(Actor akTarget, Actor akCaster)
;Menu 1 question
Button1 = Question01MSG.Show()
;Menu 1 selection 0
if Button1 == 0
Game.GetPlayer().MoveTo(HomeTarget)
;Menu 1 selection 1
elseif Button1 == 1
;Menu 2 question
Button2 = Question02MSG.Show()
;Menu 2 section 0
if Button2 == 0
Game.GetPlayer().MoveTo(WhiterunMarker)
;Menu 2 section 1
elseif Button2 == 1
Game.GetPlayer().MoveTo(RiftenMarker)
;Menu 2 section 2
elseif Button2 == 2
Game.GetPlayer().MoveTo(WindhelmMarker)
;Menu 2 section 3
elseif Button2 == 3
Game.GetPlayer().MoveTo(WinterholdMarker)
;Menu 2 section 4
elseif Button2 == 4
Game.GetPlayer().MoveTo(DawnstarMarker)
;Menu 2 section 5
elseif Button2 == 5
Game.GetPlayer().MoveTo(SolitudeMarker)
;Menu 2 section 6 - Embedded menu
elseif Button2 == 6
;Menu 3 question
Button3 = Question03MSG.Show()
;Menu 3 section 0
if Button3 == 0
Game.GetPlayer().MoveTo(MarkarthMarker)
;Menu 3 section 1
elseif Button3 == 1
Game.GetPlayer().MoveTo(FalkreathMarker)
;Menu 3 section 2
elseif Button3 == 2
Game.GetPlayer().MoveTo(FalkreathMarker)
;Menu 3 section 3
elseif Button3 == 3
Game.GetPlayer().MoveTo(FalkreathMarker)
;Menu 3 section 4
elseif Button3 == 4
Game.GetPlayer().MoveTo(FalkreathMarker)
;Menu 3 section 5
elseif Button3 == 5
Game.GetPlayer().MoveTo(FalkreathMarker)
;Menu 3 section 6 - cancel so do nothing
Endif
;Menu 1 selection 2
elseif Button1 == 1
Game.GetPlayer().MoveTo(UniqueTarget)
;Menu 1 selection 3 - Cancel so do nothing
Endif
endEvent

-Later I will cover creating the Magic effect you attach the script to, and then the spell you attach the magic effect to. Then adding the spell to the world.

Edited by WillieSea
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...