PDA

View Full Version : Kreia/Atris confrontation script issues


Weavel
08-10-2009, 03:06 PM
Ok, the script should be pretty self explanatory, but just in case this it what it SHOULD do:

Case 0:
Check if player is male or female

{if Male}
Set the player character as Kreia, then spawn Atris and Brianna, delete the KreiaEvil creature that spawns on module load, and then launch atrisfall.dlg

{if Female}
Set the player character as Kreia, spawn Atris, delete the KreiaEvil creature that spawns on module load, move the Player Kreia to KreiaEvil's WP, and then launch atrisfall.dlg


And that is what isn't working.

// Atris Fall Script by Weavel

//Prototypes
void KreiaJump();

void KreiaJump() {
DelayCommand(0.2, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("wp_kreia_end"), 1)));
SetMinOneHP(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), ClearAllActions());
AssignCommand(GetPartyLeader(), ActionStartConversation(GetPartyLeader(), "atrisfall", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));

}


void main() {
int nParam1 = GetScriptParameter(1);
object oAtris = GetObjectByTag("Atris", 0);
object oKreiaEvil = GetObjectByTag("KreiaEvil", 0);
object oHandmaiden = GetObjectByTag("Handmaiden", 0);
switch (nParam1) {
case 0:

if (GetGlobalBoolean("000_PLAYER_GENDER")) {
SwitchPlayerCharacter(NPC_KREIA);
SetNPCSelectability(NPC_KREIA, 1);
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("wp_atris_atrend1")), 0);
CreateObject(1, "p_handmaiden", GetLocation(GetWaypointByTag("sp_hand_atrend1")), 0);
DelayCommand(2.0, AssignCommand(GetPartyLeader(), ActionStartConversation(GetPartyLeader(), "atrisfall", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0)));
DelayCommand(2.0, DestroyObject(oKreiaEvil, 0.0, 0, 0.0, 0));
DelayCommand(2.5, SetGlobalFadeIn(0.1, 2.0, 0.0, 0.0, 0.0));

}
else {
SetNPCSelectability(NPC_KREIA, 1);
SwitchPlayerCharacter(NPC_KREIA);
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("sp_traya")), 0);
DelayCommand(2.0, KreiaJump());
DelayCommand(2.0, DestroyObject(oKreiaEvil, 0.0, 0, 0.0, 0));
DelayCommand(2.5, SetGlobalFadeIn(0.1, 2.0, 0.0, 0.0, 0.0));
break;

case 1:
DelayCommand(0.2, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("sp_pc_atrend2"), 1)));
SetMinOneHP(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), ClearAllActions());
break;
case 2:
SetLockOrientationInDialog(oAtris, 1);
SetLockOrientationInDialog(oKreiaEvil, 1);
AssignCommand(oKreiaEvil, SetFacing(270.0));
break;
case 3:
AssignCommand(oKreiaEvil, ActionMoveToObject(GetWaypointByTag("wp_kreia_end2"), 0, 1.0));
break;
case 4:
AssignCommand(oAtris, SetFacing(90.0));
break;

case 5: //Launches Kreia/Atris into battle
ChangeToStandardFaction(oAtris, 1);
ExecuteScript("k_ai_master",oAtris,1005);

break;
}
}
}

Star Admiral
08-10-2009, 03:44 PM
So none of the parts in Case 0 execute at all? Do Cases 1-5 work? You might want to try adding braces:

case 0: {
// stuff
}
case 1: {
// stuff
}

...and so on.

You should also rename the sub1() function to something else. You can't have two functions with the same name and the same types of parameters.

- Star Admiral

Weavel
08-10-2009, 04:03 PM
The other cases work, and at one point when I had Case 0 changing the player to the handmaiden it would work.

Now I can't get it to compile
KT's error:

a_atrisfall.sss:(42): Warning: "case" and "default" statements should be specified inside a "switch" statement
a_atrisfall.sss:(47): Warning: "case" and "default" statements should be specified inside a "switch" statement
a_atrisfall.sss:(52): Warning: "case" and "default" statements should be specified inside a "switch" statement
a_atrisfall.sss:(55): Warning: "case" and "default" statements should be specified inside a "switch" statement
a_atrisfall.sss:(59): Warning: "case" and "default" statements should be specified inside a "switch" statement

Star Admiral
08-10-2009, 10:36 PM
Try this:

// Atris Fall Script by Weavel

