Jump to content

Oblivion Menu Script Help


Recommended Posts

Hello all,

 

I'm new to Oblivion scripting and would like to create a script which brings up a 6-option menu when a special item is equipped from my inventory.

 

Can someone advise me how to make such a script, please?

 

Thanks.

Link to comment
Share on other sites

This should get you onto the right track regarding those multiple options menus: https://cs.elderscrolls.com/index.php?title=MessageBox_Tutorial

But I think they're going a little too far when you only need 6.

 

And you'll likely need "Begin OnEquip Player" instead of their "Begin OnActivate" block, if you want it to get triggered by equipping a certain item (in this case the item having this as its Object script).

 

I can also whip up an example script for you, if you can't make heads or tails out of the instructions found over on the WiKi.

Link to comment
Share on other sites

I would appreciate if you would create a sample script for me, DrakeTheDragon. I have no trouble creating a script which brings up a menu when I wear a certain item in Morrowind, but it is quite different in Oblivion, it seams.

 

Thanks again. :smile:

Link to comment
Share on other sites

Well, that first reply was made in sort of a hurry, in the middle of job work still, thus I kept it short intentionally.

Last night I was so busy, I didn't get around to write a lengthier reply either. But today I think I can...

 

So let's make an Object script running on the item you are to equip:

short bChoosing ;boolean flag to signal whether message box was shown before or not
short sChoice ;the choice made inside the menu
 
Begin OnEquip Player
    ;will run once whenever the player equips the item
    MessageBox "Your choice?" "Option 1" "Option 2" "Option 3" "Option 4" "Option 5" "Option 6"
    set bChoosing to 1
End
 
Begin GameMode
    ;while the menu is shown the game is in MenuMode, once a button gets clicked it will return back to GameMode
    if bChoosing == 1
        ;menu was shown before, now check the pressed button
        set sChoice to GetButtonPressed
        if sChoice > -1
            set bChoosing to 0 ;reset the flag, so checking stops and waits for message box to be triggered again
            if sChoice == 0
                ;do option 1 stuff
            elseif sChoice == 1
                ;do option 2 stuff
            elseif sChoice == 2
                ;do option 3 stuff
            elseif sChoice == 3
                ;do option 4 stuff
            elseif sChoice == 4
                ;do option 5 stuff
            elseif sChoice == 5
                ;do option 6 stuff
            endif
        endif
        ;if GetButtonPressed was -1, i.e. no choice was known yet, keep checking next frame
    endif
End

That should already do the trick basically. Depending on what it is you want to be done for each button press, you might need to relocate certain parts of the code to other scripts though. You can for example also do the button press checking in a Quest script instead and only use the item's Object script for the triggering OnEquip part.

 

As always, others correct me, if anything about my solution is wrong/inefficient/etc. But it should work already rather fine, if my memory serves me right still.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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