Aller au contenu

Photo

How to trigger one plot flag only after completing two conditions?


16 réponses à ce sujet

#1
carmadaum

carmadaum
  • Members
  • 52 messages
 The idea is for the Player to have to recruit two followers before moving on in the quest. So I got a plot flag in the quest for each time a follower is recruited but how do I set it so the next plot flag, or next stage in the quest only happens after both of the followers flags are true and not just one. 

For right now i'm gonna do a little work around with setting up having one follower as a condition to get the other. Which means when I recruit the last one it then triggers the flag that takes the quest to the next stage. But I'd much rather the player not to have to recruit them in a certin order nnot to mention I'm sure i'm gonna find many instances where I'm gonna find myself needing to know how to set this up.

If anyone can answer my question or point me in the direction of a wiki page that explains this that i've missed it would be very helpful.

#2
tmp7704

tmp7704
  • Members
  • 11 156 messages
http://social.biowar.../index.php/Plot



the section on "Parent-Child plots" might be of help

#3
carmadaum

carmadaum
  • Members
  • 52 messages
I've got so far:

event eParms = GetCurrentEvent();

int nFlag = GetEventInteger(eParms, 1); // Plot flag

int nValue = GetEventInteger(eParms, 2); // 0=Clear 1=Set



switch(nFlag)

{

case BRAN_JOIN:

{

if (nValue)

{

if (WR_GetPlotFlag(PLT_GET_DANNAL, DANNAL_JOIN))

WR_SetPlotFlag(PLT_ATTACK_NALDIS_STRONGHOL, ASSEMBLE_MEN, 1, TRUE);

}

break;

}

}

But I keep getting E: 20:06:22 - gh.nss - gh.nss(5): Invalid declaration type


#4
tmp7704

tmp7704
  • Members
  • 11 156 messages
That means error in line 5 of the script. If it happens to be the one with "case BRAN_JOIN", are you including the plot file in your script? It's discussed earlier on that page, under "Scripting".

#5
carmadaum

carmadaum
  • Members
  • 52 messages
I do have the plots included at the top. I'm no longer getting that same error but now I'mg getting that (switch(nflag) is an invalid declaration type.
         #include "plt_attack_naldis_stronghol"  
#include "plt_get_dannal"   
#include "plt_get_bran"
event eParms = GetCurrentEvent();    int   nFlag  = GetEventInteger(eParms, 1); // Plot flag    int   nValue = GetEventInteger(eParms, 2); // 0=Clear 1=Set
      switch(nFlag)        {          case BRAN_JOIN:            {              if (nValue)                {                   if (WR_GetPlotFlag(PLT_GET_DANNAL, DANNAL_JOIN))                     WR_SetPlotFlag(PLT_ATTACK_NALDIS_STRONGHOL, ASSEMBLE_MEN, 1, TRUE);                }              break;            }        }

Modifié par carmadaum, 22 avril 2010 - 01:44 .


#6
carmadaum

carmadaum
  • Members
  • 52 messages
arggg i can't get the thing to paste in right

Modifié par carmadaum, 22 avril 2010 - 01:46 .


#7
Sunjammer

Sunjammer
  • Members
  • 925 messages
You don't really need a parent-child arrangement: just a handy way show the state of multiple tasks (on the subject of which you might be interested in this demo I just uploaded). However if there are only two companions you can easily do it with a single plot (since when it is partially complete it is either one or the other).

Still since you are going down this road we might as well continue ...

The snippet you copied is incomplete. You need something more like this (I can't promise it is correct as I can't compile it without your plots):

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

#include "plt_attack_naldis_stronghol"  
#include "plt_get_dannal"   
#include "plt_get_bran"


int StartingConditional()
{
    event eParms = GetCurrentEvent(); 
    int nType =  GetEffectType(eParams);
    int nFlag  = GetEventInteger(eParms, 1); 

    if(nType == EVENT_TYPE_SET_PLOT)
    {
        switch(nFlag)        
        {
            case BRAN_JOIN:
            {
                if(WR_GetPlotFlag(PLT_GET_DANNAL, DANNAL_JOIN))
                {
                    WR_SetPlotFlag(PLT_ATTACK_NALDIS_STRONGHOL, ASSEMBLE_MEN, TRUE, TRUE); 
                }
                break;            
            }
        }
    }
}

Modifié par Sunjammer, 22 avril 2010 - 02:15 .


#8
tmp7704

tmp7704
  • Members
  • 11 156 messages
You might want to open a plot-related script for reference, something like say, genpt_alistair_events.nss
The whole part after #include section (the one which starts with "event..." should be part of a function with int as return value. in other words, should be more like:

#include "whatever"

int StartingConditional()
{
event eParms = GetCurrentEvent();
int nFlag = GetEventInteger(eParms, 1); // Plot flag
int nValue = GetEventInteger(eParms, 2); // 0=Clear 1=Set
int nResult = FALSE;

switch(nFlag)
// etc...
}

without it the compiler thinks you're just declaring variables, and treats the switch() call as such.

edit: blah, took too long to type Posted Image

Modifié par tmp7704, 22 avril 2010 - 02:23 .


#9
carmadaum

carmadaum
  • Members
  • 52 messages
Thanks for the input. haven't tried it out yet (proboly cause it's 2:30 a.m and I just got home from the bar...heheh...weeee) but I will in the morning. I will let you know.

