Jump to content

Home

Just a quick check in with the scripters


darthtyren

Recommended Posts

Just a couple of things that caught my eye:

 

 if ((GetLevelByClass(CLASS_TYPE_JEDICONSULAR, GetFirstPC()) == 1)) {
   SetGlobalNumber("000_PLAYER_CLASS", 2);
 }  

Is there a reason for the double parenthesis in the if-clause? I mean, shouldn't it work as well, if it would be

 if (GetLevelByClass(CLASS_TYPE_JEDICONSULAR, GetFirstPC()) == 1) {
   SetGlobalNumber("000_PLAYER_CLASS", 2);
 }  

 

And the second one...

The only problem is that it's compiled only. And it's a KotOR script, not TSL, so I can't "decompile" it in DeNCS.

Actually, DeNCS can compile KotOR scripts as well. Of course, it does not compile them all, but I don't think it can compile all of the TSL scripts, either.

Link to comment
Share on other sites

The script is called k_pdan_makejedi.ncs in the danm13_s.rim. As it turns out, the script does decompile in DeNCS, which is wierd, I thought that it could only decompile TSL scripts.

 

// 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 = 1;
int intGLOB_13 = 2;
int intGLOB_14 = 3;
int intGLOB_15 = 4;
int intGLOB_16 = 5;
int intGLOB_17 = 6;
int intGLOB_18 = 7;
int intGLOB_19 = 8;
int intGLOB_20 = 9;
int intGLOB_21 = 10;
int intGLOB_22 = 11;
int intGLOB_23 = 12;
int intGLOB_24 = 13;
int intGLOB_25 = 14;
int intGLOB_26 = 15;
int intGLOB_27 = 16;
int intGLOB_28 = 17;
int intGLOB_29 = 18;
int intGLOB_30 = 19;
int intGLOB_31 = 20;
int intGLOB_32 = 21;
int intGLOB_33 = 22;
int intGLOB_34 = 23;
int intGLOB_35 = 24;
int intGLOB_36 = 25;
int intGLOB_37 = 26;
int intGLOB_38 = 27;
int intGLOB_39 = 28;
int intGLOB_40 = 29;
int intGLOB_41 = 30;
int intGLOB_42 = 59;
int intGLOB_43 = 0;
int intGLOB_44 = 1;
int intGLOB_45 = 2;
int intGLOB_46 = 29;
int intGLOB_47 = 30;
int intGLOB_48 = 34;
int intGLOB_49 = 35;
int intGLOB_50 = 36;
int intGLOB_51 = 37;
int intGLOB_52 = 38;
int intGLOB_53 = 39;
int intGLOB_54 = 41;
int intGLOB_55 = 42;
int intGLOB_56 = 46;
int intGLOB_57 = 47;
int intGLOB_58 = 15;
int intGLOB_59 = 10;
int intGLOB_60 = 5;
int intGLOB_61 = 2;
int intGLOB_62;
int intGLOB_63;
int intGLOB_64;
object objectGLOB_1;
int intGLOB_65;
int intGLOB_66;
int intGLOB_67;
int intGLOB_68;
int intGLOB_69;
int intGLOB_70;
int intGLOB_71 = 1;
int intGLOB_72 = 2;
int intGLOB_73 = 3;
int intGLOB_74 = 20;
int intGLOB_75 = 21;
int intGLOB_76 = 22;
int intGLOB_77 = 23;
int intGLOB_78 = 24;
int intGLOB_79 = 25;
int intGLOB_80 = 26;
int intGLOB_81 = 27;
int intGLOB_82 = 28;
int intGLOB_83 = 31;
int intGLOB_84 = 32;
int intGLOB_85 = 33;
int intGLOB_86 = 40;
int intGLOB_87 = 43;
int intGLOB_88 = 44;
int intGLOB_89 = 45;
int intGLOB_90 = 48;
int intGLOB_91 = 49;
int intGLOB_92 = 50;
int intGLOB_93 = 51;
int intGLOB_94 = 52;
int intGLOB_95 = 53;
int intGLOB_96 = 54;
int intGLOB_97 = 55;
int intGLOB_98 = 56;
int intGLOB_99 = 57;
int intGLOB_100 = 58;
int intGLOB_101 = 60;
int intGLOB_102 = 61;
int intGLOB_103 = 62;
int intGLOB_104 = 63;
int intGLOB_105 = 64;
int intGLOB_106 = 65;
int intGLOB_107 = 66;
int intGLOB_108 = 67;
int intGLOB_109 = 68;
int intGLOB_110 = 69;
int intGLOB_111 = 70;
int intGLOB_112 = 71;
int intGLOB_113 = 72;
int intGLOB_114 = 1;
int intGLOB_115 = 2;
int intGLOB_116 = 3;
int intGLOB_117 = 4;
int intGLOB_118 = 0;
int intGLOB_119 = 1;
int intGLOB_120 = 2;
int intGLOB_121 = 3;
int intGLOB_122 = 4;
int intGLOB_123 = 5;
int intGLOB_124 = 6;
int intGLOB_125 = 7;
int intGLOB_126 = 8;
int intGLOB_127 = 9;
int intGLOB_128 = 10;
int intGLOB_129 = 11;
int intGLOB_130 = 12;
int intGLOB_131 = 13;
int intGLOB_132 = 14;
int intGLOB_133 = 15;
int intGLOB_134 = 16;
int intGLOB_135 = 17;
int intGLOB_136 = 18;
int intGLOB_137 = 19;
int intGLOB_138 = 1100;
int intGLOB_139 = (-6);
int intGLOB_140 = (-5);
int intGLOB_141 = (-4);
int intGLOB_142 = (-2);
int intGLOB_143 = (-1);
int intGLOB_144 = 0;
int intGLOB_145 = 4;
int intGLOB_146 = 1;
int intGLOB_147 = 7;
int intGLOB_148 = 1;
int intGLOB_149 = 2;
int intGLOB_150 = 3;
int intGLOB_151 = 1;
int intGLOB_152 = 2;
int intGLOB_153 = 3;
int intGLOB_154 = 4;
int intGLOB_155 = 5;
int intGLOB_156 = 6;
string stringGLOB_1 = "bastila";
string stringGLOB_2 = "carth";
string stringGLOB_3 = "dan13_WP_council";
string stringGLOB_4 = "g_w_lghtsbr01";
string stringGLOB_5 = "g_w_lghtsbr03";
string stringGLOB_6 = "g_w_lghtsbr04";
string stringGLOB_7 = "dan_wanderhound";

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

