lfnetwork.com mark read register faq members calendar

Thread: Script to check if Mira is alone
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 07-15-2007, 12:42 AM   #1
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Question Script to check if Mira is alone

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 , of course I'm not pretty much a scripter ... so can anyone enlighten me about it?

thanks on advance
GeorgNihilus is offline   you may: quote & reply,
Old 07-15-2007, 06:04 AM   #2
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by GeorgNihilus
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 , of course I'm not pretty much a scripter ... so can anyone enlighten me about it?
If this is meant as a dialog conditional script something like this would probably work:

Code:
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);
}
stoffe is offline   you may: quote & reply,
Old 07-15-2007, 02:57 PM   #3
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Post

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 ...
GeorgNihilus is offline   you may: quote & reply,
Old 07-27-2007, 01:51 PM   #4
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Red face

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?

thanks
GeorgNihilus is offline   you may: quote & reply,
Old 07-27-2007, 02:29 PM   #5
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by GeorgNihilus
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:

Code:
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.
stoffe is offline   you may: quote & reply,
Old 08-01-2007, 04:31 PM   #6
Mindtwistah
Junior Member
 
Mindtwistah's Avatar
 
Join Date: Apr 2007
Location: Derka Derka
Posts: 470
What is the script to check if Mira is in your Party?


Mindtwistah is offline   you may: quote & reply,
Old 08-01-2007, 06:11 PM   #7
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Mindtwistah
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:
Code:
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:
Code:
if (IsNPCPartyMember(NPC_MIRA)) {
    // ... Mira is in the party. Let's party! ...
}
stoffe is offline   you may: quote & reply,
Old 08-03-2007, 07:12 PM   #8
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Unhappy Hmmm...

Quote:
Code:
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 ...
GeorgNihilus is offline   you may: quote & reply,
Old 08-03-2007, 07:33 PM   #9
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by GeorgNihilus
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:
Code:
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:
Code:
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):
Code:
int GetIsPlayerMadeCharacter(object oChar) {
    return ((GetFirstPC() == oChar) && (GetTag(oChar) == ""));
}
The script using it:
Code:
#include "myutilities"

void main() {
    if (GetIsPlayerMadeCharacter(GetFirstPC())) {
        SendMessageToPC(GetFirstPC(), "I am The Player! Whoo!");    
    }
}
...whichever you prefer given the situation.

stoffe is offline   you may: quote & reply,
Old 08-06-2007, 05:38 PM   #10
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Wink Interesting ...

OK thanks a lot ... I finally defined it before the void main() { declaration ... now I can finish those pending dialogs with a single party member ...
GeorgNihilus is offline   you may: quote & reply,
Old 08-11-2007, 08:04 PM   #11
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Question

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?

Thanks on advance
GeorgNihilus is offline   you may: quote & reply,
Old 08-13-2007, 04:29 AM   #12
Tupac Amaru
Junior Member
 
Tupac Amaru's Avatar
 
Join Date: Mar 2005
Location: Tahuantinsuyu
Posts: 273
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:
Code:
// Current party consists of Mira, Exile and someone else.
int StartingConditional() {
	return (IsNPCPartyMember(NPC_MIRA) && IsNPCPartyMember(NPC_PLAYER) && GetPartyMemberCount() > 2);
}
Tupac Amaru is offline   you may: quote & reply,
Old 08-13-2007, 07:42 AM   #13
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by GeorgNihilus
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.

stoffe is offline   you may: quote & reply,
Old 08-14-2007, 08:03 AM   #14
Tupac Amaru
Junior Member
 
Tupac Amaru's Avatar
 
Join Date: Mar 2005
Location: Tahuantinsuyu
Posts: 273
Quote:
Originally Posted by stoffe
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.
Tupac Amaru is offline   you may: quote & reply,
Old 08-14-2007, 05:37 PM   #15
GeorgNihilus
Forumite
 
GeorgNihilus's Avatar
 
Join Date: Mar 2007
Location: Somewhere in the Outer Rim
Posts: 582
Current Game: Skyrim
Smile Alright gonna see ...

I see your point Tupac ... still I'm gonna check both options to check that NOT checkbox also ... thanks guys!
GeorgNihilus is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Script to check if Mira is alone

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:30 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.