#10
bowlie1

bowlie1
  • Members
  • 51 messages
why not make 2 flags?

#11
Sunjammer

Sunjammer
  • Members
  • 925 messages

bowlie1 wrote...

why not make 2 flags?

If you were using a single quest that would be how you would do it. You would have somthing like:
  • COMPANIONS_HIRED_A: journal entry saying "You convinced A to join but you still need to talk to B"
  • COMPANIONS_HIRED_B: journal entry saying "You convinced B to join but you still need to
    talk to A"
  • COMPANIONS_HIRED_BOTH: journal entry saying "You have successfully convinced A and B to join"
And when you set either A or B you would check to see if the other was already set and if it was you would then set BOTH.

However if you are using a parent-child relationship then you create two plots: one for A and one for B. Each of those would have an "accepted" flag (TO_HIRE) and a "completed" flag (HIRED) and in the parent plot you would also have a "completed" flag (HIRED_BOTH). Whenever you set one of the child "completed" flags you check the other. If both are "completed" you set the parent "completed" flag.

This approach doesn't really offer any advantage where there are only two tasks however imagine trying to handle the permutations for 4 or 5 tasks in a single plot!

Modifié par Sunjammer, 22 avril 2010 - 12:16 .


#12
Magic

Magic
  • Members
  • 187 messages
In case you need to check for two plot flags in a conversation only, you can just check for them sequentially, i.e. one check in the NPC node, leave PC node empty, then the second check in the next NPC node. This is very nice in the DA:O toolset.

[NPC] (Check for Bran)
- [PC]
-- [NPC] (Check for Dannal) The stronghold awaits you!
-- [NPC] Go look for Dannal!
[NPC] (Check for Dannal) Go look for Bran!
[NPC] You cannot do this alone ...

Hopefully, this makes sense.

#13
carmadaum

carmadaum
  • Members
  • 52 messages
Some times it takes a village i guess but I plugged in the script sunjammer provided and i get an error line (13): Variable defined without type (while compiling var_constants_h.nss). 

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

#include "plt_attack_naldis_stronghol"  
#include "plt_get_dannal"   
#include "plt_get_bran"


