Aller au contenu

Photo

(Resolved) Multiple Plots Open - How can I tell them apart in a script?


3 réponses à ce sujet

#1
Tensor07

Tensor07
  • Members
  • 11 messages
I'll try to explain this as best as i can so bare with me.

Scenario:

1 Area
2 Plots
1 Script assigned to the Area.

I want to change the flag to a plot flag via script. However the problem is I can't capture which plot is firing the event.  The example below works fine if only one plot existed. In my experience I cannot have one switch statement contain plot flags from 2 distinct plots. If you do this the variable nFlag(The bit flag # being affected) will run into a problem because of duplicate Plot Flags. Therefore i'm assuming i'll need to have two switch statements (one for each Plot) and use a condition to determine which Plot is firing/calling the event. I tried using the Plot GUID but no luck so far.  I'm guessing this is easy and i'm just missing something.  So if someone can shed some light on this one i would greatly appreciate it.  Thanks again

Example:

int StartingConditional()
{
    event ev = GetCurrentEvent(); // Gets Current Event Type
    int nEventType = GetEventType(ev); // Set event to nEventType
    int nEventHandled = FALSE; //keep track of whether the event has been handled
    string strPlot = GetEventString(ev, 0); // Plot GUID ----> Tried to use this but could not get it to work
    int nFlag = GetEventInteger(ev, 1);     // The bit flag # being affected
    int nResult = FALSE; // used to return value for DEFINED GET events
    object oPC = GetHero();
    object oParty = GetParty(oPC);
   
    plot_GlobalPlotHandler(ev); // any global plot operations
    if(nEventType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
    {
        int nValue = GetEventInteger(ev, 2);
        int nOldValue = GetEventInteger(ev, 3);       
        switch(nFlag) // for Plot 1
        {
            case QUEST_ACCEPT:
              {UT_TeamAppears(1);}
         }

Modifié par Tensor07, 29 décembre 2009 - 09:10 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Plot scripts are attached to plots, not to areas. When a plot flag is set, or a defined flag checked, it runs the associated plot script, not the area script. I highly recommend having separate plot scripts for each plot.

That said, I'm pretty sure it is possible to use the plot GUID that you've highlighted there to differentiate between plots in a single script, but I don't know how it's done off the top of my head. I think the party approval system works on that basis, so that's where I'd look for an example. But again, separate plot scripts is the way to go.

Modifié par DavidSims, 29 décembre 2009 - 04:54 .


#3
Proleric

Proleric
  • Members
  • 2 352 messages
What David said.

If you really must differentiate between plots in a common plot script,
string strPlot = GetEventString(eParms, 0); // Plot GUID
if (strPlot == GetPlotGUID("my_plot")) // do stuff for my_plot etc
and give your plot flags unique names.

Modifié par Proleric1, 29 décembre 2009 - 07:11 .


#4
Tensor07

Tensor07
  • Members
  • 11 messages
Thanks David and Proleric for clearing this up. I previously used some bad advice and made things harder than they should have been but i learned a lot in the process. It all makes sense now!

Thanks again and until next time. :)