Fair Strides

Fair Strides' Script Shack

Recommended Posts

Hello all

Would it be possible to convert this script to work for all companions that can be trained as jedi, as well as the pc? So that I could just fire the script from the companion's dialog during the saber building section.

Would that just mean changing GetFirstPC() to GetPCSpeaker() or something like that? Would I need to list them all out by tag? Or making it a case by case basis?

void main() 
{
    
	int int1 = #2DAMEMORY3#;
   
	int int2 = #StrRef4#; 
	string string1 = "if_schematic";

		if ((GetIsInConversation(GetFirstPC()) == 0)) {
			GrantFeat(int1, GetFirstPC() );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetIsInConversation(GetFirstPC()) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", OBJECT_SELF));
        			return;
		}
		
	}
	

Thanks very much!

Share this post


Link to post
Share on other sites

GetPCSpeaker will just grab the player controlled character that is the DLG listener. I think it's probably a holdover from NWN that doesn't really work the same in Odyssey because there is only ever one player.

To cover all companions you'd need a function to do a check of which one you are talking to and then apply the appropriate feat/s (or whatever it is you want to do). Possibly something like GetTag(OBJECT_SELF) - assuming the companion is the DLG owner - and then a series of if statements to run through each case.

Share this post


Link to post
Share on other sites

Yes, I was wanting to do it in the individual companion dialogs. Alright thanks, I'll work on that.

Share this post


Link to post
Share on other sites

Mmmmmmm I don'knowww....

void main() {


	int int1 = 245;
   
	int int2 = 136393; 
	string string1 = "if_schematic";

		if ((GetTag(OBJECT_SELF) == "atton")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetTag(OBJECT_SELF) == "baodur")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetTag(OBJECT_SELF) == "disciple")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetTag(OBJECT_SELF) == "mira")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetTag(OBJECT_SELF) == "kreia")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetTag(OBJECT_SELF) == "visasmarr")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
		if ((GetTag(OBJECT_SELF) == "handmaiden")) {
			GrantFeat(int1, OBJECT_SELF );
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}
}

Will it work? Does being in dialog matter? Will I need else's? Does my butt look big in these pants?

 

Edit: Yeah, no. Froze my game with no UI after the dialog ended. Did i need to put breaks in after every if??

Share this post


Link to post
Share on other sites

Well there's no need for any of that setup if you are just doing the same thing regardless.

Have you ensured that all your values are valid? The added feat exists? The TLK strref exists? The icon exists?

Share this post


Link to post
Share on other sites

You were right. The TLK string ref was wrong but I fixed that but it's still doing the same thing.

I think it has to do with it firing while in conversation. 

 

Haaa!!! IT WORKED!!

void main() {

	int int1 = 245;
	object oAtton = GetObjectByTag("atton", 0);
   	object oBaoDur = GetObjectByTag("baodur", 0);
	object oDisciple = GetObjectByTag("disciple", 0);
	object oMira = GetObjectByTag("mira", 0);
	object oKreia = GetObjectByTag("kreia", 0);
	object oVisas = GetObjectByTag("visasmarr", 0);
	object oHand = GetObjectByTag("handmaiden", 0);
	int int2 = 136379; 
	string string1 = "if_schematic";

	
		if (((GetTag(OBJECT_SELF) == "atton")) && (GetIsInConversation(oAtton) == 0)) {
			GrantFeat(int1, oAtton);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));	
		} 
		if (((GetTag(OBJECT_SELF) == "atton")) && (GetIsInConversation(oAtton) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oAtton));
        			return;
		}
		if (((GetTag(OBJECT_SELF) == "baodur")) && (GetIsInConversation(oBaoDur) == 0)) {
			GrantFeat(int1, oBaoDur);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		} 
		if (((GetTag(OBJECT_SELF) == "baodur")) && (GetIsInConversation(oBaoDur) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oBaoDur));
        			return;
		}
		if (((GetTag(OBJECT_SELF) == "disciple")) && (GetIsInConversation(oDisciple) == 0)) {
			GrantFeat(int1, oDisciple);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		} 
		if (((GetTag(OBJECT_SELF) == "disciple")) && (GetIsInConversation(oDisciple) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oDisciple));
        			return;
		}
		if (((GetTag(OBJECT_SELF) == "mira")) && (GetIsInConversation(oMira) == 0)) {
			GrantFeat(int1, oMira);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		} 
		if (((GetTag(OBJECT_SELF) == "mira")) && (GetIsInConversation(oMira) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oMira));
        			return;
		} 
		if (((GetTag(OBJECT_SELF) == "kreia")) && (GetIsInConversation(oKreia) == 0)) {
			GrantFeat(int1, oKreia);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		} 
		if (((GetTag(OBJECT_SELF) == "kreia")) && (GetIsInConversation(oKreia) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oKreia));
        			return;
		} 
		if (((GetTag(OBJECT_SELF) == "visasmarr")) && (GetIsInConversation(oVisas) == 0)) {
			GrantFeat(int1, oVisas);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		} 
		if (((GetTag(OBJECT_SELF) == "visasmarr")) && (GetIsInConversation(oVisas) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oVisas));
        			return;
		} 
		if (((GetTag(OBJECT_SELF) == "handmaiden")) && (GetIsInConversation(oHand) == 0)) {
			GrantFeat(int1, oHand);
			DelayCommand(1.5, DisplayMessageBox(int2, string1));
		}  
		if (((GetTag(OBJECT_SELF) == "handmaiden")) && (GetIsInConversation(oHand) == 1)) {
			DelayCommand(0.5, ExecuteScript("kj_grant_read", oHand));
        			return;
		}
	}

 

 

EDIT: Never mind it doesn't work. 

 

 

Share this post


Link to post
Share on other sites

Alright.

How is GetScriptStringParameter(); used? Because I have no idea.

Only for items or for objects?

Can you call the tag of a companion in their specific dialog with it?

Share this post


Link to post
Share on other sites

It's an added TSL feature that pulls the string specified in the accompanying DLG node. For example:

TSL_Script_Param.jpg.4b566d15d94a40c19cee2e616f5a1e8b.jpg

//:: c_global_eq
/*
    parameter 1 = string identifier for a global number
    parameter 2 = value to compare to GetGlobalNumber(param1)
    returns TRUE if values are EQUAL.
*/

#include "k_inc_debug"
int StartingConditional()
{
    string tString = GetScriptStringParameter();
    int tInt = GetScriptParameter( 1 );

    if( GetGlobalNumber(tString) == tInt )
    {
        return TRUE;
    }
    return FALSE;
}

It's just a convenience feature that allows global utility scripts to be used across DLGs rather than creating lots of bespoke scripts for simple things like checks of global states.

The above example pulls both an Int parameter and a String parameter from the DLG. The functions are poorly named. They should have been called something like GetDLGStringParameter / GetDLGIntParameter instead.

  • Thanks 1

Share this post


Link to post
Share on other sites

Embrace the freedom of casual encounters on the best dating app in town!
Authentic Ladies Premier Сasual Dating
Prime Сasual Dating

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.