Jump to content

Home

Altered script not working


Vox Kalam

Recommended Posts

I added a few things at the end of k_301_enter, but they aren't working:

 

Original:

// Prototypes
string sub3(int intParam1);
object sub2(int intParam1, string stringParam2);
void sub1();

string sub3(int intParam1) {
switch (intParam1) {
	case 0:
		return "atton";
		break;
	case 1:
		return "baodur";
		break;
	case 2:
		return "mand";
		break;
	case 11:
		return "disciple";
		break;
	case 3:
		return "g0t0";
		break;
	case 4:
		return "handmaiden";
		break;
	case 10:
		return "hanharr";
		break;
	case 5:
		return "hk47";
		break;
	case 6:
		return "kreia";
		break;
	case 7:
		return "mira";
		break;
	case 8:
		return "t3m4";
		break;
	case 9:
		return "visasmarr";
		break;
}
return "ERROR";
}

object sub2(int intParam1, string stringParam2) {
string string1;
if ((stringParam2 == "WP_gspawn_")) {
	string string2 = sub3(intParam1);
	if ((string2 == "ERROR")) {
		return OBJECT_INVALID;
	}
	string1 = (stringParam2 + string2);
}
else {
	string1 = stringParam2;
}
object object1 = GetObjectByTag(string1, 0);
object object3;
if (GetIsObjectValid(object1)) {
	object3 = SpawnAvailableNPC(intParam1, GetLocation(object1));
	if (GetIsObjectValid(object3)) {
		SetCreatureAILevel(object3, 3);
		return object3;
	}
}
return OBJECT_INVALID;
}

void sub1() {
SetPartyLeader(0xFFFFFFFF);
int int2 = 0;
while ((int2 < 12)) {
	if (IsNPCPartyMember(int2)) {
		RemoveNPCFromPartyToBase(int2);
	}
	(int2++);
}
}

