PDA

View Full Version : Script to check if Mira is alone


GeorgNihilus
07-15-2007, 01:42 AM
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?

thanks on advance :thmbup1:

stoffe
07-15-2007, 07:04 AM
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);
}

GeorgNihilus
07-15-2007, 03:57 PM
Thanks Stoffe :), it works ... and yes, it was for a dialog conditional, in Mira's dlg. I'm gonna use it for another single party member dialogs in fact ... :urpdude:

GeorgNihilus
07-27-2007, 02:51 PM
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:

stoffe
07-27-2007, 03:29 PM
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.

Mindtwistah
08-01-2007, 05:31 PM
What is the script to check if Mira is in your Party?

stoffe
08-01-2007, 07:11 PM
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! ...
}

GeorgNihilus
08-03-2007, 08:12 PM
int GetIsPlayerMadeCharacter(object oChar) {
return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));
}


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 ...

stoffe
08-03-2007, 08:33 PM
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. :)

GeorgNihilus
08-06-2007, 06:38 PM
OK thanks a lot :nod: ... I finally defined it before the void main() { declaration ... now I can finish those pending dialogs with a single party member ... :cool:

GeorgNihilus
08-11-2007, 09:04 PM
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:

Tupac Amaru
08-13-2007, 05:29 AM
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);
}

stoffe
08-13-2007, 08:42 AM
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.

Tupac Amaru
08-14-2007, 09:03 AM
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.

GeorgNihilus
08-14-2007, 06:37 PM
I see your point Tupac ... still I'm gonna check both options to check that NOT checkbox also ... thanks guys! :)