Jump to content

Got Event Handler working for Notes!


EPDGaffney

Recommended Posts

Well, what this code does is it makes something occur when the player clicks/presses A (on a gamepad) on a note in the Pip-Boy. This is different because until recently, this was not possible. The idea is so 'out there' that even after asking for help from honestly some of our best people, I was convinced I was going to have to use a workaround.

 

Notes are currently very unwieldy unless they're short. A mod using this concept could theoretically change that if someone wanted, or someone could add readable books this way, or any number of things.

 

Whilst I would encourage any modder to do a Find on the lists of functions on the wiki, to my recollection, these are all the improved message functions available to us now:

https://geckwiki.com/index.php/MessageEx

https://geckwiki.com/index.php/MessageExAlt

https://geckwiki.com/index.php/MessageBoxEx

https://geckwiki.com/index.php/MessageBoxExAlt

 

MessageEx and MessageBoxEx are NVSE and allow one to pass the text directly, which is very convenient, but they don't give any options and MessageBoxEx does not offer the ability to title the message. The other two are JIP functions that improve upon this greatly.

 

The downside to MessageBoxExAlt is that it requires a UDF script at the moment, which takes away from the convenience somewhat, but it's still far superior to vanilla, and JIP says there is an improvement in the works, if I understood correctly. I think the next update will allow passing to a blank form where the argument is required. Either that or you can already do that and I just haven't tried. This means that you can use that same blank form for every message box that you want to give a title but don't need buttons for it. The UDF script is where you would implement button functionality (if needed; though without the blank form method, a UDF script is still required if you want to pass text directly to a message box and give it a title, which is the sole downside), and it's far quicker than vanilla.

 

I like contributing, so I think we all get something out of it. I like that sense of community, us all helping each other and such.

Edited by EPDGaffney
Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

The sense of community is great :smile: But I guess what we are discussing now is accurate community information.

 

And I have to say ... I like your injection to that point EPDGaffney.

 

I was languishing in the not known.

 

But Dubious was there to counter it.

Edited by Mktavish
Link to comment
Share on other sites

Thanks. Updated the "obsolete information" under "GECK Form-ID, Base-ID, Ref-ID, and Editor-ID"; and also the "TIP: Passing a 'Note' to the player" under "Scripting". I used your EventHandler code as an example. Feel free to edit directly if you refine it, or just let me know to do so.

 

-Dubious-

Link to comment
Share on other sites

It looks good, I think, but for the fact that the bit about the messages is right there with the notes and I have a feeling some newer modders would get confused, as it's a common mistake at least at first to forget which is which when working. I still do it occasionally. Whilst all that stuff about the messages is relevant to what I'm doing with the event handler that's there (and probably what most people would do with such an event handler), it's technically not inherently related.

 

Also, this section nearby called

TIP: Passing a 'Note' to the player.

I feel isn't named for the true power it's offering, which is the ability to trick the engine into using an OnAdd block for a note (or OnActivate, using the same principle, though it's not mentionedin the tip). My event handler script is similarly used to trick the engine into running a script that simulates running OnEquip on a note (note that unlike the OnAdd trick, which does run OnAdd, OnEquip never appears in my script; the script just behaves as it would if you ran OnEquip on an armour or weapon).

Link to comment
Share on other sites

Added a point about distinguishing between "notes" and "messages" in that paragraph. It's an overview section, so I think that is sufficient there.

 

The focus of the "Tip" on "Passing notes to the player" is just that. Not about "tricking" the engine into using other methods. I would rather put that into an "Advanced technique" tip and cross link them in order to maintain focus. However, I regard EventHandlers as a major but underappreciated technique added by NVSE, and as a bridge into more advanced techniques such as "tricking the engine" as you describe. As such I think it appropriate placed there to show there are more than the basic approach available. I'll think about how to expand the tip on EventHandlers to cover that point you make.

 

Appreciate the thoughts.

 

-Dubious-

Link to comment
Share on other sites

Sorry, I had completely misread that section. Really reading that bit on passing a note to the player, I'm a bit confused. I had only briefly scanned it and saw phrases about using misc. items as an anchor to the relevant note and removing the misc. items via script later. So I sort of pieced together (unconsciously I suppose) that as it was directly preceding what I'd posted here about using the OnClick event handler for a note, that it was a similar concept. But it seems to be literally about passing notes to the player, just in a convoluted way compared to anything I've ever done (which is, make a note and drop it into the cell where I want the player to find it, no scripting of any kind and no misc. items). So...is that the way notes were handled in the Fallout 3 G.E.C.K. maybe?

 

Yes, Event Handlers are just phenomenal for modders, especially now that we kind of need new things available in a game this old with this many mods already. So it's great that NVSE added them and that JIP keeps making new ones. Coming from UE4, where you can make any event handler you want with relative ease, it was a bit frustrating working within the vanilla limits. But we're coming to the point where most things at the very least have a workaround available in this regard.

Link to comment
Share on other sites

That tip is about being "proactive" in passing the note, as opposed to the "passive" approach you had used. For example, when someone wants to pass the "note" to the Player as a result of passing a dialog check or activating a marker. I've been working with someone in the "Mod Talk" sub-forum on exactly that problem (actually "recipes" from a dialog check in this case), and they just got it to work only when they linked up the note with a script and an item. I'm trying to get clarification on what that tip is missing in order to improve it.

 

Are you sure Players are actually able to retrieve and then read your note without being linked to an item they can pickup? Or are you giving it to them by way of an activator? (I consider an Activator or EventHandler as "scripting".)

 

-Dubious-

Link to comment
Share on other sites

I must say, I am very confused about that person's problem. My mod has an NPC that gives you a recipe if you do something for him, and in dialogue, the result script has an AddNote line and that's it. I used:

player.addnote GSBNoteToCarmine

 

Later on, once I realised how notes work, I have a terminal that doesn't even specify the player as the one that gets the note, and that works perfectly as well.

 

The Note form in the New Vegas G.E.C.K. has a spot to choose a model, and once that's done, the note can be placed in the world. Behind the scenes, it is indeed actually just an activator that gets destroyed when the player activates it, and then a note is added, but this requires no scripting.

 

Have a look at other notes in the game. They rarely have scripts involved in any way, and when they do, it's an AddNote or GetHasNote line, nothing fancy (usually at least).

 

Edit: Sorry, that's not the recipe, just a note. The recipe line doesn't specify the player, just 'AddNote MyRecipe' in a result script of dialogue. And everything I've mentioned has been tested and is functional.

Edited by EPDGaffney
Link to comment
Share on other sites

Is it possibly due to either where you defined the reference to the "note/recipe" item, or that you are using NVSE functions where the OP in that thread is sticking with pure GECK commands? (Just trying to pin down the source of the difference in results. Not something I've had occasion to code myself.)

 

[Edit:] Added your points about using EvenHandlers to "trick" the game engine to the "TIP: Don't overlook EventHandlers."

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...