Jump to content

Help with this menu script


bwins95

Recommended Posts

I'm trying to make a mod where you drop a book and click on it. when you click on the book you can pick it up or enter it. I've spent all day working on this and this is all I've been able to get. when I try to compile it it says the buttons need defining, but I don;t know how to do it.

 

This just a test script to see if I could make it work, so the book, message and transport location is the first thing I found.

 

ScriptName booktest Extends ObjectReference

Actor Property PlayerREF Auto
Message Property aaaaaabook Auto
ObjectReference Property aaUnderforgeTotem Auto

Function OnActivate(ObjectReference akActionRef)
aaaaaabook.Show()
If ButtonChoice0 == 0
Debug.notification("You've picked up the book")
AddItem(aaUnderforgeTotem)
ElseIf ButtonChoice1 == 0
Debug.notification("You've entered the book")
PlayerREF.MoveTo(Game.GetPlayer(), 120 * Math.Sin(Game.GetPlayer().GetAngleZ()), 120 *

Math.Cos(Game.GetPlayer().GetAngleZ()), Game.GetPlayer().GetHeight() + 2)
Endif
EndFunction

 

I've tried the creationkit.com menu tutorial, but it doesn't make any sense to me.

Link to comment
Share on other sites

Every variable and property of your script needs to be declared. Also, you might want to use event OnActivate() not function.

 

ScriptName booktest Extends ObjectReference
 
Actor Property PlayerREF Auto
Message Property aaaaaabook Auto
ObjectReference Property aaUnderforgeTotem Auto

Event OnActivate(ObjectReference akActionRef)
    int ButtonChoice = aaaaaabook.Show()
    If ButtonChoice == 0
        Debug.notification("You've picked up the book")
        AddItem(aaUnderforgeTotem)
    ElseIf ButtonChoice == 1
        Debug.notification("You've entered the book")
        PlayerREF.MoveTo(Game.GetPlayer(), 120 * Math.Sin(Game.GetPlayer().GetAngleZ()), 120 * Math.Cos(Game.GetPlayer().GetAngleZ()), Game.GetPlayer().GetHeight() + 2)
    Endif
EndEvent
Link to comment
Share on other sites

Every variable and property of your script needs to be declared. Also, you might want to use event OnActivate() not function.

 

ScriptName booktest Extends ObjectReference
 
Actor Property PlayerREF Auto
Message Property aaaaaabook Auto
ObjectReference Property aaUnderforgeTotem Auto

Event OnActivate(ObjectReference akActionRef)
    int ButtonChoice = aaaaaabook.Show()
    If ButtonChoice == 0
        Debug.notification("You've picked up the book")
        AddItem(aaUnderforgeTotem)
    ElseIf ButtonChoice == 1
        Debug.notification("You've entered the book")
        PlayerREF.MoveTo(Game.GetPlayer(), 120 * Math.Sin(Game.GetPlayer().GetAngleZ()), 120 * Math.Cos(Game.GetPlayer().GetAngleZ()), Game.GetPlayer().GetHeight() + 2)
    Endif
EndEvent

Thank you.

The funny thing is, I had something like this at one point, but it wouldn't compile, so i changed things.

Edited by bwins95
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...