void main() {
object oEntering = GetEnteringObject();
if ((oEntering == GetFirstPC())) {
	if ((!GetGlobalBoolean("301_FIRST_ENTER"))) {
		SetGlobalBoolean("301_FIRST_ENTER", 1);
		sub1();
		sub2(0, "WP_gspawn_");
		sub2(6, "WP_gspawn_");
		if ((GetNPCSelectability(9) != (-1))) {
			sub2(9, "WP_gspawn_");
		}
		if ((GetNPCSelectability(11) != (-1))) {
			sub2(11, "WP_gspawn_");
		}
		if ((GetNPCSelectability(4) != (-1))) {
			sub2(4, "WP_gspawn_");
		}
	}
	if (GetLocalBoolean(OBJECT_SELF, 30)) {
		return;
	}
	SetLocalBoolean(OBJECT_SELF, 30, 1);
	object oAtton = GetObjectByTag("atton", 0);
	if (GetIsObjectValid(oAtton)) {
		AssignCommand(GetFirstPC(), ClearAllActions());
		AssignCommand(oAtton, ClearAllActions());
		AssignCommand(oAtton, ActionStartConversation(GetFirstPC(), "Arrival", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
	}
	else {
		AurPostString("ERROR: Atton not available!", 5, 16, 10.0);
		return;
	}
}
}

 

New:

// Prototypes
string sub3(int intParam1);
object sub2(int intParam1, string stringParam2);
void sub1();

string sub3(int intParam1) {
switch (intParam1) {
	case 0:
		return "atton";
		break;
	case 1:
		return "baodur";
		break;
	case 2:
		return "mand";
		break;
	case 11:
		return "disciple";
		break;
	case 3:
		return "g0t0";
		break;
	case 4:
		return "handmaiden";
		break;
	case 10:
		return "hanharr";
		break;
	case 5:
		return "hk47";
		break;
	case 6:
		return "kreia";
		break;
	case 7:
		return "mira";
		break;
	case 8:
		return "t3m4";
		break;
	case 9:
		return "visasmarr";
		break;
}
return "ERROR";
}

object sub2(int intParam1, string stringParam2) {
string string1;
if ((stringParam2 == "WP_gspawn_")) {
	string string2 = sub3(intParam1);
	if ((string2 == "ERROR")) {
		return OBJECT_INVALID;
	}
	string1 = (stringParam2 + string2);
}
else {
	string1 = stringParam2;
}
object object1 = GetObjectByTag(string1, 0);
object object3;
if (GetIsObjectValid(object1)) {
	object3 = SpawnAvailableNPC(intParam1, GetLocation(object1));
	if (GetIsObjectValid(object3)) {
		SetCreatureAILevel(object3, 3);
		return object3;
	}
}
return OBJECT_INVALID;
}

void sub1() {
SetPartyLeader(0xFFFFFFFF);
int int2 = 0;
while ((int2 < 12)) {
	if (IsNPCPartyMember(int2)) {
		RemoveNPCFromPartyToBase(int2);
	}
	(int2++);
}
}

void main() {
object oEntering = GetEnteringObject();
if ((oEntering == GetFirstPC())) {
	if ((!GetGlobalBoolean("301_FIRST_ENTER"))) {
		SetGlobalBoolean("301_FIRST_ENTER", 1);
		sub1();
		sub2(0, "WP_gspawn_");
		sub2(6, "WP_gspawn_");
		if ((GetNPCSelectability(9) != (-1))) {
			sub2(9, "WP_gspawn_");
		}
		if ((GetNPCSelectability(11) != (-1))) {
			sub2(11, "WP_gspawn_");
		}
		if ((GetNPCSelectability(4) != (-1))) {
			sub2(4, "WP_gspawn_");
		}
	}
	if (GetLocalBoolean(OBJECT_SELF, 30)) {
		return;
	}
	SetLocalBoolean(OBJECT_SELF, 30, 1);
	object oAtton = GetObjectByTag("atton", 0);
	if (GetIsObjectValid(oAtton)) {
		AssignCommand(GetFirstPC(), ClearAllActions());
		AssignCommand(oAtton, ClearAllActions());
		AssignCommand(oAtton, ActionStartConversation(GetFirstPC(), "Arrival", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0));
	}
	else {
		AurPostString("ERROR: Atton not available!", 5, 16, 10.0);
		return;
object oLocker=CreateObject( OBJECT_TYPE_CREATURE, "Leleeia", Location(Vector(-92.00,24.50,9.6658), 270.0)); 
}
{
object oLocker=CreateObject( OBJECT_TYPE_CREATURE, "Kefran", Location(Vector(-92.00,26.50,9.6658), 270.0));
}
{ 
object oLocker=CreateObject( OBJECT_TYPE_CREATURE, "Shaleena", Location(Vector(-92.00,28.50,9.6658), 270.0)); 
	}
}
{
DelayCommand(2.0,ActionStartConversation(GetFirstPC(),"TAR01enter"));
}
}

 

Edit: forgot to mention, I'm using the altered version in a custom module, from the module editor.

Link to comment
Share on other sites

I added a few things at the end of k_301_enter, but they aren't working:

[snip]
object oLocker=CreateObject( OBJECT_TYPE_CREATURE, "Leleeia", Location(Vector(-92.00,24.50,9.6658), 270.0)); 
}
{
object oLocker=CreateObject( OBJECT_TYPE_CREATURE, "Kefran", Location(Vector(-92.00,26.50,9.6658), 270.0));
}
{ 
object oLocker=CreateObject( OBJECT_TYPE_CREATURE, "Shaleena", Location(Vector(-92.00,28.50,9.6658), 270.0)); 
	}
}
{
DelayCommand(2.0,ActionStartConversation(GetFirstPC(),"TAR01enter"));
}
}

 

The added section contains a bunch of errors. The first line (Leleeia) would never run since it was inside an error condition only triggering if Atton was missing, and below a return; statement which would terminate the script before the line was reached.

 

The other spawn lines had some unnecessary block usage to re-declare the same variable over and over, which was then never used for anything, and as such could be dropped.

 

Finally the startconversation line is attempting to make the area start conversation with the player. Since an area cannot be involved in conversation (unlike creatures and placeables) that line would not do anything. However, even if conversation was started by a creature it wouldn't work or cause trouble since the script already starts another conversation, Arrival, a few lines up, and you can't have two conversations running at the same time. Also, since the line is outside the condition that check if it's the player entering it would try to start that conversation any time any creature is spawned into the area, not just the first time the player enters.

 

[color=PaleGreen]// k_301_enter.nss[/color]
#include "k_inc_glob_party"


