Reztea 34 Posted June 13, 2017 lol I almost didn't mention that because I was like "what are the odds of that!" Anyway, glad it's working now! You saved an entire project, LOL! One final script and the entire project is COMPLETE. How would I go about delaying a conversation from happening in a script? I tried using the DelayCommand but I'm getting parameter mismatches. ( I can never make a script myself , here's my script. void main(){ object oNPC = GetObjectByTag("KreiaEvil"); DelayCommand(2.0, AssignCommand(ActionStartConversation(oNPC, OBJECT_SELF, "FinalKreia")); } A total mess! anyway, any help is appreciated, I'm gonna work on the TSLPatcher now and hopefully I'll have an answer by the time I come back (Because I take long to do everything ) Quote Share this post Link to post Share on other sites
bead-v 251 Posted June 14, 2017 I tried using the DelayCommand but I'm getting parameter mismatches. Your DelayCommand() is fine, the problem is that you put the object you're assigning the action to inside ActionStartConversation() instead of AssignCommand(), and you're missing one ). Here's what it should look like: void main(){ object oNPC = GetObjectByTag("KreiaEvil"); DelayCommand(2.0, AssignCommand(oNPC, ActionStartConversation(OBJECT_SELF, "FinalKreia"))); } Quote Share this post Link to post Share on other sites
DarthRevan101 104 Posted July 1, 2017 Hi there, just wondering if there's a script to unequip all items from a character? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted July 2, 2017 Without knowing which character (whether they're an NPC, the Player, or a party member), here's something: void main() { object oTarget = GetObjectByTag(""); int iSlot; for(iSlot = 0; iSlot <= 19; iSlot++) { if(iSlot >= 14 && iSlot <= 17) { continue; } AssignCommand(oTarget, ActionUnequipItem(GetItemInSlot(iSlot, oTarget), TRUE)); } } That is for KotOR 2. To make it work for KotOR 1, simply change the "iSlot Quote Share this post Link to post Share on other sites
DarthRevan101 104 Posted July 2, 2017 Without knowing which character (whether they're an NPC, the Player, or a party member), here's something: void main() { object oTarget = GetObjectByTag(""); int iSlot; for(iSlot = 0; iSlot <= 19; iSlot++) { if(iSlot >= 14 && iSlot <= 17) { continue; } AssignCommand(oTarget, ActionUnequipItem(GetItemInSlot(iSlot, oTarget), TRUE)); } } That is for KotOR 2. To make it work for KotOR 1, simply change the "iSlot <= 19;" to "iSlot <= 17;" This is for a party member, I should've been more specific. With this script will the items go back to your inventory or just disappear? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted July 2, 2017 This script will simply unequip the items, not destroy them. Also, to make it work, replace the "" in "GetObjectByTag("");" with "", only don't use the marks. 1 Quote Share this post Link to post Share on other sites
DarthRevan101 104 Posted July 2, 2017 This script will simply unequip the items, not destroy them. Also, to make it work, replace the "" in "GetObjectByTag("");" with "<tag of your party member>", only don't use the < > marks. Works great, thanks for the help! Quote Share this post Link to post Share on other sites
Hassat Hunter 571 Posted July 6, 2017 @Reztea: Why are you even MAKING a script for that? Just check the boolean in the conversation using the default boolean check code? (c_glob_bool_set) Quote Share this post Link to post Share on other sites
DarthRevan101 104 Posted July 10, 2017 How could I make it so that a door, after being opened, closes again after a few seconds? (For KotOR I) Quote Share this post Link to post Share on other sites
Kexikus 995 Posted July 10, 2017 In a conversation for some NPC to walk through or when the player opens the door during normal gameplay? Quote Share this post Link to post Share on other sites
djh269 264 Posted July 10, 2017 How could I make it so that a door, after being opened, closes again after a few seconds? (For KotOR I) I used modified Manaan door scripts for my Jolees Hut mod: k_pman_door04.nss (attached to the UTDs OnOpen script tab) void main() { DelayCommand(10.0f,SignalEvent(OBJECT_SELF,EventUserDefined(20))); } k_pman_door05.nss (attached to the UTDs OnUserDefined script tab) void main() { int nEvent = GetUserDefinedEventNumber(); switch (nEvent) { case 20: { float fDistance = GetDistanceToObject(GetNearestObject(OBJECT_TYPE_CREATURE)); if(fDistance >= 0.0 && fDistance <= 3.0) { DelayCommand(10.0f,SignalEvent(OBJECT_SELF,EventUserDefined(20))); } else { ActionCloseDoor(OBJECT_SELF); } } break; } } Quote Share this post Link to post Share on other sites
DarthRevan101 104 Posted July 14, 2017 I used modified Manaan door scripts for my Jolees Hut mod: k_pman_door04.nss (attached to the UTDs OnOpen script tab) void main() { DelayCommand(10.0f,SignalEvent(OBJECT_SELF,EventUserDefined(20))); } k_pman_door05.nss (attached to the UTDs OnUserDefined script tab) void main() { int nEvent = GetUserDefinedEventNumber(); switch (nEvent) { case 20: { float fDistance = GetDistanceToObject(GetNearestObject(OBJECT_TYPE_CREATURE)); if(fDistance >= 0.0 && fDistance <= 3.0) { DelayCommand(10.0f,SignalEvent(OBJECT_SELF,EventUserDefined(20))); } else { ActionCloseDoor(OBJECT_SELF); } } break; } } Thank you! 1 Quote Share this post Link to post Share on other sites
djh269 264 Posted July 14, 2017 Thank you! Some doors have funny animations though, especially the force cages Quote Share this post Link to post Share on other sites
N-DReW25 1,336 Posted July 24, 2017 How can I make it so if my character opens a specific door it will start a conversation with an NPC on the other side of said door? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted July 24, 2017 Assuming this "specific door" is a unique .utd file in the level and only spawned/used once in the .git file, you can attach a script to the OnOpen slot: void main() { if(GetLocalBoolean(OBJECT_SELF, 10) < 0) { SetLocalBoolean(OBJECT_SELF, 10, 1); DelayCommand(0.5, AssignCommand(GetFirstPC(), ActionStartConversation(GetObjectByTag("<tag of NPC>"), "<name of dialog>"))); } } That should work for you. The local boolean stuff is just to make the conversation only activate once. Quote Share this post Link to post Share on other sites
N-DReW25 1,336 Posted July 27, 2017 Assuming this "specific door" is a unique .utd file in the level and only spawned/used once in the .git file, you can attach a script to the OnOpen slot: void main() { if(GetLocalBoolean(OBJECT_SELF, 10) < 0) { SetLocalBoolean(OBJECT_SELF, 10, 1); DelayCommand(0.5, AssignCommand(GetFirstPC(), ActionStartConversation(GetObjectByTag("<tag of NPC>"), "<name of dialog>"))); } } That should work for you. The local boolean stuff is just to make the conversation only activate once. Pretty sure I made a small mistake here, the script is not working. The only way I can actually get my NPC to speak his dialogue is to approach him and start dialogue normally. My tag of NPC is "mod_vulkar01.utc" and the dialogue is "tar03_vulkar031.dlg". Here is my script void main() { if(GetLocalBoolean(OBJECT_SELF, 10) < 0) { SetLocalBoolean(OBJECT_SELF, 10, 1); DelayCommand(0.5, AssignCommand(GetFirstPC(), ActionStartConversation(GetObjectByTag("mod_vulkar01"), "tar03_vulkar031"))); } } I think I may have done something wrong with my script above. I do also have a unique utd in the git so that cannot be the issue (I hope) Quote Share this post Link to post Share on other sites
Kexikus 995 Posted July 27, 2017 The if condition has to be either == 0 or < 1, as the boolean is either 0 or 1, so it'll never be smaller than 0 which is why the condition is never fulfilled in your case. Quote Share this post Link to post Share on other sites
bead-v 251 Posted July 27, 2017 The kotor script doesn't really have a bool data type, it just uses int for it, but still, it's good to think of it separately, having either the value 'true' or 'false'. Since you want the if() to pass if the boolean is false, it's best to write: if ( !GetLocalBoolean(OBJECT_SELF, 10) ) { ... } Or if you only want it to pass if it's true: if ( GetLocalBoolean(OBJECT_SELF, 10) ) { ... } For the same reason, writing this SetLocalBoolean(OBJECT_SELF, 10, TRUE); instead of this SetLocalBoolean(OBJECT_SELF, 10, 1); is better. Logically it's exactly equivalent, TRUE is defined as 1 in nwscript.nss. Using TRUE and FALSE will just help you keep the Boolean and Number functions apart in your mind, and it's more readable when you or somebody else reads the code (after a while). Also, I'm not sure, but Get...Boolean() may not return 1 for when it's true, so you could get in trouble writing GetLocalBoolean() == 1 or GetLocalBoolean() == TRUE. Just keep in mind that Get...Boolean() already returns the true/false value, you don't need to == it. Quote Share this post Link to post Share on other sites
N-DReW25 1,336 Posted July 30, 2017 I am trying to make a Seppuku cutscene where a hostile NPC will reach 1hp then a dialogue will fire and the NPC will perform a Seppuku (Stabbing themselves with a Melee Weapon) and the NPC will drop dead. With that out of the way what are the scripts, I will need to actually fulfill this cutscene? I think I have the 1hp script right here but not the rest void main(){object oPC = GetFirstPC();if(GetCurrentHitPoints(OBJECT_SELF) < 10 && GetStandardFaction(OBJECT_SELF) == STANDARD_FACTION_HOSTILE_1){CancelCombat(OBJECT_SELF);CancelCombat(oPC);ClearAllActions();AssignCommand(oPC, ClearAllActions());ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL);AssignCommand(oPC, ActionStartConversation(OBJECT_SELF, "yourconvo"));}ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_DAMAGE);} Also is it possible to do a Seppuku with a Vibrosword weapon or does it have to be a Lightsaber? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted July 31, 2017 Also, I'm not sure, but Get...Boolean() may not return 1 for when it's true, so you could get in trouble writing GetLocalBoolean() == 1 or GetLocalBoolean() == TRUE. Just keep in mind that Get...Boolean() already returns the true/false value, you don't need to == it. The Local functions (not the global ones, mind you) will either return 0 or NOT 0, so FALSE or !FALSE. It's a weird quirk they seem to have. Mine was originally a typo on that, since the idea was to see if it was > 0, not I am trying to make a Seppuku cutscene where a hostile NPC will reach 1hp then a dialogue will fire and the NPC will perform a Seppuku (Stabbing themselves with a Melee Weapon) and the NPC will drop dead. With that out of the way what are the scripts, I will need to actually fulfill this cutscene? I think I have the 1hp script right here but not the rest Also is it possible to do a Seppuku with a Vibrosword weapon or does it have to be a Lightsaber? In the DLG file in question for that scene (852nih.dlg, second main branch), Visas plays the 1431 Meditate2 animation, assigned from the dialog file itself, not through script. Given that, I don't know if the animation is custom to her model, or the general animation. As for your code, the following should do fine: void main() { object oPC = GetFirstPC(); SetMinOneHP(OBJECT_SELF, TRUE); // Makes it so the NPC can't die. if(GetCurrentHitPoints(OBJECT_SELF) < 10 && GetStandardFaction(OBJECT_SELF) == STANDARD_FACTION_HOSTILE_1) { CancelCombat(OBJECT_SELF); CancelCombat(oPC); ClearAllActions(); AssignCommand(oPC, ClearAllActions()); ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_NEUTRAL); SetMinOneHP(OBJECT_SELF, FALSE); AssignCommand(oPC, ActionStartConversation(OBJECT_SELF, "yourconvo")); } ExecuteScript("k_ai_master", OBJECT_SELF, KOTOR_DEFAULT_EVENT_ON_DAMAGE); } Quote Share this post Link to post Share on other sites
N-DReW25 1,336 Posted July 31, 2017 In the DLG file in question for that scene (852nih.dlg, second main branch), Visas plays the 1431 Meditate2 animation, assigned from the dialog file itself, not through script. Given that, I don't know if the animation is custom to her model, or the general animation. Kreia uses the animation during the Jedi Enclave Scene so I'll hope it's a General Animation. As for your code, the following should do fine: I forgot to mention the dialogue the NPC will mention has a conditional called c_batudead I'll assume I'd need to change my NPC to Minimum 1hp in the Utc file in order for this to work. Two questions where will I place this new script in order for it to work and will the script need the "// Makes it so the NPC can't die." to work or is that there for the sake of direction? Quote Share this post Link to post Share on other sites
DarthRevan101 104 Posted July 31, 2017 Is there a script to level up a party member? I've got a script to give them a Jedi class but it doesn't level them up once they get the class added, so they have to be levelled up in game manually. Is there a script to level up the character by 1 without affecting anyone else? (For KotOR 1) void main() { AddMultiClass( CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("")); } Quote Share this post Link to post Share on other sites
Guingamor 0 Posted August 14, 2017 Hello! I was wondering if someone could tell me how I goofed this line of code; whenever I try to compile it it says 'Error: Syntax error at ","'. Here's the specific line: AssignCommand(GetObjectByTag("Juhani", 0), ActionMoveToLocation((-77.5775390625, -51.8112106323242, 0), 213.749927975663, 0), 0, 1.0); And here's the chunk it's part of, if that's relevant: else { if ((nParam1 == 10)) { AssignCommand(GetObjectByTag("Juhani", 0), ActionMoveToLocation((-77.5775390625, -51.8112106323242, 0), 213.749927975663, 0), 0, 1.0); AssignCommand(GetObjectByTag("Bastila", 0), ActionMoveToObject(GetObjectByTag("wp_bastila_1", 0), 0, 1.0)); } Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted August 14, 2017 I'll assume I'd need to change my NPC to Minimum 1hp in the Utc file in order for this to work. Two questions where will I place this new script in order for it to work and will the script need the "// Makes it so the NPC can't die." to work or is that there for the sake of direction?This script would need to go in the OnDamaged script slot. Also, you will not need to set the Minimum 1 Hp setting in the UTC file, as that's done in the script with the "SetMinOneHP" function. And the "//" denotes a comment in the code, purely for explanation. Is there a script to level up a party member?No, there is no auto-level function, unfortunately. Also, you can l9ck the Party Selection screen with SetAreaUnescapable function. S value of TRUE should disable it and calling the function again with a value of FALSE should re-enable it. Hello! I was wondering if someone could tell me how I goofed this line of code; whenever I try to compile it it says 'Error: Syntax error at ","'. Here's the specific line: AssignCommand(GetObjectByTag("Juhani", 0), ActionMoveToLocation((-77.5775390625, -51.8112106323242, 0), 213.749927975663, 0), 0, 1.0); I don't have the modding tools on me at the moment to look up the functions at the moment, but I know the compiler isn't seeing a valid location and I don't think the 0 inside the location section is required... ActionMoveToLocation(Location(Vector(-77.5775390625, -51.8112106323242, 0.0), 213.749927975663), 0, 1.0); Quote Share this post Link to post Share on other sites
Guingamor 0 Posted August 14, 2017 I don't have the modding tools on me at the moment to look up the functions at the moment, but I know the compiler isn't seeing a valid location and I don't think the 0 inside the location section is required... ActionMoveToLocation(Location(Vector(-77.5775390625, -51.8112106323242, 0.0), 213.749927975663), 0, 1.0); Thank you! But now it says the error is at ";". I think these are the functions? void ActionMoveToLocation(location lDestination, int bRun=FALSE); location Location(vector vPosition, float fOrientation); vector Vector(float x=0.0f, float y=0.0f, float z=0.0f); Quote Share this post Link to post Share on other sites