void sub2() {
int int1 = GetGlobalBoolean("DAN_EXTRA");
int int3 = ((GetGlobalNumber("DAN_EXTRA_XP2") + 128) << 8);
int int5 = (GetGlobalNumber("DAN_EXTRA_XP") + 128);
int int7 = (int3 | int5);
if (int1) {
	GiveXPToCreature(GetFirstPC(), int7);
}
SetGlobalNumber("DAN_EXTRA_XP", 0);
SetGlobalNumber("DAN_EXTRA_XP2", 0);
ShowLevelUpGUI();
}

void sub1() {
object oPC = GetFirstPC();
int nGlobal = GetGlobalNumber("DAN_PATH_STATE");
if ((nGlobal > 0)) {
	if ((nGlobal == intGLOB_148)) {
		AddMultiClass(3, oPC);
	}
	else {
		if ((nGlobal == intGLOB_149)) {
			AddMultiClass(5, oPC);
		}
		else {
			if ((nGlobal == intGLOB_150)) {
				AddMultiClass(4, oPC);
			}
		}
	}
}
CancelPostDialogCharacterSwitch();
NoClicksFor(0.6);
DelayCommand(0.5, sub2());
}

void main() {
object oPC = GetFirstPC();
if ((((GetLevelByClass(4, oPC) == 0) && (GetLevelByClass(3, oPC) == 0)) && (GetLevelByClass(5, oPC) == 0))) {
	sub1();
}
ClearAllActions();
}

 

I don't need the script to add xp, hopefully, assuming the JRL file can grant xp, but I do want to force the player to level up. As in, go to the level up screen.

 

I want the player to start the game as a force-using Jedi, but there are no force powers granted at character creation, so the next best thing is level 2. They would go through the opening conversation, then recieve xp from updating the journal, then be forced to the level up screen. The appropriate script would be on the final line in the conversation.

 

Believe it or not, I'm not so worried about this, because if a player can level, why shouldn't he? It would be cool to find the solution I'm looking for, but that is not as important as some other things.

Link to comment
Share on other sites

