I need a script that checks to see if two plot conditions have been met before spawning a creature in an area. Is this possible? If so, how do I script this?
I tried:
[dascript]
#include "plt_gen00pt_party_kc"
#include "wrappers_h"
void main()
{
if (WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_RECRUITED) == TRUE)
{
if (WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_IN_CAMP) == FALSE)
{
object oCamp = GetObjectByTag("cam100ar_camp_plains");
vector vCullenLocation = Vector(138.564f, 111.815f, -1.08586f);
CreateObject(OBJECT_TYPE_CREATURE, R"kc_cir230cr_cullen.utc", Location(oCamp, vCullenLocation, -65.1f));
WR_SetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_IN_CAMP, TRUE);
}
}
}
[/dascript]
Once I put the second "if" statement in there, it no longer functions. How do I write "and" in DA language?
Two conditionals?
Débuté par
Karma
, juin 25 2010 02:02
#1
Posté 25 juin 2010 - 02:02
#2
Posté 25 juin 2010 - 02:24
As soon as I posted the above, I thought of just stringing the two if statements together. I got rid of the { between the two ifs (as well as one at the end). It seemed to spawn the creature (Cullen) only once, but I can't quite tell if it's double-spawning because he would spawn in the exact same place with the exact same movement patterns. In theory, should
if (WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_RECRUITED) == TRUE)
if (WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_IN_CAMP) == FALSE)
work as a check for both conditionals?
if (WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_RECRUITED) == TRUE)
if (WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_IN_CAMP) == FALSE)
work as a check for both conditionals?
#3
Posté 25 juin 2010 - 03:21
The code in your first post looks like it should do what you want. For the record, the DA scripting language is much like a simplified C.
and :
if (something && somethingElse)
{
//do stuff
}
or:
if (something || somethingElse)
{
//do stuff
}
If you remove the brackets, then the condition applies only to the next instruction.
and :
if (something && somethingElse)
{
//do stuff
}
or:
if (something || somethingElse)
{
//do stuff
}
If you remove the brackets, then the condition applies only to the next instruction.
#4
Posté 25 juin 2010 - 06:36
It seems to be working. Thanks!
#5
Posté 29 juin 2010 - 09:34
I'm having two problems:
First:
I tweaked the code above and applied it to another script, and now the new script doesn't work anymore. Same problem as before - it likes one conditional but not two.
[dascript]
#include "wrappers_h"
#include "utility_h"
#include "plt_cir000pt_main"
#include "plt_gen00pt_party_kc"
void main()
{
if(WR_GetPlotFlag(PLT_CIR000PT_MAIN, BROKEN_CIRCLE_PLOT_DONE) == TRUE && WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_CREATED) == FALSE)
{
object oTower = GetObjectByTag("cir200ar_tower_level_1");
vector vLibrary = Vector(4.58348f, -7.10341f, 0.0f);
Safe_Destroy_Object(GetObjectByTag("cir230cr_cullen"));
CreateObject(OBJECT_TYPE_CREATURE, R"kc_cir230cr_cullen.utc", Location(oTower, vLibrary, 90.0f));
WR_SetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_CREATED, TRUE);
}
}
[/dascript]
I've tried a bunch of different permutations of the two conditionals, but to no avail.
Unless I'm missing an include or some sort of event handling, I have no idea what the issue is.
Second:
My custom char_stage worked when I had a module event script and a hiring script, but using that method required overriding Cullen's original dialogue (which was causing weirdness with the animations). I implemented the above script as an intermediate PRCSCR area script to destroy the old cullen and create the new one. Unfortunately, it also made the custom char_stage stop working. I can no longer hire him. Does an area script override a module event script?
It seems that when I get one piece to work (better), something else stops working.
First:
I tweaked the code above and applied it to another script, and now the new script doesn't work anymore. Same problem as before - it likes one conditional but not two.
[dascript]
#include "wrappers_h"
#include "utility_h"
#include "plt_cir000pt_main"
#include "plt_gen00pt_party_kc"
void main()
{
if(WR_GetPlotFlag(PLT_CIR000PT_MAIN, BROKEN_CIRCLE_PLOT_DONE) == TRUE && WR_GetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_CREATED) == FALSE)
{
object oTower = GetObjectByTag("cir200ar_tower_level_1");
vector vLibrary = Vector(4.58348f, -7.10341f, 0.0f);
Safe_Destroy_Object(GetObjectByTag("cir230cr_cullen"));
CreateObject(OBJECT_TYPE_CREATURE, R"kc_cir230cr_cullen.utc", Location(oTower, vLibrary, 90.0f));
WR_SetPlotFlag(PLT_GEN00PT_PARTY_KC, GEN_CULLEN_CREATED, TRUE);
}
}
[/dascript]
I've tried a bunch of different permutations of the two conditionals, but to no avail.
Unless I'm missing an include or some sort of event handling, I have no idea what the issue is.
Second:
My custom char_stage worked when I had a module event script and a hiring script, but using that method required overriding Cullen's original dialogue (which was causing weirdness with the animations). I implemented the above script as an intermediate PRCSCR area script to destroy the old cullen and create the new one. Unfortunately, it also made the custom char_stage stop working. I can no longer hire him. Does an area script override a module event script?
It seems that when I get one piece to work (better), something else stops working.





Retour en haut






