Jump to content

Home

[K1] Two Conditionals on one dialog entry


Robespierre

Recommended Posts

Yes, I'm back. And my cluttering of the forums with my

 

This has been bugging me for a while, and try as I might I can't find a way around it. I need to put, in Kotor 1, two conditional scripts on one dialog entry. Is this possible? Obviously it is in Kotor 2, but is there any trick you can use to combine two conditional scripts such as:

 

int StartingConditional() {
object oWP = GetObjectByTag("swoop_trans", 0);
if ((GetIsObjectValid(oWP)) && (GetDistanceBetween(GetFirstPC(), oWP) < 20.0)) {
	return FALSE;
}
return TRUE;
}

 

And:

 

int StartingConditional() {
return GetGlobalBoolean("Tele_m02ac");

}

 

Please and thank you!

Link to comment
Share on other sites

I think that the only way is to create a new script :

 

int StartingConditional() {
object oWP = GetObjectByTag("swoop_trans", 0);
if ((GetIsObjectValid(oWP)) && (GetDistanceBetween(GetFirstPC(), oWP) < 20.0) && !GetGlobalBoolean("Tele_m02ac")) {
	return FALSE;
}
return TRUE;
}

Link to comment
Share on other sites

Been a while so forgive me if I'm a little rusty :).

 

Could I ask you what context this script is in? So, basically, what are you trying to do with this script?

 

I'm just not sure about your use of GetIsObjectValid(), you see.

Link to comment
Share on other sites

You need one script to join them for K1 :) try this:

 

int StartingConditional() {

object oWP = GetObjectByTag("swoop_trans", 0);

int T = GetGlobalBoolean("Tele_m02ac");

 

if ((GetIsObjectValid(oWP)) && (GetDistanceBetween(GetFirstPC(), oWP) < 20.0) && T == 1) {

return FALSE;

}

return TRUE;

}

 

or ask for T = 0 in the if () according to what you intend to do ... :rolleyes:

 

hope it helps ...

Link to comment
Share on other sites

int StartingConditional() {
object oWP = GetObjectByTag("swoop_trans", 0);
if ((GetIsObjectValid(oWP)) && (GetDistanceBetween(GetFirstPC(), oWP) < 20.0)) {
	return FALSE;
}
return TRUE;
}

 

Ah, this is a nice little code. Basically it removes a dialog entry if you're within a certain distance of an object (in this case my droid). But first it checks that the droid actually exists (otherwise my game went crazy and never showed the dialog entry) - hence the GetIsObjectValid().

 

EDIT: I tried the code, and it doesn't work either. Its still not checking the global boolean.

 

Basically this code checks the distance between the player and a waypoint. Then it checks a global boolean. If the global boolean returns True (or 1) AND the player isn't next to the waypoint, THEN the dialog entry shows. But at the moment its showing the waypoint regardless of whether or not the global boolean is true or false BUT it isn't showing the option if you're standing next to the relevant waypoint. So its half working.

 

Anybody got any ideas?

Link to comment
Share on other sites

Ok, now I know what you are looking for.

You want your dialog to begin only if the boolean is TRUE, the object is valid and the distance is >= 20.0.

So if only one of those conditions is not satisfied, the dialog won't begin.

 

Try this script :

int StartingConditional() {
object oWP = GetObjectByTag("swoop_trans", 0);
if ((!GetIsObjectValid(oWP)) || (GetDistanceBetween(GetFirstPC(), oWP) < 20.0) || (!GetGlobalBoolean("Tele_m02ac"))) {
	return FALSE;
}
return TRUE;
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...