Certainly feels like it sometimes!

 

Indeed. A rushed and poorly executed one.

 

Anyway, new question (crazy right?). Does anyone know how the Ebon Hawk module in TSL recognizes the Handmaiden and the Disciple and under what conditions it spawns one or the other? I'm working on a project that makes them no longer gender specific. You would be able to swap them out with each other outside 003EBO, but I want the player to be able to talk to both of them and earn/lose influence with them.

 

Also, if any moderators are looking, could you please change the name of this thread to "DarthTyren's Endless Scripting Problems/Questions"? I'll likely be using this thread longer than what one expects from a "quick check in". Thank you.

Link to comment
Share on other sites

Also, if any moderators are looking, could you please change the name of this thread to "DarthTyren's Endless Scripting Problems/Questions"? I'll likely be using this thread longer than what one expects from a "quick check in". Thank you.

 

Edit your initial post and click on the "Go Advanced" button. Then you can rename the thread.

Link to comment
Share on other sites

  • 1 month later...

Guess what! New problem, except this time it involves about 4 scripts rather than 1. I'm gonna say what I want to have happen first.

 

I want to make the Handmaiden and Disciple both spawn on the Ebon Hawk at the same time. I've already taken away the 'gender-specific' attribute to recruiting them, and that works, and I also made a new Global Number that tells the game that the Handmaiden has joined the party, and that should work too, but I also had to make exceptions to a number of scripts (about 4) to make sure they're both on the Ebon Hawk after both are recruited.

 

The first one is actually 2 separate scripts, a_next_scene and k_003ebo_enter, but because of the similarities between them, they might as well be one.

 

Specifically, the OnEnter script calls for two specific functions that are in two separate #include scripts that have to do with spawning the Party NPCs on the Ebon Hawk.

 

ResetEbonHawk(); // This is found in k_inc_hawk.nss
SpawnAllAvailablePartyMembers(); // This is found in k_inc_glob_party.nss

 

I'm going to start with the one in the party script. This #include script is called upon before the cutscenes are fired. Since the function calls upon another function earlier in the script, I will post the entire end of the script with the changes I made highlighted in orange.

 

// Will spawn party member represented by aNPC_CONSTANT at thier personal waypoint IF they exist in the
// 'party base'.  This function does NOT add the spawned party member to the actual party.
object SpawnIndividualPartyMember(int aNPC_CONSTANT, string aWP)
{
   string sWP;
   if(aWP == "WP_gspawn_")
   {
       string sTag = GetNPCTag( aNPC_CONSTANT );
       if(sTag == "ERROR")
           return OBJECT_INVALID;
       sWP = aWP + sTag;
   }
   else
   {
       sWP = aWP;
   }
   object oWP = GetObjectByTag(sWP);
   object oPartyMember;
   if(GetIsObjectValid(oWP))
   {
       oPartyMember = SpawnAvailableNPC( aNPC_CONSTANT, GetLocation(oWP));
       if(( GetIsObjectValid(oPartyMember)) [color="DarkOrange"]|| ((( aNPC_CONSTANT ) == 11) && (GetGlobalNumber("000_Disciple_Joined") == 1)) || ((( aNPC_CONSTANT ) == 4) && (GetGlobalNumber("000_Handmaid_Joined") == 1)))[/color]
       {
           //new AWD-OEI 10/23/2004
           SetCreatureAILevel(oPartyMember, AI_LEVEL_HIGH);
           return oPartyMember;
       }
   }
   return OBJECT_INVALID;
}

// Will spawn puppet represented by aNPC_CONSTANT at thier personal waypoint IF they exist in the
// 'party base'.  This function does NOT add the spawned puppet member to the actual party.
object SpawnIndividualPuppet(int aNPC_CONSTANT, string aWP)
{
   string sWP;
   if(aWP == "WP_gspawn_")
   {
       string sTag = GetPuppetTag( aNPC_CONSTANT );
       if(sTag == "ERROR")
           return OBJECT_INVALID;
       sWP = aWP + sTag;
   }
   else
   {
       sWP = aWP;
   }
   object oWP = GetObjectByTag(sWP);
   object oPartyMember;
   if(GetIsObjectValid(oWP))
   {
       oPartyMember = SpawnAvailablePUP( aNPC_CONSTANT, GetLocation(oWP));
       if( GetIsObjectValid(oPartyMember))
           return oPartyMember;
   }
   return OBJECT_INVALID;
}