int StartingConditional()
{
    event eParms = GetCurrentEvent(); 
    int nType =  GetEffectType(eParams);
    int nFlag  = GetEventInteger(eParms, 1); 

    if(nType == EVENT_TYPE_SET_PLOT)
    {
        switch(nFlag)        
        {
            case BRAN_JOIN:
            {
                if(WR_GetPlotFlag(PLT_GET_DANNAL, DANNAL_JOIN))
                {
                    WR_SetPlotFlag(PLT_ATTACK_NALDIS_STRONGHOL, ASSEMBLE_MEN, TRUE, TRUE); 
                }
                break;            
            }
        }
    }
}
[/quote]
I would have played with it a little more before posting but.. I still have a hangover from last night. I tap out for the day, haha

Modifié par carmadaum, 23 avril 2010 - 04:26 .


#14
_L_o_B_o_

_L_o_B_o_
  • Members
  • 117 messages

carmadaum wrote...

Some times it takes a village i guess but I plugged in the script sunjammer provided and i get an error line (13): Variable defined without type (while compiling var_constants_h.nss). 

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

#include "plt_attack_naldis_stronghol"  
#include "plt_get_dannal"   
#include "plt_get_bran"


int StartingConditional()
{
    event eParms = GetCurrentEvent(); 
    int nType =  GetEffectType(ePar[b]a[/b]ms);
    int nFlag  = GetEventInteger(eParms, 1); 
    ...
   


Variable eParms is declared, but in GetEffectType(eParams) there is an extra "a" causing the compiling error.

Moreover, you can't get an effect type from an event, so you should use GetEventType(eParms) instead of GetEffectType(eParms) 

And finally since the function declaration says that it returns an int, you should do it.

Modifié par _L_o_B_o_, 23 avril 2010 - 08:06 .


#15
carmadaum

carmadaum
  • Members
  • 52 messages
Its now telling me that not all return paths return a value line 10: "int StartingConditional()"

#16
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Plot scripts need a return value. To make the error go away, you can put return 0; at the end of the script, just inside the last }

If you ever add defined conditions into the plot, you'll want to set up a return variable, something like:

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

#include "plt_attack_naldis_stronghol"
#include "plt_get_dannal"
#include "plt_get_bran"


int StartingConditional()
{
event eParms = GetCurrentEvent();
int nType = GetEffectType(eParams);
int nFlag = GetEventInteger(eParms, 1);

int bResult = FALSE;

if(nType == EVENT_TYPE_SET_PLOT)
{
switch(nFlag)
{
case BRAN_JOIN:
{
if(WR_GetPlotFlag(PLT_GET_DANNAL, DANNAL_JOIN))
{
WR_SetPlotFlag(PLT_ATTACK_NALDIS_STRONGHOL, ASSEMBLE_MEN, TRUE, TRUE);
}
break;
}
}
}

if(nType == EVENT_TYPE_GET_PLOT)
{
switch (nFlag)
{

}
}

return bResult;
}

Modifié par DavidSims, 23 avril 2010 - 08:29 .


#17
carmadaum

carmadaum
  • Members
  • 52 messages
I'd like to thank the academy..... ahhh.. I mean. thanks to everyone who helped me out! Thanks very much!

Here is the end result :

#include "plot_h"#include "utility_h"#include "wrappers_h"
#include "plt_attack_naldis_stronghol"#include "plt_find_bran"#include "plt_find_dannal"

int StartingConditional(){event eParms = GetCurrentEvent();int nType = GetEventType(eParms);int nFlag = GetEventInteger(eParms, 1);
int bResult = FALSE;
if(nType == EVENT_TYPE_SET_PLOT){switch(nFlag){case FOUND_BRAN:{if(WR_GetPlotFlag(PLT_FIND_DANNAL, FOUND_DANNAL)){WR_SetPlotFlag(PLT_ATTACK_NALDIS_STRONGHOL, ASSEMBLE_MEN, TRUE, TRUE);}break;}}}
if(nType == EVENT_TYPE_GET_PLOT){switch (nFlag){
}}
return bResult;}

Modifié par carmadaum, 23 avril 2010 - 10:32 .