detecting when exiting "MenuMode" - solution. know a

Post » Tue Jun 19, 2012 9:49 pm

EDIT: Doh! I can't edit the title. It's a bit wrong. It should be: "OnMenuMode () Event - solution. know any other way that is better?"

I've been struggling with detecting when MenuMode becomes active.
This method is the closest that I can get to an OnMenuMode () Event.
Has anyone found a better way?

The set-up:
1. Quest with this Script.
The function is written so that it looks like and is used like an Event.
Spoiler
Scriptname kuDetectMenuModeQS extends QuestBool wasInMenuModeFunction OnMenuMode ()        ;menuMode triggered        wasInMenuMode = TrueEndFunctionEvent OnUpdate ()        If wasInMenuMode                ;coming back from MenuMode                wasInMenuMode = False        EndIfEndEvent

2. Player Alias with this Script.
It is Unfortunate that this Script will trigger OnMenuMode () only if something changes on the player - not exactly when they enter MenuMode.
But I think it's a good enough approximation - especially if your OnUpdate () needs to know if the player has returned from MenuMode.
Are there any other events we can attach to the Player where we can call IsInMenuMode ()?
Spoiler
Scriptname kuAFTPVPlayerS extends ReferenceAlias  Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)	kuAFTPVQS mainQuest = GetOwningQuest () as kuDetectMenuModeQS	If Utility.IsInMenuMode ()		mainQuest.OnMenuMode ()	EndIfEndEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)	kuDetectMenuModeQS mainQuest = GetOwningQuest () as kuDetectMenuModeQS	If Utility.IsInMenuMode ()		mainQuest.OnMenuMode ()	EndIfEndEventEvent OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect)	kuDetectMenuModeQS mainQuest = GetOwningQuest () as kuDetectMenuModeQS	If Utility.IsInMenuMode ()		mainQuest.OnMenuMode ()	EndIfEndEventEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference)	kuDetectMenuModeQS mainQuest = GetOwningQuest () as kuDetectMenuModeQS	If Utility.IsInMenuMode ()		mainQuest.OnMenuMode ()	EndIfEndEventEvent OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)	kuDetectMenuModeQS mainQuest = GetOwningQuest () as kuDetectMenuModeQS	If Utility.IsInMenuMode ()		mainQuest.OnMenuMode ()	EndIfEndEvent

Of course with better checking in the Player Alias Script, we can determine which Menu is active.
E.g. using the container parameter of OnAddItem () and OnRemovedItem () will tell us if the Player is with a merchant or looting a container.
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm

Post » Wed Jun 20, 2012 8:14 am

I don't know if this would work better (or at all actually) but I'm gonna direct you to this http://www.creationkit.com/MenuMode in the creation kit, and this http://www.gamesas.com/topic/1354316-conditions-in-papyrus/page__view__findpost__p__20411650(hahaha)
User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Wed Jun 20, 2012 7:19 am

That post was mine. (Hhahahaah!)
I tried that method 1st. It didn't work.

EDIT: MenuMode in condition requires an Int parameter.
I tried 0, 1, 2 and 3.
And 1002 and 1008.
These numbers are MenuModes in Oblivion (and I believe also in Fallout 3).
The condition always evaluated as False.
So, either they have a new MenuMode numbering system or MenuMode is disabled in Conditions.

EDIT 2: By the way, the solution in the first post above works.
I have it running in several of my mods.
User avatar
Claire Lynham
 
Posts: 3432
Joined: Mon Feb 12, 2007 9:42 am

Post » Wed Jun 20, 2012 10:27 am

Just so you know, you could actually use the http://www.creationkit.com/Events_Reference keywords and create a custom event. Custom events are exactly the same as custom functions, with a few restrictions irrelevant here like having no return values.

Cipscis
User avatar
Sista Sila
 
Posts: 3381
Joined: Fri Mar 30, 2007 12:25 pm

Post » Tue Jun 19, 2012 7:18 pm

I knew the post was yours, I saw when I went to find it :tongue:
Unfortunate that the menumode condition isnt working
User avatar
Claire Vaux
 
Posts: 3485
Joined: Sun Aug 06, 2006 6:56 am

Post » Wed Jun 20, 2012 12:17 am

Hey Cipscis, I do know, actually. And that's how it is in my actual mod. ;) I just wanted to avoid any possible confusion from my suggested code.
Thanks, anyway!



Xtynct, Ahhh...cool! I wasn't sure. And yeah, it's unfortunate that it doesn't work. It would have been a much better solution than the one I suggested above.
User avatar
Syaza Ramali
 
Posts: 3466
Joined: Wed Jan 24, 2007 10:46 am

Post » Wed Jun 20, 2012 4:39 am

I'm a little confused about this, why can't you just RegisterForUpdate and check Utility.IsInMenuMode() or even just a while loop with Utility.Wait(0.1) and IsInMenuMode?
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Tue Jun 19, 2012 10:07 pm

OnUpdate () doesn't fire when in Menu Mode.

So...IsInMenuMode () will never be True during OnUpdate () or any other game mode Events.

Only Events that trigger in Menu Mode (e.g. equipping, moving inventory between containers, bartering, etc...) will IsInMenuMode () be True.

That's basically what I'm looking for: an Event that executes when the menu is opens.
I've not found this. The closest I can find is OnAddItem (), etc...
User avatar
daniel royle
 
Posts: 3439
Joined: Thu May 17, 2007 8:44 am


Return to V - Skyrim