Kaidon Jorn 204 Posted January 11, 2023 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! Quote Share this post Link to post Share on other sites
DarthParametric 3,795 Posted January 11, 2023 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. Quote Share this post Link to post Share on other sites
Kaidon Jorn 204 Posted January 11, 2023 Yes, I was wanting to do it in the individual companion dialogs. Alright thanks, I'll work on that. Quote Share this post Link to post Share on other sites
Kaidon Jorn 204 Posted January 11, 2023 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?? Quote Share this post Link to post Share on other sites
DarthParametric 3,795 Posted January 11, 2023 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? Quote Share this post Link to post Share on other sites
Kaidon Jorn 204 Posted January 11, 2023 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. Quote Share this post Link to post Share on other sites
Kaidon Jorn 204 Posted January 14, 2023 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? Quote Share this post Link to post Share on other sites
DarthParametric 3,795 Posted January 14, 2023 It's an added TSL feature that pulls the string specified in the accompanying DLG node. For example: //:: 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. 1 Quote Share this post Link to post Share on other sites