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.

Need help with 2 scripts

Page: 1 of 1
 DarthStoney
09-28-2007, 1:18 PM
#1
I am trying to add Vash to these 2 TSL scripts but they will not compile without errors when I add a case4. What do I need to do?


// 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:
{
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;
}
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 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

// a_master_kill
// DJS-OEI 9/7/2004
// This script sets up the positioning of the Jedi Master and the
// player as necesasry for the Master death 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 main()
{
object oWay;
location lWay;

object oInvisoKreia = GetObjectByTag( "InvisoKreia" );
object oMaster = OBJECT_INVALID;
int nLocalNum = GetLocalNumber( oInvisoKreia, 12 );
object oDoor = OBJECT_INVALID;
switch( nLocalNum ) {
case 1:
{
AurPostString( "Kavar is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "kavar" );
SetGlobalNumber( "000_Kavar_Dead", 1 );

// Set journal entry for Kavar being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 55, TRUE);

break;
}
case 2:
{
AurPostString( "Vrook is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "npc_vrook" );
SetGlobalNumber( "000_Vrook_Dead", 1 );

// Turn off Area Unescapeable.
SetAreaUnescapable( FALSE );

// Set journal entry for Vrook being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 75, TRUE);

// Unlock the doors to this room.
oDoor = GetObjectByTag( "ao_door" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
}
oDoor = GetObjectByTag( "master_door1" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
}
oDoor = GetObjectByTag( "master_door2" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
}
break;
}
case 3:
{
AurPostString( "Zez-Kai Ell is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "zezkaiel" );
SetGlobalNumber( "000_ZezKaiEll_Dead", 1 );

// Set journal entry for Zez-Kai Ell being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 43, TRUE);

// Turn off Area Unescapeable.
SetAreaUnescapable( FALSE );

// Unlock and open the secret door.
oDoor = GetObjectByTag( "Flophouse_Secret" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
AssignCommand( oDoor, ActionOpenDoor( oDoor ) );
}
}
break;
}

// Give the player 25 bonus FP.
AddBonusForcePoints( GetFirstPC(), 25 );

// Return all of the PCs to the party.
int nNPCID2 = GetLocalNumber( oInvisoKreia, 13 );
int nNPCID3 = GetLocalNumber( oInvisoKreia, 14 );
object oNPC2;
object oNPC3;
if( nNPCID2 != 99 ) {

AurPostString( IntToString( nNPCID2 ), 1, 2, 7.0 );
string sTag = GetNPCTag( nNPCID2 );
oNPC2 = GetObjectByTag(sTag);
if( !GetIsObjectValid( oNPC2 ) ) {
AurPostString( "MAJOR ERROR!!! Unable to re-add party member after killing Jedi Master.", 10, 10, 7.0 );
}
else {
AddPartyMember(nNPCID2,oNPC2);
SetCommandable(TRUE,oNPC2);
ChangeToStandardFaction(oNPC2,STANDARD_FACTION_FRI ENDLY_1);
AssignCommand(oNPC2,ClearAllActions() );
AssignCommand(oNPC2,GN_SetSpawnInCondition(SW_FLAG _AI_OFF,FALSE) );
}
}
else {
AurPostString( "No PC2 on Kill.", 1, 2, 7.0 );
}
if( nNPCID3 != 99 ) {
AurPostString( IntToString( nNPCID3 ), 1, 3, 7.0 );
string sTag = GetNPCTag( nNPCID3 );
oNPC3 = GetObjectByTag(sTag);
if( !GetIsObjectValid( oNPC3 ) ) {
AurPostString( "MAJOR ERROR!!! Unable to re-add party member after killing Jedi Master.", 10, 10, 7.0 );
}
else {
AddPartyMember(nNPCID3,oNPC3);
SetCommandable(TRUE,oNPC3);
ChangeToStandardFaction(oNPC3,STANDARD_FACTION_FRI ENDLY_1);
AssignCommand(oNPC3,ClearAllActions() );
AssignCommand(oNPC3,GN_SetSpawnInCondition(SW_FLAG _AI_OFF,FALSE) );
}
}
else {
AurPostString( "No PC3 on Kill.", 1, 3, 7.0 );
}

if( GetIsObjectValid( oMaster ) ) {
AurPostString( "Starting Kill cutscene.", 1, 4, 2.0 );

// This is the cutscene where the Jedi Master
// is at 1HP and the player drains his Force Power.
ActionPauseConversation();

AssignCommand( oMaster, ClearAllActions() );
AssignCommand( GetFirstPC(), ClearAllActions() );

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

// 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 ) );

// Perform a fake version of the Death Field spell,
// pull FP from the Master, and then kill him.
effect eDeath = EffectDeath();
effect eBeam = EffectBeam(VFX_BEAM_DEATH_FIELD_TENTACLE, oPC, BODY_NODE_CHEST);
effect eVFX = EffectVisualEffect(VFX_PRO_DEATH_FIELD);
effect eHeal = EffectHeal( GetMaxHitPoints( oMaster ) - 1 );

SetMinOneHP( oMaster, FALSE );

// We have to heal the Master or else he'll keep playing his Injured
// animation instead of the ones we want.
ApplyEffectToObject( DURATION_TYPE_INSTANT, eHeal, oMaster );
AssignCommand( oMaster, PlayAnimation( ANIMATION_LOOPING_PAUSE_DRUNK, 1.0, -1.0 ) );
DelayCommand( 0.5, AssignCommand( oPC, PlayAnimation( ANIMATION_FIREFORGET_SCREAM, 0.5 ) ) );
DelayCommand( 1.0, ApplyEffectToObject( DURATION_TYPE_TEMPORARY, eBeam, oMaster, 2.33 ) );
DelayCommand( 1.0, AssignCommand( oMaster, ClearAllActions() ) );
DelayCommand( 1.0, AssignCommand( oMaster, PlayAnimation( ANIMATION_LOOPING_CHOKE_WORKING, 1.0, -1.0 ) ) );
DelayCommand( 1.0, ApplyEffectToObject( DURATION_TYPE_INSTANT, eVFX, oMaster ) );
DelayCommand( 2.0, ApplyEffectToObject( DURATION_TYPE_INSTANT, eVFX, oMaster ) );
DelayCommand( 3.0, ApplyEffectToObject( DURATION_TYPE_INSTANT, eDeath, oMaster ) );

DelayCommand( 5.0, ActionResumeConversation() );
}
else {
AurPostString( "Could not find Master to set up cutscene positioning.", 10, 10, 2.0 );
}
}
 stoffe
09-28-2007, 4:51 PM
#2
I am trying to add Vash to these 2 TSL scripts but they will not compile without errors when I add a case4. What do I need to do?


What is it you are trying to add to those scripts?
 DarthStoney
09-28-2007, 5:01 PM
#3
I was tryining to add a case 4 :
case 4:
{
AurPostString( "Vash is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "vash" );
SetGlobalNumber( "000_Vash_Dead", 1 );

// Set journal entry for Vash being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 61, TRUE);

this line added after case3 . need fourth option in both scripts as adding vash as fourth jedi master.
 stoffe
09-28-2007, 5:42 PM
#4
I was tryining to add a case 4 :

this line added after case3 . need fourth option in both scripts as adding vash as fourth jedi master.

This should compile:


// a_master_kill
// DJS-OEI 9/7/2004
// This script sets up the positioning of the Jedi Master and the
// player as necesasry for the Master death 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 main()
{
object oWay;
location lWay;

object oInvisoKreia = GetObjectByTag( "InvisoKreia" );
object oMaster = OBJECT_INVALID;
int nLocalNum = GetLocalNumber( oInvisoKreia, 12 );
object oDoor = OBJECT_INVALID;
switch( nLocalNum ) {
case 1:
{
AurPostString( "Kavar is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "kavar" );
SetGlobalNumber( "000_Kavar_Dead", 1 );

// Set journal entry for Kavar being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 55, TRUE);

break;
}

case 2:
{
AurPostString( "Vrook is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "npc_vrook" );
SetGlobalNumber( "000_Vrook_Dead", 1 );

// Turn off Area Unescapeable.
SetAreaUnescapable( FALSE );

// Set journal entry for Vrook being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 75, TRUE);

// Unlock the doors to this room.
oDoor = GetObjectByTag( "ao_door" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
}
oDoor = GetObjectByTag( "master_door1" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
}
oDoor = GetObjectByTag( "master_door2" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
}
break;
}

case 3:
{
AurPostString( "Zez-Kai Ell is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "zezkaiel" );
SetGlobalNumber( "000_ZezKaiEll_Dead", 1 );

// Set journal entry for Zez-Kai Ell being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 43, TRUE);

// Turn off Area Unescapeable.
SetAreaUnescapable( FALSE );

// Unlock and open the secret door.
oDoor = GetObjectByTag( "Flophouse_Secret" );
if( GetIsObjectValid( oDoor ) ) {
SetLocked( oDoor, FALSE );
AssignCommand( oDoor, ActionOpenDoor( oDoor ) );
}
break;
}

// ST: Added this case
case 4:
{
AurPostString( "Vash is Master.", 1, 1, 3.0 );
oMaster = GetObjectByTag( "vash" );
SetGlobalNumber( "000_Vash_Dead", 1 );

// Set journal entry for Vash being killed. This will override higher journal entries.
AddJournalQuestEntry("LostJedi", 61, TRUE);
break;
}
}

// Give the player 25 bonus FP.
AddBonusForcePoints( GetFirstPC(), 25 );

// Return all of the PCs to the party.
int nNPCID2 = GetLocalNumber( oInvisoKreia, 13 );
int nNPCID3 = GetLocalNumber( oInvisoKreia, 14 );
object oNPC2;
object oNPC3;
if( nNPCID2 != 99 ) {

AurPostString( IntToString( nNPCID2 ), 1, 2, 7.0 );
string sTag = GetNPCTag( nNPCID2 );
oNPC2 = GetObjectByTag(sTag);
if( !GetIsObjectValid( oNPC2 ) ) {
AurPostString( "MAJOR ERROR!!! Unable to re-add party member after killing Jedi Master.", 10, 10, 7.0 );
}
else {
AddPartyMember(nNPCID2,oNPC2);
SetCommandable(TRUE,oNPC2);
ChangeToStandardFaction(oNPC2, STANDARD_FACTION_FRIENDLY_1 );
AssignCommand(oNPC2,ClearAllActions() );
AssignCommand(oNPC2,GN_SetSpawnInCondition( SW_FLAG_AI_OFF, FALSE ) );
}
}
else {
AurPostString( "No PC2 on Kill.", 1, 2, 7.0 );
}
if( nNPCID3 != 99 ) {
AurPostString( IntToString( nNPCID3 ), 1, 3, 7.0 );
string sTag = GetNPCTag( nNPCID3 );
oNPC3 = GetObjectByTag(sTag);
if( !GetIsObjectValid( oNPC3 ) ) {
AurPostString( "MAJOR ERROR!!! Unable to re-add party member after killing Jedi Master.", 10, 10, 7.0 );
}
else {
AddPartyMember(nNPCID3,oNPC3);
SetCommandable(TRUE,oNPC3);
ChangeToStandardFaction(oNPC3, STANDARD_FACTION_FRIENDLY_1 );
AssignCommand(oNPC3,ClearAllActions() );
AssignCommand(oNPC3,GN_SetSpawnInCondition( SW_FLAG_AI_OFF, FALSE ) );
}
}
else {
AurPostString( "No PC3 on Kill.", 1, 3, 7.0 );
}

if( GetIsObjectValid( oMaster ) ) {
AurPostString( "Starting Kill cutscene.", 1, 4, 2.0 );

// This is the cutscene where the Jedi Master
// is at 1HP and the player drains his Force Power.
ActionPauseConversation();

AssignCommand( oMaster, ClearAllActions() );
AssignCommand( GetFirstPC(), ClearAllActions() );

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

// 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 ) );

// Perform a fake version of the Death Field spell,
// pull FP from the Master, and then kill him.
effect eDeath = EffectDeath();
effect eBeam = EffectBeam(VFX_BEAM_DEATH_FIELD_TENTACLE, oPC, BODY_NODE_CHEST);
effect eVFX = EffectVisualEffect(VFX_PRO_DEATH_FIELD);
effect eHeal = EffectHeal( GetMaxHitPoints( oMaster ) - 1 );

SetMinOneHP( oMaster, FALSE );

// We have to heal the Master or else he'll keep playing his Injured
// animation instead of the ones we want.
ApplyEffectToObject( DURATION_TYPE_INSTANT, eHeal, oMaster );
AssignCommand( oMaster, PlayAnimation( ANIMATION_LOOPING_PAUSE_DRUNK, 1.0, -1.0 ) );
DelayCommand( 0.5, AssignCommand( oPC, PlayAnimation( ANIMATION_FIREFORGET_SCREAM, 0.5 ) ) );
DelayCommand( 1.0, ApplyEffectToObject( DURATION_TYPE_TEMPORARY, eBeam, oMaster, 2.33 ) );
DelayCommand( 1.0, AssignCommand( oMaster, ClearAllActions() ) );
DelayCommand( 1.0, AssignCommand( oMaster, PlayAnimation( ANIMATION_LOOPING_CHOKE_WORKING, 1.0, -1.0 ) ) );
DelayCommand( 1.0, ApplyEffectToObject( DURATION_TYPE_INSTANT, eVFX, oMaster ) );
DelayCommand( 2.0, ApplyEffectToObject( DURATION_TYPE_INSTANT, eVFX, oMaster ) );
DelayCommand( 3.0, ApplyEffectToObject( DURATION_TYPE_INSTANT, eDeath, oMaster ) );

DelayCommand( 5.0, ActionResumeConversation() );
}
else {
AurPostString( "Could not find Master to set up cutscene positioning.", 10, 10, 2.0 );
}
}


You probably missed the closing block delimiter and/or the break which made the script not compile (unless you're missing the include files used as well).
 DarthStoney
09-28-2007, 10:39 PM
#5
Thanks stoffe that compiled fine, now what am I doing wrong with this script ? Case4
is the added section. thanks you!


// 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
// 4 = Vash

#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:
{
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;
}
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;
}
case 4:
{
oMaster = GetObjectByTag( "vash" );

// Do any Vash-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( "DroidPlanetDoor01" );
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 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() );
}
}
 stoffe
09-29-2007, 6:42 AM
#6
Thanks stoffe that compiled fine, now what am I doing wrong with this script ? Case4
is the added section. thanks you!



You've added the case outside the switch() statement it should belong to, below its closing block delimiter. The indentation of some of your } were a bit messed up, making that harder to spot. This should compile:


// 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
// 4 = Vash

#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:
{
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;
}

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;
}

case 4:
{
oMaster = GetObjectByTag( "vash" );

// Do any Vash-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( "DroidPlanetDoor01" );
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 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() );
}
}
 DarthStoney
10-01-2007, 7:36 AM
#7
Thanks ,that worked just fine.
Page: 1 of 1