//Prototypes
void KreiaJump() {
DelayCommand(0.2, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("wp_kreia_end"), 1)));
SetMinOneHP(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), ClearAllActions());
AssignCommand(GetPartyLeader(), ActionStartConversation(GetPartyLeader(), "atrisfall", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}

void main() {
int nParam1 = GetScriptParameter(1);
object oAtris = GetObjectByTag("Atris", 0);
object oKreiaEvil = GetObjectByTag("KreiaEvil", 0);
object oHandmaiden = GetObjectByTag("Handmaiden", 0);
switch (nParam1) {
case 0: {
if (GetGlobalBoolean("000_PLAYER_GENDER")) {
SwitchPlayerCharacter(NPC_KREIA);
SetNPCSelectability(NPC_KREIA, 1);
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("wp_atris_atrend1")), 0);
CreateObject(1, "p_handmaiden", GetLocation(GetWaypointByTag("sp_hand_atrend1")), 0);
DelayCommand(2.0, AssignCommand(GetPartyLeader(), ActionStartConversation(GetPartyLeader(), "atrisfall", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0)));
DelayCommand(2.0, DestroyObject(oKreiaEvil, 0.0, 0, 0.0, 0));
DelayCommand(2.5, SetGlobalFadeIn(0.1, 2.0, 0.0, 0.0, 0.0));
}
else {
SetNPCSelectability(NPC_KREIA, 1);
SwitchPlayerCharacter(NPC_KREIA);
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("sp_traya")), 0);
DelayCommand(2.0, KreiaJump());
DelayCommand(2.0, DestroyObject(oKreiaEvil, 0.0, 0, 0.0, 0));
DelayCommand(2.5, SetGlobalFadeIn(0.1, 2.0, 0.0, 0.0, 0.0));
break;
}
}
case 1: {
DelayCommand(0.2, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("sp_pc_atrend2"), 1)));
SetMinOneHP(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), ClearAllActions());
break;
}
case 2: {
SetLockOrientationInDialog(oAtris, 1);
SetLockOrientationInDialog(oKreiaEvil, 1);
AssignCommand(oKreiaEvil, SetFacing(270.0));
break;
}
case 3: {
AssignCommand(oKreiaEvil, ActionMoveToObject(GetWaypointByTag("wp_kreia_end2"), 0, 1.0));
break;
}
case 4: {
AssignCommand(oAtris, SetFacing(90.0));
break;
}
case 5: {
//Launches Kreia/Atris into battle
ChangeToStandardFaction(oAtris, 1);
ExecuteScript("k_ai_master",oAtris,1005);
break;
}
}
}

- Star Admiral

Weavel
08-11-2009, 07:31 AM
Ok, it compiles now, and it starts to run, but then crashes:


// Atris Fall Script by Weavel

//Prototypes
void sub2();
void sub1();


void sub2() {
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("sp_traya")), 0);
DelayCommand(0.2, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("wp_kreia_end"), 1)));
SetMinOneHP(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), ClearAllActions());
AssignCommand(GetPartyLeader(), ActionStartConversation(GetPartyLeader(), "atrisfall", 0, 0, 0, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));

}

void sub1() {
SwitchPlayerCharacter(6);
}

void main() {
int nParam1 = GetScriptParameter(1);
object oAtris = GetObjectByTag("Atris", 0);
object oKreiaEvil = GetObjectByTag("KreiaEvil", 0);
switch (nParam1) {
case 0: {
if (GetGlobalBoolean("000_PLAYER_GENDER")) {
SetNPCSelectability(6, 1);
CreateObject(1, "n_darthtraya001", GetLocation(GetWaypointByTag("wp_atris_atrend1")), 0);
object oHandmaiden = CreateObject(1, "p_handmaiden", GetLocation(GetObjectByTag("sp_hand_atrend1", 0)), 0);
DelayCommand(0.5, DestroyObject(oKreiaEvil, 0.0, 0, 0.0, 0));
DelayCommand(1.0, ActionStartConversation(GetFirstPC(),"atrisfall"));
DelayCommand(1.5, SetGlobalFadeIn(0.1, 2.0, 0.0, 0.0, 0.0));
}
else {
SetNPCSelectability(6, 1);
DelayCommand(1.0, sub1());
DelayCommand(2.0, sub2());
DelayCommand(2.0, DestroyObject(oKreiaEvil, 0.0, 0, 0.0, 0));
DelayCommand(2.5, SetGlobalFadeIn(0.1, 2.0, 0.0, 0.0, 0.0));
break;
}
}
case 1: {
sub1();
DelayCommand(0.2, AssignCommand(GetPartyLeader(), ActionJumpToObject(GetWaypointByTag("sp_pc_atrend2"), 1)));
SetMinOneHP(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), ClearAllActions());
break;
}
case 2: {
SetLockOrientationInDialog(oAtris, 1);
SetLockOrientationInDialog(GetPartyLeader(), 1);
AssignCommand(GetPartyLeader(), SetFacing(270.0));
break;
}
case 3: {
AssignCommand(GetPartyLeader(), ActionMoveToObject(GetWaypointByTag("wp_kreia_end2"), 0, 1.0));
break;
}
case 4: {
AssignCommand(oAtris, SetFacing(90.0));
break;
}
case 5: {
//Launches Kreia/Atris into battle
ChangeToStandardFaction(oAtris, 1);
ExecuteScript("k_ai_master",oAtris,1005);
break;
}
}
}

Darth InSidious
08-11-2009, 09:54 AM
If you're using the case function, you need a break after it. Like this:


case 0:
{
//Do stuff.
}
break;

case 1:
{
//Do stuff.
}
break;


That's how the game's scripts use them, anyway.

Star Admiral
08-11-2009, 09:56 AM
:migraine:

Totally forgot to put the break outside of the braces. Silly me.

- Star Admiral