Multiple choice shrine script

Post » Wed Feb 11, 2015 10:22 pm

Hi, I'm tryng to set up a shrine that gives giving me the choice to decide through a menu the blessing I prefer once I activate it. My script is some sort of a patchwork and obviously doesn't work.

Spoiler


Scriptname BlessingMenuTest extends ObjectReference

Message Property NocturnalMessage Auto
Message Property BlessingMessage Auto
Message Property AltarRemoveMsg Auto
Spell Property TempleBlessing01 Auto
Spell Property TempleBlessing02 Auto
Spell Property TempleBlessing03 Auto
Spell Property TempleBlessing04 Auto

Event OnActivate(ObjectReference akActionRef)
Menu()
EndEvent

Function Menu(Int aiButton = 0) ; The menu will exit on its own after a selection is made.
aiButton = NocturnalMessage.Show() ; Shows your menu.
If aiButton == 0

ElseIf aiButton == 1

TempleBlessing01.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()

EndIf

ElseIf aiButton == 2

TempleBlessing02.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()

EndIf

ElseIf aiButton == 3

TempleBlessing03.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()


EndIf

ElseIf aiButton == 4

TempleBlessing04.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()


EndIf

EndIf

EndFunction

Every akActionRef variable is undefined and I do really hope to find some kind soul around here willing to help this poor noob sorting this script out. Many thanks.

User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am

Post » Wed Feb 11, 2015 9:28 pm

akActionRef only works inside your OnActivate Event.

To make it work just forget about the function and put everything inside the event.

User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Thu Feb 12, 2015 2:06 am

You can't do:

If x

EndIf

ElseIf y

EndIf

Instead, it should be:

If x

ElseIf y

EndIf

Otherwise it won't work.
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am

Post » Thu Feb 12, 2015 2:42 am

So it sohuld look something like this...right ?....

Spoiler
Scriptname BlessingMenuTest extends ObjectReference

Message Property NocturnalMessage Auto
Message Property BlessingMessage Auto
Message Property AltarRemoveMsg Auto
Spell Property TempleBlessing01 Auto
Spell Property TempleBlessing02 Auto
Spell Property TempleBlessing03 Auto
Spell Property TempleBlessing04 Auto

Event OnActivate(ObjectReference akActionRef)

Menu()

Function Menu(Int aiButton = 0)
aiButton = NocturnalMessage.Show()
If aiButton == 0

ElseIf aiButton == 1

TempleBlessing01.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()

ElseIf aiButton == 2

TempleBlessing02.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()

ElseIf aiButton == 3

TempleBlessing03.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()

ElseIf aiButton == 4

TempleBlessing04.Cast(akActionRef, akActionRef)
if akActionRef == Game.GetPlayer()
AltarRemoveMsg.Show()
BlessingMessage.Show()


EndIf

EndFunction

EndEvent

P.S.: Nice to meet you again Matthiaswagg...and many thanks to Wormple, too...I'll try this at home this evening...

User avatar
Matthew Aaron Evans
 
Posts: 3361
Joined: Wed Jul 25, 2007 2:59 am


Return to V - Skyrim