Aller au contenu

Photo

I need an event to trigger as soon as a plot flag is set.


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

#1
JackFuzz

JackFuzz
  • Members
  • 408 messages
I need access to an event from my own module that triggers as soon as a plot flag is set.

The split second a specific plot flag is set, I need to know and instantenously respond with certain actions.

How can I achieve this?  I have knowledge of overriding events but I failed when it came to overriding EVENT_TYPE_SET_PLOT

#2
Bibdy

Bibdy
  • Members
  • 1 455 messages
Create a custom plot script and assign it to your plot.

Then, create an event handler like so

#include "utility_h"
#include "wrappers_h"
#include "plot_h"

#include "plt_NAME_OF_PLOT_FILE"


int StartingConditional()
{
event eParms = GetCurrentEvent(); // Contains all input parameters
int nType = GetEventType(eParms); // GET or SET call
string strPlot = GetEventString(eParms, 0); // Plot GUID
int nFlag = GetEventInteger(eParms, 1); // The bit flag # being affected
object oParty = GetEventCreator(eParms); // The owner of the plot table for this script
object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
int nResult = FALSE; // used to return value for DEFINED GET events
object oPC = GetHero();

plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info

if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
{
int nValue = GetEventInteger(eParms, 2); // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
int nOldValue = GetEventInteger(eParms, 3); // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
// IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
switch(nFlag)
{
case NAME_OF_PLOT_FLAG:
{

// DO SOME SCRIPTING HERE

break;
}
}
}

return nResult;
}


Substitute in NAME_OF_PLOT_FILE and NAME_OF_PLOT_FLAG.

So, whenever NAME_OF_PLOT_FLAG is set, you do some scripting.

Modifié par Bibdy, 29 janvier 2010 - 07:07 .


#3
JackFuzz

JackFuzz
  • Members
  • 408 messages
so essentially we are replacing plot_core for my custom plot which is ok?

This sounds too good to be true, certainly there is some type of catch?

You're saying as soon as the plot flag is set, let's say from a conversation that those script actions will INSTANTLY take place?

Modifié par JackFuzz, 29 janvier 2010 - 07:29 .


#4
Challseus

Challseus
  • Members
  • 1 032 messages

JackFuzz wrote...

so essentially we are replacing plot_core for my custom plot which is ok?

This sounds too good to be true, certainly there is some type of catch?

You're saying as soon as the plot flag is set, let's say from a conversation that those script actions will INSTANTLY take place?


Yes Posted Image

#5
Bibdy

Bibdy
  • Members
  • 1 455 messages

JackFuzz wrote...

so essentially we are replacing plot_core for my custom plot which is ok?

This sounds too good to be true, certainly there is some type of catch?

You're saying as soon as the plot flag is set, let's say from a conversation that those script actions will INSTANTLY take place?


Exactabingo.

#6
JackFuzz

JackFuzz
  • Members
  • 408 messages

Bibdy wrote...

JackFuzz wrote...

so essentially we are replacing plot_core for my custom plot which is ok?

This sounds too good to be true, certainly there is some type of catch?

You're saying as soon as the plot flag is set, let's say from a conversation that those script actions will INSTANTLY take place?


Exactabingo.


This is working great. Thanks for your help.