Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Master fight setup script/Vrook user define script.

Page: 1 of 1
 Darth Balor
09-17-2007, 2:47 PM
#1
Well, I'm trying to move the fight with vrook from the entrance to 602DAN to the hallway infront of Terena Adare's room. Below is the script that should place the fight there. Thing is though it crashes the game.


// a_master_setup
// DJS-OEI 9/7/2004
// Param1 - Flag to indicate if PC2 and PC3 should leave the party.
// 0 = Yes, 1 = No.
// This script sets up the positioning of the Jedi Master and the
// player as necesasry for the scene. The Local Number 12 on the
// owner of this dialogue determines which Master we're working with.
// 1 = Kavar
// 2 = Vrook
// 3 = Zaz-Kai Ell

#include "k_inc_generic"
#include "k_inc_glob_party"

void ClearNPC()
{
GN_SetSpawnInCondition(SW_FLAG_AI_OFF,TRUE);
ClearAllActions();
}

void main()
{
int bRetainPCs = GetScriptParameter( 1 );
object oWay;
location lWay;

object oInvisoKreia = GetObjectByTag( "InvisoKreia" );
object oMaster = OBJECT_INVALID;
// First, check if we're teaching a Form, and then
// check to see if we're killing the Jedi Master instead.
int nLocalNum = GetLocalNumber( oInvisoKreia, 16 );
if( nLocalNum == 0 ) {
nLocalNum = GetLocalNumber( oInvisoKreia, 12 );
}
object oDoor = OBJECT_INVALID;
switch( nLocalNum ) {
case 1:
{
oMaster = GetObjectByTag( "kavar" );

// Do any Kavar-specific setup here.
break;
}
case 2:
{
IMaster = GetObjectByTag( "npc_vrook" );

// Set the Area to Unescapable so the player can't bring
// in party members.
SetAreaUnescapable( TRUE );

// Close and lock the doors to this room if
// we're doing the battle.
if( !bRetainPCs ) {
oDoor = GetObjectByTag( "ao_door" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door1" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door2" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
}
break;
}
case 3:
{
oMaster = GetObjectByTag( "zezkaiel" );

// Do any Zez-Kai Ell-specific setup here.
// Set the Area to Unescapable so the player can't bring
// in party members.
SetAreaUnescapable( TRUE );

// Close and lock the secret door.
oDoor = GetObjectByTag( "Flophouse_Secret" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
}
break;
}

if( GetIsObjectValid( oMaster ) ) {
ActionPauseConversation();

// This is the cutscene where the Jedi Master
// confronts the player and starts combat.

SetGlobalFadeIn( 0.0, 2.0 );

// Set the player's character as the party leader.
SetPartyLeader( NPC_PLAYER );

oWay = GetWaypointByTag( "WP_MASTER_CUT_MASTER" );
lWay = GetLocation( oWay );
AssignCommand( oMaster, JumpToLocation( lWay ) );

// Place vrook at his mark.
location lMaster = Location(Vector (-10.87173, (-5.88733), 7.50000), 0.0);
DelayCommand(1.0, AssignCommand(IMaster, ActionJumpToLocation(lMaster)));

// Place the vrook duel player at his/her mark.
object iPC = GetFirstPC();
if( !GetIsObjectValid( IPC ) ) {
AurPostString( "Could not find Player's Character to set up cutscene positioning.", 10, 10, 2.0 );

// Place the player at his/her mark.
object oPC = GetFirstPC();
if( !GetIsObjectValid( oPC ) ) {
AurPostString( "Could not find Player's Character to set up cutscene positioning.", 10, 10, 2.0 );
return;
}
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC1" );
lWay = GetLocation( oWay );
AssignCommand( oPC, JumpToLocation( lWay ) );

if( !bRetainPCs ) {
// Remove the two other party members from the party
// for the duration of the battle and set them
// to Neutral. Store their NPC IDs in this object's
// Local Number 13 and 14 (99 for empty slots) so
// we can re-add them after the combat is over.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
AurPostString( "Storing PC2.", 10, 10, 3.0 );
// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC2 ) );
SetLocalNumber( oInvisoKreia, 13, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC2,ClearNPC() );
ChangeToStandardFaction( oPC2,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC2, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
AssignCommand( oPC2, ActionDoCommand( SetCommandable( FALSE, oPC2 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 13 ) ), 10, 10, 3.0 );
}
if( GetIsObjectValid( oPC3 ) ) {
AurPostString( "Storing PC3.", 10, 11, 3.0 );

// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC3 ) );
SetLocalNumber( oInvisoKreia, 14, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC3,ClearNPC() );
ChangeToStandardFaction( oPC3,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC3, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
AssignCommand( oPC3, ActionDoCommand( SetCommandable( FALSE, oPC3 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 14, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 14 ) ), 10, 11, 3.0 );
}
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
SetLocalNumber( oInvisoKreia, 14, 99 );
// Just move the other PCs.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
}
if( GetIsObjectValid( oPC3 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
}
}
DelayCommand( 2.0, ActionResumeConversation() );
}
}


And this script is supposed to make it so that when he reaches 1hp instead of the drain dialog playing it plays vrook_capture.dlg, but it doesn't work. It just ends the fight.


// Globals
int intGLOB_1 = 1;
int intGLOB_2 = 2;
int intGLOB_3 = 3;
int intGLOB_4 = 4;
int intGLOB_5 = 5;
int intGLOB_6 = 6;
int intGLOB_7 = 3;
int intGLOB_8 = 4;
int intGLOB_9 = 5;
int intGLOB_10 = 6;
int intGLOB_11 = 7;
int intGLOB_12 = 8;
int intGLOB_13 = 9;
int intGLOB_14 = 10;
int intGLOB_15 = 11;
int intGLOB_16 = 1;
int intGLOB_17 = 2;
int intGLOB_18 = 3;
int intGLOB_19 = 4;
int intGLOB_20 = 5;
int intGLOB_21 = 6;
int intGLOB_22 = 7;
int intGLOB_23 = 8;
int intGLOB_24 = 9;
int intGLOB_25 = 10;
int intGLOB_26 = 11;
int intGLOB_27 = 12;
int intGLOB_28 = 13;
int intGLOB_29 = 14;
int intGLOB_30 = 15;
int intGLOB_31 = 16;
int intGLOB_32 = 17;
int intGLOB_33 = 18;
int intGLOB_34 = 19;
int intGLOB_35 = 20;
int intGLOB_36 = 21;
int intGLOB_37 = 22;
int intGLOB_38 = 23;
int intGLOB_39 = 24;
int intGLOB_40 = 25;
int intGLOB_41 = 26;
int intGLOB_42 = 27;
int intGLOB_43 = 28;
int intGLOB_44 = 29;
int intGLOB_45 = 30;
int intGLOB_46 = 31;
int intGLOB_47 = 32;
int intGLOB_48 = 84;
int intGLOB_49 = 0;
int intGLOB_50 = 1;
int intGLOB_51 = 2;
int intGLOB_52 = 29;
int intGLOB_53 = 65;
int intGLOB_54 = 98;
int intGLOB_55 = 99;
int intGLOB_56 = 100;
int intGLOB_57 = 101;
int intGLOB_58 = 103;
int intGLOB_59 = 104;
int intGLOB_60 = 105;
int intGLOB_61 = 106;
int intGLOB_62 = 102;
int intGLOB_63 = 107;
int intGLOB_64 = 108;
int intGLOB_65 = 102;
int intGLOB_66 = 107;
int intGLOB_67 = 108;
int intGLOB_68 = 109;
int intGLOB_69 = 15;
int intGLOB_70 = 10;
int intGLOB_71 = 5;
int intGLOB_72 = 2;
int intGLOB_73;
int intGLOB_74;
int intGLOB_75;
object objectGLOB_1;
int intGLOB_76;
int intGLOB_77;
int intGLOB_78;
int intGLOB_79;
int intGLOB_80;
int intGLOB_81;
int intGLOB_82 = 1;
int intGLOB_83 = 2;
int intGLOB_84 = 3;
int intGLOB_85 = 20;
int intGLOB_86 = 21;
int intGLOB_87 = 22;
int intGLOB_88 = 23;
int intGLOB_89 = 24;
int intGLOB_90 = 25;
int intGLOB_91 = 26;
int intGLOB_92 = 27;
int intGLOB_93 = 28;
int intGLOB_94 = 66;
int intGLOB_95 = 67;
int intGLOB_96 = 68;
int intGLOB_97 = 69;
int intGLOB_98 = 70;
int intGLOB_99 = 71;
int intGLOB_100 = 72;
int intGLOB_101 = 73;
int intGLOB_102 = 74;
int intGLOB_103 = 75;
int intGLOB_104 = 76;
int intGLOB_105 = 77;
int intGLOB_106 = 78;
int intGLOB_107 = 79;
int intGLOB_108 = 80;
int intGLOB_109 = 81;
int intGLOB_110 = 82;
int intGLOB_111 = 83;
int intGLOB_112 = 85;
int intGLOB_113 = 86;
int intGLOB_114 = 87;
int intGLOB_115 = 88;
int intGLOB_116 = 89;
int intGLOB_117 = 90;
int intGLOB_118 = 91;
int intGLOB_119 = 92;
int intGLOB_120 = 94;
int intGLOB_121 = 95;
int intGLOB_122 = 96;
int intGLOB_123 = 97;
int intGLOB_124 = 1;
int intGLOB_125 = 2;
int intGLOB_126 = 3;
int intGLOB_127 = 4;
int intGLOB_128 = 5;
int intGLOB_129 = 0;
int intGLOB_130 = 1;
int intGLOB_131 = 2;
int intGLOB_132 = 3;
int intGLOB_133 = 4;
int intGLOB_134 = 5;
int intGLOB_135 = 6;
int intGLOB_136 = 7;
int intGLOB_137 = 8;
int intGLOB_138 = 9;
int intGLOB_139 = 10;
int intGLOB_140 = 11;
int intGLOB_141 = 12;
int intGLOB_142 = 13;
int intGLOB_143 = 14;
int intGLOB_144 = 15;
int intGLOB_145 = 16;
int intGLOB_146 = 17;
int intGLOB_147 = 18;
int intGLOB_148 = 19;
int intGLOB_149 = 1100;
int intGLOB_150 = (-6);
int intGLOB_151 = (-5);
int intGLOB_152 = (-4);
int intGLOB_153 = (-2);
int intGLOB_154 = (-1);
int intGLOB_155 = 0;

// Prototypes
void sub2(string stringParam1);
void sub1(int intParam1, int intParam2);

void sub2(string stringParam1) {
object object1 = OBJECT_SELF;
if (GetCommandable(object1)) {
ClearAllActions();
CancelCombat(object1);
ActionMoveToObject(GetNearestObjectByTag("wp_homebase", OBJECT_SELF, 1), 1, 3.0);
ActionDoCommand(SetCommandable(1, object1));
SetCommandable(0, OBJECT_SELF);
}
}

void sub1(int intParam1, int intParam2) {
SetLocalBoolean(OBJECT_SELF, intParam1, intParam2);
}

void main() {
int int1 = GetUserDefinedEventNumber();
if ((int1 == 1001)) {
}
else {
if ((int1 == 1002)) {
}
else {
if ((int1 == 1003)) {
}
else {
if ((int1 == 1004)) {
}
else {
if ((int1 == 1005)) {
}
else {
if ((int1 == 1006)) {
int nGlobal = GetGlobalNumber("604DAN_Vrook_Status");
int int5 = GetGlobalNumber("601DAN_Side");
if (((int5 == 1) && (nGlobal == 3))) {
return;
}
if (((GetCurrentHitPoints(OBJECT_SELF) < (GetMaxHitPoints(OBJECT_SELF) / 2)) && (!GetLocalBoolean(OBJECT_SELF, 40)))) {
SetLocalBoolean(OBJECT_SELF, 40, 1);
object oInvisoKreia = GetObjectByTag("InvisoKreia", 0);
if ((!GetIsObjectValid(oInvisoKreia))) {
AurPostString("Could not find InvisoKreia.", 10, 10, 2.0);
}
else {
SetLocalNumber(oInvisoKreia, 12, 2);
sub1(intGLOB_114, 1);
CancelCombat(OBJECT_SELF);
CancelCombat(GetFirstPC());
ClearAllEffects();
ClearAllActions();
SetGlobalFadeOut(0.0, 1.0, 0.0, 0.0, 0.0);
NoClicksFor(1.2);
AssignCommand(oInvisoKreia, ActionStartConversation(GetFirstPC(), "lrn_form", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}
}
else {
if (((GetCurrentHitPoints(OBJECT_SELF) == 1) && GetLocalBoolean(OBJECT_SELF, 40))) {
object object5 = GetObjectByTag("InvisoKreia", 0);
if ((!GetIsObjectValid(object5))) {
AurPostString("Could not find InvisoKreia.", 10, 10, 2.0);
}
else {
SetLocalNumber(object5, 15, 1);
SetLocalNumber(object5, 12, 2);
sub1(intGLOB_114, 1);
CancelCombat(OBJECT_SELF);
CancelCombat(GetFirstPC());
ClearAllEffects();
ClearAllActions();
ChangeToStandardFaction(OBJECT_SELF, 4);
SetGlobalFadeIn(0.0, 1.0, 0.0, 0.0, 0.0);
NoClicksFor(1.2);
AssignCommand(object5, ActionStartConversation(GetFirstPC(), "vrook_capture", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
}
}
}
}
else {
if ((int1 == 1007)) {
}
else {
if ((int1 == 1008)) {
}
else {
if ((int1 == 1009)) {
}
else {
if ((int1 == 1010)) {
}
else {
if ((int1 == 1011)) {
}
else {
if ((int1 == intGLOB_149)) {
sub2("wp_homebase");
}
}
}
}
}
}
}
}
}
}
}
}
}
 Darth Balor
09-18-2007, 3:24 PM
#2
Can someone look at this please?

Darth Balor, please refrain from posting 'bump' posts like this in the future. Thanks. -RH
 swfan28
09-18-2007, 6:07 PM
#3
Well, for the a_master_setup script the part where you move Vrook and the PC are bugged.
// Place vrook at his mark.
location lMaster = Location(Vector (-10.87173, (-5.88733), 7.50000), 0.0);
DelayCommand(1.0, AssignCommand(IMaster, ActionJumpToLocation(lMaster)));There is a typo in the second line. Object IMaster doesn't exist. This should be oMaster. Also move the function under the case 2 or this will move Kavar and ZezKaiEll before their fights as this script is called before all fights with the masters.
// Place the vrook duel player at his/her mark.
object iPC = GetFirstPC();
if( !GetIsObjectValid( IPC ) ) {
AurPostString( "Could not find Player's Character to set up cutscene positioning.", 10, 10, 2.0 );Another typo here. Object names are case sensitive I think so the GetIsObjectValid() check returns false. I'm not sure what this AurPostString does but I think it would quit the game and post the given string to some debugging program. Perhaps this is the cause of the crash. The if-structure is also missing the closing bracket and there is no new location for the PC or the function to move him there.

As before this function called outside the case structure will interfere with other Master fights. You should place a finished version of the function to case 2 and move the function under it
// Place the player at his/her mark.
object oPC = GetFirstPC();
if( !GetIsObjectValid( oPC ) ) {
AurPostString( "Could not find Player's Character to set up cutscene positioning.", 10, 10, 2.0 );
return;
}
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC1" );
lWay = GetLocation( oWay );
AssignCommand( oPC, JumpToLocation( lWay ) );to other cases. Also I recommend renaming this script and using the renamed script in Vrook's dialogue. This will prevent it from affecting other fights with the Masters. That way you can remove the case structure and references to other masters completely.

I find no errors from the second script, but the speaker tag for Vrook in the first node of the Vrook_capture.dlg is wrong if you have not already fixed it since you posted it to me. Vrook's tag is "vrook" not "npc_vrook". This would cause the dialogue to dead-end before the first node.
 stoffe
09-18-2007, 6:35 PM
#4
I'm not sure what this AurPostString does but I think it would quit the game and post the given string to some debugging program. Perhaps this is the cause of the crash.

AurPostString() is just a debug function that was displaying the debug text overlaid on screen at the X/Y screen coordinates specified, presumably as a way for the scenario designers to easily see that scripts were fired as intended when debugging the game.

Like most other debug print script functions it has been disabled in the release version of the game though, and now does nothing at all.
 Darth Balor
09-18-2007, 9:31 PM
#5
Thanks, guys. This should work right?


// a_master_setup
// DJS-OEI 9/7/2004
// Param1 - Flag to indicate if PC2 and PC3 should leave the party.
// 0 = Yes, 1 = No.
// This script sets up the positioning of the Jedi Master and the
// player as necesasry for the scene. The Local Number 12 on the
// owner of this dialogue determines which Master we're working with.

#include "k_inc_generic"
#include "k_inc_glob_party"

void ClearNPC()
{
GN_SetSpawnInCondition(SW_FLAG_AI_OFF,TRUE);
ClearAllActions();
}

void main()
{
int bRetainPCs = GetScriptParameter( 1 );
object oWay;
location lWay;

object oInvisoKreia = GetObjectByTag( "InvisoKreia" );
object oMaster = OBJECT_INVALID;
// First, check if we're teaching a Form, and then
// check to see if we're killing the Jedi Master instead.
int nLocalNum = GetLocalNumber( oInvisoKreia, 16 );
if( nLocalNum == 0 ) {
nLocalNum = GetLocalNumber( oInvisoKreia, 12 );
}
object oDoor = OBJECT_INVALID;
switch( nLocalNum ) {

{
oMaster = GetObjectByTag( "npc_vrook" );

// Set the Area to Unescapable so the player can't bring
// in party members.
SetAreaUnescapable( TRUE );

// Close and lock the doors to this room if
// we're doing the battle.
if( !bRetainPCs ) {
oDoor = GetObjectByTag( "ao_door" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door1" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door2" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
}
break;
}

if( GetIsObjectValid( oMaster ) ) {
ActionPauseConversation();

// This is the cutscene where the Jedi Master
// confronts the player and starts combat.

SetGlobalFadeIn( 0.0, 2.0 );

// Set the player's character as the party leader.
SetPartyLeader( NPC_PLAYER );


// Place vrook at his mark.
location oMaster = Location(Vector (-10.87173, (-5.88733), 7.50000), 0.0);
DelayCommand(1.0, AssignCommand(oMaster, ActionJumpToLocation(oMaster)));

// Place the player at his/her mark.
object oPC = GetFirstPC();
if( !GetIsObjectValid( oPC ) ) {
location oPC = Location(Vector (-10.21946, (3.43953), 7.49987), 0.0);
DelayCommand(1.0, AssignCommand(oPC, ActionJumpToLocation(oPC)));


if( !bRetainPCs ) {
// Remove the two other party members from the party
// for the duration of the battle and set them
// to Neutral. Store their NPC IDs in this object's
// Local Number 13 and 14 (99 for empty slots) so
// we can re-add them after the combat is over.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
AurPostString( "Storing PC2.", 10, 10, 3.0 );
// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC2 ) );
SetLocalNumber( oInvisoKreia, 13, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC2,ClearNPC() );
ChangeToStandardFaction( oPC2,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC2, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
AssignCommand( oPC2, ActionDoCommand( SetCommandable( FALSE, oPC2 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 13 ) ), 10, 10, 3.0 );
}
if( GetIsObjectValid( oPC3 ) ) {
AurPostString( "Storing PC3.", 10, 11, 3.0 );

// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC3 ) );
SetLocalNumber( oInvisoKreia, 14, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC3,ClearNPC() );
ChangeToStandardFaction( oPC3,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC3, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
AssignCommand( oPC3, ActionDoCommand( SetCommandable( FALSE, oPC3 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 14, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 14 ) ), 10, 11, 3.0 );
}
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
SetLocalNumber( oInvisoKreia, 14, 99 );
// Just move the other PCs.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
}
if( GetIsObjectValid( oPC3 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
}
}
DelayCommand( 2.0, ActionResumeConversation() );
}
}
 swfan28
09-19-2007, 3:54 AM
#6
Since you have removed the case structure you should also remove the line "switch( nLocalNum )" before the case structure as well as the "break;" after what used to be the case 2. After that just rename the script, update the call to it in the dialogue file and give it a try.
 Darth Balor
09-19-2007, 6:24 AM
#7
Thanks. oh, check your email.

It won't compile


// a_vrook_setup
// DJS-OEI 9/7/2004
// Param1 - Flag to indicate if PC2 and PC3 should leave the party.
// 0 = Yes, 1 = No.
// This script sets up the positioning of the Jedi Master and the
// player as necesasry for the scene. The Local Number 12 on the
// owner of this dialogue determines which Master we're working with.

#include "k_inc_generic"
#include "k_inc_glob_party"

void ClearNPC()
{
GN_SetSpawnInCondition(SW_FLAG_AI_OFF,TRUE);
ClearAllActions();
}

void main()
{
int bRetainPCs = GetScriptParameter( 1 );
object oWay;

object oInvisoKreia = GetObjectByTag( "InvisoKreia" );
object oMaster = OBJECT_INVALID;
// First, check if we're teaching a Form, and then
// check to see if we're killing the Jedi Master instead.
int nLocalNum = GetLocalNumber( oInvisoKreia, 16 );
if( nLocalNum == 0 ) {
nLocalNum = GetLocalNumber( oInvisoKreia, 12 );
}
object oDoor = OBJECT_INVALID;
{
oMaster = GetObjectByTag( "vrook" );

// Set the Area to Unescapable so the player can't bring
// in party members.
SetAreaUnescapable( TRUE );

// Close and lock the doors to this room if
// we're doing the battle.
if( !bRetainPCs ) {
oDoor = GetObjectByTag( "ao_door" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door1" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door2" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
}
}

if( GetIsObjectValid( oMaster ) ) {
ActionPauseConversation();

// This is the cutscene where the Jedi Master
// confronts the player and starts combat.

SetGlobalFadeIn( 0.0, 2.0 );

// Set the player's character as the party leader.
SetPartyLeader( NPC_PLAYER );


// Place vrook at his mark.
location lMaster = Location(Vector (-10.87173, (-5.88733), 7.50000), 0.0);
DelayCommand(1.0, AssignCommand(oMaster, ActionJumpToLocation(lMaster)));

// Place the player at his/her mark.
object oPC = GetFirstPC();
if( !GetIsObjectValid( oPC ) ) {
location lPC = Location(Vector (-10.21946, (3.43953), 7.49987), 0.0);
DelayCommand(1.0, AssignCommand(oPC, ActionJumpToLocation(lPC)));
}

if( !bRetainPCs ) {
// Remove the two other party members from the party
// for the duration of the battle and set them
// to Neutral. Store their NPC IDs in this object's
// Local Number 13 and 14 (99 for empty slots) so
// we can re-add them after the combat is over.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
AurPostString( "Storing PC2.", 10, 10, 3.0 );
// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC2 ) );
SetLocalNumber( oInvisoKreia, 13, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC2,ClearNPC() );
ChangeToStandardFaction( oPC2,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC2, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
AssignCommand( oPC2, ActionDoCommand( SetCommandable( FALSE, oPC2 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 13 ) ), 10, 10, 3.0 );
}
if( GetIsObjectValid( oPC3 ) ) {
AurPostString( "Storing PC3.", 10, 11, 3.0 );

// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC3 ) );
SetLocalNumber( oInvisoKreia, 14, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC3,ClearNPC() );
ChangeToStandardFaction( oPC3,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC3, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
AssignCommand( oPC3, ActionDoCommand( SetCommandable( FALSE, oPC3 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 14, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 14 ) ), 10, 11, 3.0 );
}
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
SetLocalNumber( oInvisoKreia, 14, 99 );
// Just move the other PCs.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
}
if( GetIsObjectValid( oPC3 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
}
}
DelayCommand( 2.0, ActionResumeConversation() );
}
}
 swfan28
09-19-2007, 9:09 AM
#8
Try it now.
// a_vrook_setup
// DJS-OEI 9/7/2004
// Param1 - Flag to indicate if PC2 and PC3 should leave the party.
// 0 = Yes, 1 = No.
// This script sets up the positioning of the Jedi Master and the
// player as necesasry for the scene. The Local Number 12 on the
// owner of this dialogue determines which Master we're working with.

#include "k_inc_generic"
#include "k_inc_glob_party"

void ClearNPC()
{
GN_SetSpawnInCondition(SW_FLAG_AI_OFF,TRUE);
ClearAllActions();
}

void main()
{
int bRetainPCs = GetScriptParameter( 1 );
object oWay;
location lWay;
object oInvisoKreia = GetObjectByTag( "InvisoKreia" );
object oMaster = GetObjectByTag("vrook");
object oDoor = OBJECT_INVALID;

// First, check if we're teaching a Form, and then
// check to see if we're killing the Jedi Master instead.
int nLocalNum = GetLocalNumber( oInvisoKreia, 16 );
if( nLocalNum == 0 ) {
nLocalNum = GetLocalNumber( oInvisoKreia, 12 );
}

// Set the Area to Unescapable so the player can't bring
// in party members.
SetAreaUnescapable( TRUE );

// Close and lock the doors to this room if
// we're doing the battle.
if( !bRetainPCs ) {
oDoor = GetObjectByTag( "ao_door" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door1" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
oDoor = GetObjectByTag( "master_door2" );
if( GetIsObjectValid( oDoor ) ) {
AssignCommand( oDoor, ActionCloseDoor( oDoor ) );
SetLocked( oDoor, TRUE );
}
}

if( GetIsObjectValid( oMaster ) ) {
ActionPauseConversation();

// This is the cutscene where the Jedi Master
// confronts the player and starts combat.

SetGlobalFadeIn( 0.0, 2.0 );

// Set the player's character as the party leader.
SetPartyLeader( NPC_PLAYER );

// Place vrook at his mark.
location lMaster = Location(Vector (-10.87173, (-5.88733), 7.50000), 0.0);
DelayCommand(1.0, AssignCommand(oMaster, ActionJumpToLocation(lMaster)));

// Place the player at his/her mark.
object oPC = GetFirstPC();
if( GetIsObjectValid( oPC ) ) {
location lPC = Location(Vector (-10.21946, (3.43953), 7.49987), 0.0);
DelayCommand(1.0, AssignCommand(oPC, ActionJumpToLocation(lPC)));
}

if( !bRetainPCs ) {
// Remove the two other party members from the party
// for the duration of the battle and set them
// to Neutral. Store their NPC IDs in this object's
// Local Number 13 and 14 (99 for empty slots) so
// we can re-add them after the combat is over.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
AurPostString( "Storing PC2.", 10, 10, 3.0 );
// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC2 ) );
SetLocalNumber( oInvisoKreia, 13, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC2,ClearNPC() );
ChangeToStandardFaction( oPC2,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC2, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
AssignCommand( oPC2, ActionDoCommand( SetCommandable( FALSE, oPC2 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 13 ) ), 10, 10, 3.0 );
}
if( GetIsObjectValid( oPC3 ) ) {
AurPostString( "Storing PC3.", 10, 11, 3.0 );

// Store this party member's NPC ID so we can
// put them back in the party later.
int nNPCID = GetNPCConstant( GetTag( oPC3 ) );
SetLocalNumber( oInvisoKreia, 14, nNPCID );

// Drop the party member, make sure they won't
// join the combat, and place him/her on the mark.
RemovePartyMember( nNPCID );
AssignCommand( oPC3,ClearNPC() );
ChangeToStandardFaction( oPC3,STANDARD_FACTION_NEUTRAL );
AssignCommand( oPC3, ClearAllActions() );
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
AssignCommand( oPC3, ActionDoCommand( SetCommandable( FALSE, oPC3 ) ) );
}
else {
SetLocalNumber( oInvisoKreia, 14, 99 );
AurPostString( IntToString( GetLocalNumber( oInvisoKreia, 14 ) ), 10, 11, 3.0 );
}
}
else {
SetLocalNumber( oInvisoKreia, 13, 99 );
SetLocalNumber( oInvisoKreia, 14, 99 );
// Just move the other PCs.
object oPC2 = GetPartyMemberByIndex( 1 );
object oPC3 = GetPartyMemberByIndex( 2 );
if( GetIsObjectValid( oPC2 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC2" );
lWay = GetLocation( oWay );
AssignCommand( oPC2, JumpToLocation( lWay ) );
}
if( GetIsObjectValid( oPC3 ) ) {
oWay = GetWaypointByTag( "WP_MASTER_CUT_PC3" );
lWay = GetLocation( oWay );
AssignCommand( oPC3, JumpToLocation( lWay ) );
}
}
DelayCommand( 2.0, ActionResumeConversation() );
}
}
 Darth Balor
09-19-2007, 10:01 PM
#9
It still won't compile, I'll have to try something a little different.
 swfan28
09-20-2007, 5:25 PM
#10
Darth Balor wrote:
It still won't compile, I'll have to try something a little different.What??? But I was able to compile that successfully. I'll e-mail the compiled script to you.
Page: 1 of 1