Aller au contenu

Photo

Questions on a couple module events


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
Karma

Karma
  • Members
  • 391 messages
According to the wiki, a module script can capture the two events EVENT_TYPE_CODEX _CHANGED and EVENT_TYPE_PLOT_COMPLETED.

1) Does the CODEX_CHANGED event also capture changes to the journal when a plot updates? In other words, can it be used to listen for when specific flags of specific plots are set?
2) To what does "sName" refer in the PLOT_COMPLETED event? I assumed the string for the name of the plot, but all of my attempts to listen for the completion of a specific plot have failed. (See below.)
3) Will the PLOT_COMPLETED event only work with plots that can be seen in the journal? Or can it be one of those "hidden" plots?


I set up a case in my module script that looks something like:
__________________________________________________________________
        case EVENT_TYPE_PLOT_COMPLETED:
        {
            object oModule = GetEventCreator(ev);
            string sName = GetEventString(ev, 0);
           
            if(sName == PLT_BLAHBLAHBLAH)
            {
                DisplayFloatyMessage(oHero, "BLAHBLAHBLAH PLOT COMPLETED", FLOATY_MESSAGE, 16777215, 1.5); 
            }  
            break;  
        }
__________________________________________________________________

When the DisplayFloatyMessage() is under the "if," the floaty doesn't display in game, but when I move it out of the "if," it does display. That leads me to believe how I've set up the sName is incorrect. I've tried it a few different ways, but none seem to work. Maybe it's not the plot name string? If not, what is it?

#2
MerAnne

MerAnne
  • Members
  • 1 157 messages
OK, because I'm just 'that way' and use DisplayFloaty a lot. OK, and yes, I went to look at the definition several times and thought about what sName could possibly be before I realized this...

Have you considered: DisplayFloatyMessage(oHero, sName, FLOATY_MESSAGE, 16777215,1.5); outside the if statement? If it works there, then you can read what the value of sName is.

Back to bill paying and laundry SIGH

#3
Karma

Karma
  • Members
  • 391 messages
Good idea! And with that change made, sName appears to be the string of the title of the plot. That brings up new questions: How does that work with language localization? Is there an easy way to convert the name of the plot into the plot name string/GUID?

#4
MerAnne

MerAnne
  • Members
  • 1 157 messages
Set a constant that is equal to the plot name string?

There you've got me because that is my only guess. I just know that when I was trying to figure out how all of the files (ok, a FEW of the files) work together in the Fade, I had to keep looking up constants to figure out what I was seeing. If you have the string typed in the same way, then what you have done should work. unless there is blank padding to the left or right which means that the value of the string is really "PLT_BLAHBLAHBLAH " so that all of the strings are the same length. Or it may automatically add spaces up to a certain length. Have you checked the fade_constants file? I think it is in the Broken Circle folder under Includes - if I remember correctly. It has all kinds of constants in it. And I've spent FAR too much time in the toolset this weekend when I remember things like that.

I'll sleep on it and tell you if I figure out how to do it another way

#5
Karma

Karma
  • Members
  • 391 messages
I have a plot whose GUID string is "PLT_KCPT_QUEST_JOWAN" and the name of the plot is "Jailbreak!" The sName is "Jailbreak!" not "PLT_KCPT_QUEST_JOWAN." :|

I mean, I could set up a custom function that converts all possible vanilla and modded plot names to their corresponding plot GUID strings, but I really don't want to. I was hoping there was a way to capture the plot GUID from the event rather than the plot name. I don't think plot names have to be unique, so that poses a difficulty.

#6
MerAnne

MerAnne
  • Members
  • 1 157 messages
That is just ugly. At this time, you only need the one, but the option to 'not' hard code string names is always nice.

#7
Karma

Karma
  • Members
  • 391 messages
For the sake of posterity, I'm posting answers to my questions just in case someone else wants to know in the future.

1) Does the CODEX_CHANGED event also capture changes to the journal when a plot updates? In other words, can it be used to listen for when specific flags of specific plots are set?

-No, CODEX_CHANGED will only capture changes to plots marked as codex entries. It cannot be used to listen for specific flags of quest plots to be set.

2) To what does "sName" refer in the PLOT_COMPLETED event? I assumed the string for the name of the plot, but all of my attempts to listen for the completion of a specific plot have failed.

- sName refers to the name of the plot, not the file name of the plot. I'm not sure how this works out with language localization. I still haven't figured out a way to easily capture the plot GUID from sName.

3) Will the PLOT_COMPLETED event only work with plots that can be seen in the journal? Or can it be one of those "hidden" plots?

-It will listen for plots not seen in the journal as well.


And a new question: Can the function RegisterEventListener() be used to get the module script to listen for EVENT_TYPE_SET_PLOT, or is EVENT_TYPE_SET_PLOT a listener event? If it can be used, what is the target of EVENT_TYPE_SET_PLOT?

#8
sea-

sea-
  • Members
  • 264 messages
One (slightly clumsy) work-around for displaying your "plot completed" message is to call a custom function using an include when the quest completes, inside your plot script. But that only works if you are making your own plots in a custom module (I keep forgetting people want to mod the original campaign).

I am not sure if this purpose is strictly academic, but to be honest I can't see much actual use for what you want to do in the context of a game.  We already have the GUI pop-up for quest completion after all.

No idea on your final question.

Modifié par sea-, 02 janvier 2013 - 05:27 .


#9
Karma

Karma
  • Members
  • 391 messages

sea- wrote...

I am not sure if this purpose is strictly academic, but to be honest I can't see much actual use for what you want to do in the context of a game.


The floaty message was just a method of testing. It isn't the actual purpose I have in mind. What I want to do is listen for when certain vanilla plot flags are set and have my custom companions react to them (e.g. immediately start a conversation or change approval). I have other uses in mind as well, but that's my primary reason.

I know I could set up a custom function that constantly checks for flags to be set, but it's inefficient and could cause problems with older/slower computers. Currently, I'm using a combination of the "plot completed" and  "game mode changed" events, but it's inelegant. Moreover, because the "plot completed" event uses the plot name not the plot GUID, there could be conflicts if a modder names a plot the same as a vanilla plot, and I suspect there would be issues with non-English versions (unless even the non-English versions of the game use English plot names). I could fix the first issue by writing a custom function that converts the name into a GUID, but it [probably] wouldn't solve the language issue.