Is it possible to listen for a plot flag to be set and immediately run another script ***without constant/frequent plot checking***?
Is it possible...
Débuté par
Karma
, août 04 2011 12:59
#1
Posté 04 août 2011 - 12:59
#2
Posté 04 août 2011 - 07:31
Yes. Some generic scripts are run by toggling a plot flag that runs a script and toggles it off again. Like the one that opens creaturetag_store. I suggest you take a look at:
http://social.biowar...t_event_scripts
http://social.biowar...t_event_scripts
#3
Posté 04 août 2011 - 08:21
What I would like to do is listen for a vanilla plot flag to be set and then have it automatically set a plot flag from my mod (which then of course does something else). I don't want to override the vanilla plot's script.
I should have been more clear in my first post. Sorry.
I should have been more clear in my first post. Sorry.
#4
Posté 06 août 2011 - 02:22
I'm not sure if you can make a true object/observer data structure within the scripting system. Maybe someone with more experience can answer that question.
There is an "Event_Plot_Flag_ something or other", but it lives down in scripts.ldf, so you probably don't want to change that directly - though setting up an "observer" for whenever that script/event does get called would be a nice solution.
You can also dig through the scripts and conversations and find out exactly where that plot flag gets set, and put calls to your script immediately following each one. That's the "brute force" approach, but it will work.
If you (or anyone else) figures out how to create an observer, please post it. I'm sure it would come in handy for loads of situations (and that is by far the "best" solution, if possible)
There is an "Event_Plot_Flag_ something or other", but it lives down in scripts.ldf, so you probably don't want to change that directly - though setting up an "observer" for whenever that script/event does get called would be a nice solution.
You can also dig through the scripts and conversations and find out exactly where that plot flag gets set, and put calls to your script immediately following each one. That's the "brute force" approach, but it will work.
If you (or anyone else) figures out how to create an observer, please post it. I'm sure it would come in handy for loads of situations (and that is by far the "best" solution, if possible)
#5
Posté 06 août 2011 - 02:30
Normally you can use RegisterEventListener to make a one object listen for events on another object. When the object being "listened to" receives an event, that event is also passed to the "listener" object and can be handled by the "listener" object's script.
Unfortunately this technique does not appear to apply to plot flags as there does not appear to be an associated object to register the listener on. It should be the party object however in my tests (in both SP add-in modules and stand-alone modules) GetParty returns an invalid object. For reference I've also tried the module and the player without success, though to be fair, they were just shots in the dark.
In order to captuer changes in plot flags without constant polling you might find the game mode changed module event helpful.
Unfortunately this technique does not appear to apply to plot flags as there does not appear to be an associated object to register the listener on. It should be the party object however in my tests (in both SP add-in modules and stand-alone modules) GetParty returns an invalid object. For reference I've also tried the module and the player without success, though to be fair, they were just shots in the dark.
In order to captuer changes in plot flags without constant polling you might find the game mode changed module event helpful.
Modifié par Sunjammer, 06 août 2011 - 02:34 .
#6
Posté 06 août 2011 - 06:09
Seeing RegisterEventListener is exactly what prompted this question. I wanted to set my module object up as the listener for the EVENT_TYPE_SET_PLOT, but doubted the module would/could/should listen for that event. I also didn't know what the target should be. I tried it to no avail. Then I saw this thread.
I thought maybe EVENT_TYPE_PLOT_COMPLETED could be used in certain situations, but not all the flags I want to listen for are completed flags.
I'm assuming for the EVENT_TYPE_GAMEMODE_CHANGED, I'd do something like if the game mode changed from dialog to explore and the vanilla plot flag is true but my plot flag is false, then run the script and set my plot flag as true??? Or were you thinking something else?
I thought maybe EVENT_TYPE_PLOT_COMPLETED could be used in certain situations, but not all the flags I want to listen for are completed flags.
I'm assuming for the EVENT_TYPE_GAMEMODE_CHANGED, I'd do something like if the game mode changed from dialog to explore and the vanilla plot flag is true but my plot flag is false, then run the script and set my plot flag as true??? Or were you thinking something else?
#7
Posté 06 août 2011 - 09:18
Your assumption is correct. If you have a number of flags to check you can use additional logic to restrict when you check each flag. For example if the conversations are area specific you could arrange the plog flag checks them in a swich using the AREA_ID local variable. Doing something like this shouldn't really affect anything other than the reduce amount of plot flag spam in the log files!satans_karma wrote...
I'm assuming for the EVENT_TYPE_GAMEMODE_CHANGED, I'd do something like if the game mode changed from dialog to explore and the vanilla plot flag is true but my plot flag is false, then run the script and set my plot flag as true??? Or were you thinking something else?
Further to my earlier observations, I tested GetPartyPlotFlag and SetPartyPlotFlag passing in OBJECT_INVALID as the oParty parameter and the plot flags were return or modified correct. It appears the oParty parameter is entirely redundant!
Modifié par Sunjammer, 06 août 2011 - 09:20 .
#8
Posté 08 août 2011 - 03:31
On a side note, what exactly does the function TrackPlotEvent do? I mean, obviously it tracks the plot, but what properties does it track and what is it used for other than how it is used in WR_SetPlotFlag? It doesn't give any description of this function in the Help menu.





Retour en haut