// Will spawn all available party members at thier personal waypoints.  This function does not add anyone
// to the actual party.
void SpawnAllAvailablePartyMembers()
{
   int i;
   for(i = 0; i < 12; i++)
   {
       if(GetNPCSelectability( i ) != -1)
       {
           if( !GetIsObjectValid(SpawnIndividualPartyMember( i )) )
           {
               AurPostString("NPC could not spawn, invalid NPC or invalid location!",5,15,10.0);
           }
           else
           {
               if(i == NPC_BAO_DUR)//spawn bao's pet
               {
                   SpawnIndividualPuppet(PUP_SENSORBALL);
               }
           }
       }
   }
}

 

The Reset function is fired in the Hawk script, and it fires after the cutscenes are finished showing.

 

void DoSpecialReset(object oNPC, string sModuleName)
{
   if(GetNPCConstant(GetTag(oNPC)) == NPC_ATTON)
   {
       AurPostString("Resetting Atton 1",15,19,10.0);
       DoAttonSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_BAO_DUR)
   {
       DoBaoDurSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_CANDEROUS)
   {
       DoMandSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_DISCIPLE)
   {
       DoDiscipleSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_G0T0)
   {
       DoG0T0SpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_HANDMAIDEN)
   {
       DoHandmaidenSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_HANHARR)
   {
       DoHanharrSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_HK_47)
   {
       DoHK47SpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_KREIA)
   {
       DoKreiaSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_MIRA)
   {
       DoMiraSpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_T3_M4)
   {
       DoT3M4SpawnIn(oNPC, sModuleName);
   }
   else if(GetNPCConstant(GetTag(oNPC)) == NPC_VISAS)
   {
       DoVisasMarrSpawnIn(oNPC, sModuleName);
   }
   else
   {
       AurPostString("ERROR: Invalid PartyMember",15,15,10.0);
   }
}

void DoSpecialPuppetReset(object oNPC, string sModuleName)
{
   if(GetPuppetConstant(GetTag(oNPC)) == PUP_SENSORBALL)
   {
       DoRemoteSpawnIn(oNPC, sModuleName);
   }
}

void ResetEbonHawk()
{
   AurPostString("k_inc_hawk: Resetting Ebon Hawk", 15, 18, 10.0);
   int i;

   string sTag;
   object oNPC;
   for(i = 0; i < 12; i++)
   {
       sTag = GetNPCTag( i );
       oNPC = GetObjectByTag(sTag);
       if(GetIsObjectValid(oNPC))
       {
           object oWP = GetObjectByTag("WP_gspawn_" + sTag);
           if(GetIsObjectValid(oWP))
           {
               AssignCommand(oNPC, ClearAllActions());
               AssignCommand(oNPC, ActionJumpToLocation(GetLocation(oWP)));
               DelayCommand(0.2, DoSpecialReset(oNPC, "003EBO"));
           }
           else
           {
               AurPostString("RESET EBONHAWK: invalid waypoint!", 15,15,10.0);
           }
       }
      [color="DarkOrange"] if((!GetIsObjectValid(GetObjectByTag("disciple"))) && (GetGlobalNumber("000_Disciple_Joined") == 1))
       {
           object oNPC = GetObjectByTag("disciple");
           object oWP = GetObjectByTag("WP_gspawn_disciple");
           if(GetIsObjectValid(oWP))
           {
               AssignCommand(oNPC, ClearAllActions());
               AssignCommand(oNPC, ActionJumpToLocation(GetLocation(oWP)));
               DelayCommand(0.2, DoSpecialReset(oNPC, "003EBO"));
           }
           else
           {
               AurPostString("RESET EBONHAWK: Disciple: invalid waypoint!", 15,15,10.0);
           }
       }
       if((!GetIsObjectValid(GetObjectByTag("handmaiden"))) && (GetGlobalNumber("000_Handmaid_Joined") == 1))
       {
           object oNPC = GetObjectByTag("handmaiden");
           object oWP = GetObjectByTag("WP_gspawn_handmaiden");
           if(GetIsObjectValid(oWP))
           {
               AssignCommand(oNPC, ClearAllActions());
               AssignCommand(oNPC, ActionJumpToLocation(GetLocation(oWP)));
               DelayCommand(0.2, DoSpecialReset(oNPC, "003EBO"));
           }[/color]
           else
           {
               AurPostString("RESET EBONHAWK: Handmaid: invalid waypoint!", 15,15,10.0);
           }
       }
   }

   object oRemote = GetObjectByTag("remote");
   if(GetIsObjectValid(oRemote))
   {
       object oWP = GetObjectByTag("WP_gspawn_" + sTag);
       if(GetIsObjectValid(oWP))
       {
           AssignCommand(oNPC, ClearAllActions());
           AssignCommand(oNPC, ActionJumpToLocation(GetLocation(oWP)));
           DelayCommand(0.2, DoSpecialPuppetReset(oNPC, "003EBO"));
       }
       else
       {
           AurPostString("RESET EBONHAWK: invalid waypoint!", 15,15,10.0);
       }
   }
   //AWD-OEI 10/29/2004
   DestroyVisas();
}

 

