Jump to content

Home

Script to check if Mira is alone


GeorgNihilus

Recommended Posts

Hi people, I've been trying to modify preexisting game scripts to check if Mira is alone in the party with the PC, but for some reason they're not working :nut: , of course I'm not pretty much a scripter :rolleyes: ... so can anyone enlighten me about it?

 

If this is meant as a dialog conditional script something like this would probably work:

 

int StartingConditional() {
   int iCnt = GetPartyMemberCount();

   if (iCnt != 2)
       return FALSE;

   int bPlayer = FALSE;
   int bMira   = FALSE;
   int i;

   for (i = 0; i < iCnt; i++) {
       if (GetIsPlayerMadeCharacter(GetPartyMemberByIndex(i)))
           bPlayer = TRUE;
       else if (GetTag(GetPartyMemberByIndex(i)) == "Mira")
           bMira = TRUE;
   }

   return (bMira && bPlayer);
}

Link to comment
Share on other sites

  • 2 weeks later...

OK people, now I'm trying to use this script for K1 and I get this error:

 

Compiling: k_con_missionalon.nss

k_con_missionalon.nss(15): Error: Undeclared identifier "GetIsPlayerMadeCharacter"

Compilation aborted with errors

bla bla...

 

that function doesn't exist in K1 right? :( so is there a similar function for K1 or I need a new script for checking if Carth or Mission are alone in the party? :rolleyes:

 

thanks :thumbsup:

Link to comment
Share on other sites

OK people, now I'm trying to use this script for K1 and I get this error:

k_con_missionalon.nss(15): Error: Undeclared identifier "GetIsPlayerMadeCharacter"

 

that function doesn't exist in K1 right? :( so is there a similar function for K1 or I need a new script for checking if Carth or Mission are alone in the party?

 

Yes, that function was added in TSL and does not exist in KOTOR 1.

 

There is no standard function to check if a character is the player character in KOTOR 1, but you can make your own function that should work in normal circumstances, like:

 

int GetIsPlayerMadeCharacter(object oChar) {
   return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));
}

 

...which you would use just like you already tried to do. Just make sure your custom function is either in the top of the script where you want to use it, or in an include file used by that script.

Link to comment
Share on other sites

What is the script to check if Mira is in your Party?

 

If this is for use in a dialog you can use the standard script c_inprty_npc to check. Set the first (P1) parameter to the party slot number of the NPC to check for, as in:

0       Atton
1       BaoDur
2       Mand
3       g0t0
4       Handmaiden
5       hk47
6       Kreia
7       Mira
8       T3m4
9       VisasMarr
10      Hanharr
11      Disciple

 

If it's not for use in a dialog you can check in other scripts like:

if (IsNPCPartyMember(NPC_MIRA)) {
   // ... Mira is in the party. Let's party! ...
}

Link to comment
Share on other sites

all this is the function definition? or only the 1st part till object oChar?? I have an error if I define all this in the first part the script ...

 

It's a custom function that you either need to put above the first place you use it, like:

int GetIsPlayerMadeCharacter(object oChar) {
   return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));
}

void main() {
   if (GetIsPlayerMadeCharacter(GetFirstPC())) {
       SendMessageToPC(GetFirstPC(), "I am The Player! Whoo!");    
   }
}

... or use a forward declaration and put it anywhere in the script, like:

int GetIsPlayerMadeCharacter(object oChar);

void main() {
   if (GetIsPlayerMadeCharacter(GetFirstPC())) {
       SendMessageToPC(GetFirstPC(), "I am The Player! Whoo!");    
   }
}

int GetIsPlayerMadeCharacter(object oChar) {
   return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));
}

...or put it in an include file, like...

 

The include file (myutilities.nss):

int GetIsPlayerMadeCharacter(object oChar) {
   return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));
}

The script using it:

#include "myutilities"

void main() {
   if (GetIsPlayerMadeCharacter(GetFirstPC())) {
       SendMessageToPC(GetFirstPC(), "I am The Player! Whoo!");    
   }
}

 

...whichever you prefer given the situation. :)

Link to comment
Share on other sites

Ok now I want to negate the script in which Mira is alone, to check if she's NOT alone in the active party ... I only change one line in the script in which she is alone (which works) but it's not working ... what's wrong?

 

// c_miranalon

/*

should return true if Mira is NOT alone in the party

*/

 

int GetIsPlayerMadeCharacter(object oChar) {

return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));

}

 

int StartingConditional() {

 

int iCnt = GetPartyMemberCount();

 

if (iCnt != 2)

return FALSE;

 

int bPlayer = FALSE;

int bMira = FALSE;

int i;

 

for (i = 0; i < iCnt; i++) {

if (GetIsPlayerMadeCharacter(GetPartyMemberByIndex(i) ))

bPlayer = TRUE;

else if (GetTag(GetPartyMemberByIndex(i)) != "Mira") //CHANGED SIGN

bMira = TRUE;

}

 

return (bMira && bPlayer);

}

 

I only changeD the sign to "!=" in the line indicated with // ... shouldn't it detect the other member tags that way? :giveup:

 

Thanks on advance :thumbsup:

Link to comment
Share on other sites

You didn't adjust the line that checks the number of party members. This will return true if the Exile, Mira and another NPC are in the party:

// Current party consists of Mira, Exile and someone else.
int StartingConditional() {
return (IsNPCPartyMember(NPC_MIRA) && IsNPCPartyMember(NPC_PLAYER) && GetPartyMemberCount() > 2);
}

Link to comment
Share on other sites

Ok now I want to negate the script in which Mira is alone, to check if she's NOT alone in the active party ...

 

Just check the "Not" checkbox after the conditional script on the dialog node? That will make the node trigger if the conditional script returns false (i.e. Mira is not alone). No need for separate scripts unless I'm overlooking something.

Link to comment
Share on other sites

Just check the "Not" checkbox after the conditional script on the dialog node? That will make the node trigger if the conditional script returns false (i.e. Mira is not alone). No need for separate scripts unless I'm overlooking something.
That wouldn't work here. The original script checks if three conditions are fulfilled. Just negating the script would return true if at least one of the conditions are not fulfilled. This includes the cases where the main character is the only party member or there are any three character in the party (don't have to be Mira) or the Exile is not the first PC.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...