Skyrim Messagebox Menu Tutorial

From Nexus Mods Wiki
Jump to: navigation, search

Overview

This tutorial aims to show you how to make a quick menu with 3 different buttons that runs once at the start of Skyrim when you first load the mod.

Tutorial

1. Create a quest and give it an ID (contrary to intuition do not enable "star game enabled" (it now means that it will start everytime the game loads or somin, not only to start once like in FO3 and co, quests automaticly start without conditions now).


2. Create a message and add 3 buttons giving them some text (not too long, buttons will be displayed next to each other with this script).


3. Add a script to your quest and add properties for your quest and message.


4. Use the following for that script:

Scriptname MyMenuQuestScript extends Quest
{displays a multiple choice menu}

message property MyMenuQuestMessage auto                 ;;declare your properties/variabels
quest property MyMenuQuest auto

event OnInit()                                            ;;begins when script or its parent quest gets initialized

int ibutton = MyMenuQuestMessage.show()                   ;;shows the message item

       if ibutton == 0                                    ;; 0 is the first button, 1 the second, and so on
               debug.messagebox("you hit button 1")       ;;replace with whatever result function you like

       elseif ibutton == 1
               debug.messagebox("you hit button 2")

       else 
               debug.messagebox("you didnt hit button 1 or 2 hence must have hit 3")

       endif

MyMenuQuest.stop()                                        ;;stops the quest
endEvent

5. Autofill the scripts properties and youre done, start the game and see your menu appear.


--Jaysus 09:42, 18 February 2012 (GMT)