Finally, there are special spawn functions called by the script that show up in one more script, k_oei_hench_inc.nss. I will post the ones specific to these two chatacters. I haven't made any changes as of yet.

 

void DoDiscipleSpawnIn(object oPartyMember, string sModuleName)
{
   int In003EBO = (sModuleName == "003EBO");
   int In711KOR = (sModuleName == "711KOR");

   if( In003EBO && (GetGlobalBoolean("003_cutscene_mode") == FALSE) )
   {
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_WALK_RANDOM));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_START_AT_NEAREST));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_PAUSE_RANDOM));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_USE_WAYPOINT_ANIMATION));
       AssignCommand(oPartyMember, SetLocalNumber(OBJECT_SELF, 29, ANIMATION_LOOPING_USE_COMPUTER));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DIALOGUE_END));     //OPTIONAL BEHAVIOR - Fire User Defined Event 1011
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_WAYPOINT_DEACTIVATE, FALSE));//turn waypoints on
       AssignCommand(oPartyMember, GN_WalkWayPoints());
   }
   else if(In711KOR)
   {
       GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED);
       SetMinOneHP(oPartyMember,TRUE);
   }
   else
   {//default spawn in
   }
}

void DoHandmaidenSpawnIn(object oPartyMember, string sModuleName)
{
   int In003EBO = (sModuleName == "003EBO");
   int In711KOR = (sModuleName == "711KOR");

   if( In003EBO && (GetGlobalBoolean("003_cutscene_mode") == FALSE) )
   {
       // JAB-OEI 9/15/04
       AurPostString("k_oei_hench_inc handmaiden spawnin", 19,19,3.0);
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_HEARTBEAT));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_COMBAT_ROUND_END));
       AssignCommand(oPartyMember, GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DIALOGUE_END));//OPTIONAL BEHAVIOR - Fire User Defined Event 1011

   }
   else if(In711KOR)
   {
       GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED);
       SetMinOneHP(oPartyMember,TRUE);
   }
   else
   {//default spawn in
   }
}

 

Now, here's the problem: I thought adding these exceptions would be enough for the game to recognize that those companions are "Valid" if they have been recruited, but I was wrong. Yes, I checked to see if the Numbers were changed appropriately and yes they were.

 

The thing is, because of all these scripts that determine whether or not to spawn these NPCs, I'm convinced it's in the scripts somewhere, rather than hard-coded into the game.

 

Anyone like to venture a guess?

Link to comment
Share on other sites

I don't think the boolean logic is what you want. It is basically going to spawn every time that the object is valid, your added checks have no real effect.

 

This should be correct logic, even though it's a little weird

 

        int doSpawn = (aNPC_CONSTANT != 11 || GetGlobalNumber("000_Disciple_Joined") == 1) && (aNPC_CONSTANT != 4 || GetGlobalNumber("000_Handmaid_Joined") == 1);

       if(GetIsObjectValid(oPartyMember) && doSpawn == TRUE) {

        //new AWD-OEI 10/23/2004
        SetCreatureAILevel(oPartyMember, AI_LEVEL_HIGH);
        return oPartyMember;
       }

 

If the NPC tag is not 11, the NPC will always spawn regardless of the value of the global. If the NPC tag is 11, then it becomes dependent on the global value, which will only spawn if it is equal to 1.

 

(aNPC_CONSTANT != 11 || GetGlobalNumber("000_Disciple_Joined") == 1)

 