void main() {
   object oEntering = GetEnteringObject();
   if (oEntering == GetFirstPC()) {
       if (!GetGlobalBoolean("301_FIRST_ENTER")) {
           SetGlobalBoolean("301_FIRST_ENTER", TRUE);

           ClearPlayerParty();
           SpawnIndividualPartyMember(NPC_ATTON, "WP_gspawn_");
           SpawnIndividualPartyMember(NPC_KREIA, "WP_gspawn_");
           if (GetNPCSelectability(NPC_VISAS) != -1) {
               SpawnIndividualPartyMember(NPC_VISAS, "WP_gspawn_");
           }
           if (GetNPCSelectability(NPC_DISCIPLE) != -1) {
               SpawnIndividualPartyMember(NPC_DISCIPLE, "WP_gspawn_");
           }
           if (GetNPCSelectability(NPC_HANDMAIDEN) != -1) {
               SpawnIndividualPartyMember(NPC_HANDMAIDEN, "WP_gspawn_");
           }
       }
       if (GetLocalBoolean(OBJECT_SELF, 30)) {
           return;
       }
       SetLocalBoolean(OBJECT_SELF, 30, TRUE);
       object oAtton = GetObjectByTag("atton");
       if (GetIsObjectValid(oAtton)) {
           AssignCommand(GetFirstPC(), ClearAllActions());
           AssignCommand(oAtton, ClearAllActions());
           [color=Yellow]AssignCommand(oAtton, ActionStartConversation(GetFirstPC(), "Arrival", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE));[/color]
       }
       else {
           AurPostString("ERROR: Atton not available!", 5, 16, 10.0);
           return;
       }

       CreateObject( OBJECT_TYPE_CREATURE, "Leleeia",  Location(Vector(-92.00, 24.50, 9.67), 270.0)); 
       CreateObject( OBJECT_TYPE_CREATURE, "Kefran",   Location(Vector(-92.00, 26.50, 9.67), 270.0));
       CreateObject( OBJECT_TYPE_CREATURE, "Shaleena", Location(Vector(-92.00, 28.50, 9.67), 270.0)); 

       [color=PaleGreen]// This line is trouble. Another conversation is already started![/color]
       // [color=Yellow]DelayCommand(2.0, AssignCommand(GetFirstPC(), ActionStartConversation( GetFirstPC(), "TAR01enter")));[/color]
   }
}

Link to comment
Share on other sites

I'm lost...How do I fix it? Do I delete the line that starts the other conversation?

And what do I delete for the spawn lines?

 

That depends. What do you want the script to do? What should happen when the player enters the area? Should it happen the first time the player enters, every time, at random, or when some special condition is met?

Link to comment
Share on other sites

First time only. It's all sort of an intro. The mod is a KOTOR II mod in which you visit the ruins of Taris (reused Nar Shadda modules). When you first exit the Ebon Hawk and enter the area, the idea I'm trying to get at is that you see three survivors who have been waiting for five years, one of them Shaleena the outcast from KOTOR I, and a dialogue opens with them.

Link to comment
Share on other sites

First time only. It's all sort of an intro. The mod is a KOTOR II mod in which you visit the ruins of Taris (reused Nar Shadda modules). When you first exit the Ebon Hawk and enter the area, the idea I'm trying to get at is that you see three survivors who have been waiting for five years, one of them Shaleena the outcast from KOTOR I, and a dialogue opens with them.

 

Ah, so it's not a Nar Shaddaa module. :) Then you should use your own OnEnter script for the area and not use the one from Nar Shaddaa.

 

Are any of your party members involved in the into conversation, or it is just the player, whoever tags along with the player, and a bunch of NPCs?

 

I.e. do you need a party huddle sequence like on the landing pad when you first arrive on Nar Shaddaa, or should it be a more "normal" entry? Are the NPCs spawned in the above script involved in this conversation? If so, who has the first line?

Link to comment
Share on other sites

Just you, the two NPCs you just chose from the party selection screen, and the three NPCs spawned. Leleeia opens with a greeting.

 

Try something like this:

// taris_enter.nss

void main() {
   [color=PaleGreen]// ST: Only do it when the player enters[/color]
   if (GetEnteringObject() == GetFirstPC()) {
       [color=PaleGreen]// ST: Make sure this only happens once[/color]
       if (GetLocalBoolean(OBJECT_SELF, 31)) {
           return;
       }
       SetLocalBoolean(OBJECT_SELF, 31, TRUE);

       [color=PaleGreen]// ST: Spawn the NPCs[/color]
       object oLeela = CreateObject( OBJECT_TYPE_CREATURE, "Leleeia",  Location(Vector(-92.00, 24.50, 9.67), 270.0)); 
       CreateObject( OBJECT_TYPE_CREATURE, "Kefran",   Location(Vector(-92.00, 26.50, 9.67), 270.0));
       CreateObject( OBJECT_TYPE_CREATURE, "Shaleena", Location(Vector(-92.00, 28.50, 9.67), 270.0)); 

       [color=PaleGreen]// ST: Start dialog TAR01enter.dlg[/color]
       DelayCommand(0.5, AssignCommand(oLeela, ActionStartConversation( GetFirstPC(), "TAR01enter", FALSE, 0, TRUE)));
   }
}

 

Save as taris_enter.nss (or whatever you like that is not the same as an existing script) and compile, then update the OnEnter field in the .ARE file of the area with the name of this script (without the .ncs extension).

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...