Jump to content

Can I use Event Handler UDF to stop event I set it for from firing?


Nightylighty

Recommended Posts

Eventhandlers don't stop an event from being triggered. However, they intercept the event process in order to process your UDF code instead of the default code in the engine BEFORE it gets processed. Your UDF is used in place of the default process. If your function simply returns a "status" flag, then nothing actually happens for that event.

 

This basic "preemptive" concept is explained in the tutorial., and why Eventhandlers are such a powerful addition.

 

-Dubious-

Link to comment
Share on other sites

Yes, I read this tutorial and the one on event handlers which is why I am asking if I can prevent event process from being executed if my function runs before it. I just want for any attempt at fast travel to fail until certain conditions are met.

Link to comment
Share on other sites

Preventing FastTravel that way seems impossible, even if I set EnableFastTravel 0 1 1 in my UDF handler, it sets restriction correctly, but then I get teleported anyway..

I'm now wondering if SetOnMenuClickEventHandler can be used on map markers? I discovered what map markers are added as a child tiles to World Map image tile, but do they have an id of their own?

So if I understand this correctly, registering my function for map clicks would look something like this then - SetOnMenuClickEventHandler myHandlerUDF 1 "MapMenu#4", but is it possible to do so for map marker clicks?

Link to comment
Share on other sites

My error. I misremembered (an increasingly common event these days. Wish I could implement an Eventhandler on myself). After re-reading Tutorial: NVSE4+ Part 5: Event Handlers & User-Defined Events (UDEs) I spotted:

every time something is about to be activated or dropped, NVSE will call your event handler before proceeding with the activation or dropping.

So, the Eventhandler does NOT prevent the "action" (i.e. "fast travel") from taking place. There was nothing in the rest of that thread about preventing the "triggering event" action from occurring.

 

That is something you might ask one of the NVSE extension teams (JIP LN NVSE, lStewie, JohnnyGuitar, etc.) about if you can't find an existing function.

[Edit: Aha! I see from a different post that you found the answer to preventing "fast travel".]

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

Yes, SetOnMenuClickEventHandler idea worked out. I still would have preferred a way to stop fast travel which does not rely on EnableFastTravel function. It would require to first save and then restore fast travel state which I think is an unintuitive and roundabout way of handling this situation(

 

UPD Somehow that became a problem( I tried to search for function which returns FastTravel/Wait state, or GameSettings and I can't find anything.. Is there any way to obtain current EnableFastTravel settings?

Edited by Nightylighty
Link to comment
Share on other sites

  • Recently Browsing   0 members

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