The same logic applies to the Handmaiden part. Will always spawn if the tag is not 4, regardless of the global value. If the tag is 4, then it will use the global value to determine whether to spawn.

 

(aNPC_CONSTANT != 4 || GetGlobalNumber("000_Handmaid_Joined") == 1)

 

Lastly, those two pieces of code both have to return true in order to allow a spawn to occur, which as we discussed, will always happen unless NPC tag is 4 and the applicable global is 0, OR NPC tag is 11 and the applicable global is 0. And those are essentially the only two cases in which you don't want NPCs to spawn, correct?

 

EDIT: I am not positive on the syntax. NWScript is pretty terrible in the sense that I think booleans are not technically available and instead are represented as int

Link to comment
Share on other sites

I'm not sure I understand. Do you want them to only spawn exclusively? (Either Disciple or Handmaiden spawns, but not both) or do you want them to spawn if they're in the party? (Disciple spawns if global is set, Handmaiden spawns if global is set)

 

EDIT: If the issue is that SpawnAvailableNPC() returns invalid when one or the other has been already spawned, you may want to check out the code in that method, possibly moving the logic to that method.

Link to comment
Share on other sites

The problem lies in the fact that only one of them can be 'available' or a 'valid' object at a time. Your function first checks for the 'validity' or 'availability' of both NPCs. Right now, what I want is to have both spawn on the ship if both globals are set.

 

Maybe this will help clear things up: Recruiting an NPC makes them valid, which is what the script checks for. Now, in order to make the Disciple available, I have to make the Handmaiden unavailable, because they share the same slot on the party table.

 

Does this help at all?

Link to comment
Share on other sites

The problem lies in the fact that only one of them can be 'available' or a 'valid' object at a time. Your function first checks for the 'validity' or 'availability' of both NPCs. Right now, what I want is to have both spawn on the ship if both globals are set.

 

Maybe this will help clear things up: Recruiting an NPC makes them valid, which is what the script checks for. Now, in order to make the Disciple available, I have to make the Handmaiden unavailable, because they share the same slot on the party table.

 

Does this help at all?

 

If you could paste the code inside SpawnAvailableNPC, I think it would help me understand the full situation.

Link to comment
Share on other sites

In case this is what you mean:

 

// 698. SpawnAvailableNPC
// This spawns a NPC from the list of available creatures
// Returns a pointer to the creature object

object SpawnAvailableNPC( int nNPC, location lPosition );

 

I'm not sure if this is what you wanted.

 

I could totally be wrong, but it looks like it checks for the availability before the 'validity', which in this case are the same thing.

 

EDIT: If this isn't what you are looking for,

Show spoiler
(hidden content - requires Javascript to show)
I'm on Skype.
Link to comment
Share on other sites

In case this is what you mean:

 

// 698. SpawnAvailableNPC
// This spawns a NPC from the list of available creatures
// Returns a pointer to the creature object

object SpawnAvailableNPC( int nNPC, location lPosition );

 

I'm not sure if this is what you wanted.

 

I could totally be wrong, but it looks like it checks for the availability before the 'validity', which in this case are the same thing.

 

So if I have Handmaiden and Disciple in my party, and I call these consecutively:

 

object oHandmaiden = SpawnAvailableNPC(4, somewhere);
object oDisciple = SpawnAvailableNPC(11, somewhere);

 

Will one of them be invalid? Will oDisciple be invalid since i spawned oHandmaiden first? If I reversed the order, would oHandmaiden be invalid?

 

EDIT: I don't believe I have your skype

Link to comment
Share on other sites

Alright, VP helped find my problem, and so now I come to you with the first non-problem question since the first post.

 

Is there a way to write a script that checks the enabled/disabled status of party selection? As in, you open up the Party Selection screen, but you can't add or remove NPCs from your party.

Link to comment
Share on other sites

// 15: Returns whether the current area is escapable or not
// TRUE means you can not escape the area
// FALSE means you can escape the area
int GetAreaUnescapable();

As far as I can recall, it's limited to each area. Some levels are set like that in the module file, some are triggered with a script (for example, Nar Shaddaa when you have to go meet Visquis). In the latter case, I believe the area scripts check a global for this, and then set each area to unescapable when you enter it, but there's no universal "you can't change party members" thing, unless you figure out what global it is and check for that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...