tk102 Posted April 11, 2004 Share Posted April 11, 2004 In researching this thread, I was able to get the Fight - Talk - Fight sequence to work correctly. It might add some flavor to other mods so I'll post what I did that worked for me. First you'll need to create your dialog tree. I suggest writing it out in Notepad or on paper first. Then you can use the beta version of DLGEdit to manufacture the dialog or GFF Editor or whatever. At the point in the dialog where you want to make the NPC fight you, make a reference to a script that contains something like the following: void main() { object oNPC=GetObjectByTag("npc_tag"); ChangeToStandardFaction(oNPC, 1); } In the dialog's StartingList, first create a pointer to the "after fighting" dialog. Then specify the conditional script for this fork. The conditional script should contain something like this: int StartingConditional() { int nResumeTalk = GetLocalBoolean(OBJECT_SELF,0); return nResumeTalk; } The "before fighting" fork should be referenced in the StartingList next, and should not have a script conditional. That should do it for the dialog file. Now you'll need to modify the NPC .utc file. Pop it open in GFF editor and change the Min1HP value to 1. (This prevents death from occurring before we can talk again.) Now change the ScriptSpawn field to point to a new script file that contains the following: #include "k_inc_generic" void main() { //This will make our user-defined event fire GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED); GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT); GN_SetListeningPatterns(); GN_WalkWayPoints(); } Finally, the ScriptUserDefine field should point to a script containing: #include "k_inc_generic" #include "k_inc_utility" void main() { int nCurrentHP; int nUser = GetUserDefinedEventNumber(); if(nUser == 1006) // DAMAGED { nCurrentHP=GetCurrentHitPoints(); if (nCurrentHP<10) { CancelCombat (OBJECT_SELF); ClearAllActions(); ChangeToStandardFaction(OBJECT_SELF, 5); //record that we have fought SetLocalBoolean(OBJECT_SELF,0,TRUE); //Turn off the imortality SetMinOneHP(OBJECT_SELF,FALSE); object oPC=GetFirstPC(); ActionDoCommand(ActionStartConversation(oPC)); } } } Some of the above code may be extraneous, but it works. Now, when the conversation begins, you'll get the fork that causes the fight. You'll fight and just before you deal the death blow, the NPC will stop fighting. Dialog should begin again but it doesn't for me -- but the NPC goes neutral and you can restart the conversation. Edit: I fixed the user-define script so that it does work properly (Nov 12, 2004) The LocalBoolean function will let the dialog file know that you've already fought and should initiate the "after fighting" fork. Link to comment Share on other sites More sharing options...
shosey Posted April 11, 2004 Share Posted April 11, 2004 very cool, this could be quite useful good job Link to comment Share on other sites More sharing options...
whitguy Posted November 13, 2004 Share Posted November 13, 2004 Dialog should begin again but it doesn't for me -- but the NPC goes neutral and you can restart the conversation. [/b] Couldn't you just look at the fight with bastila on the starforge when your playing the light side. Because the same thing happens right? Link to comment Share on other sites More sharing options...
90SK Posted November 13, 2004 Share Posted November 13, 2004 True, or you could scope the Juhani sequence on Dantooine. Never the less, its a good find, tk102, nice work! Link to comment Share on other sites More sharing options...
whitguy Posted November 13, 2004 Share Posted November 13, 2004 Originally posted by CaptainSkye True, or you could scope the Juhani sequence on Dantooine. Never the less, its a good find, tk102, nice work! don't get me wrong its a really cool script im just wondering why he couldn't get it to work so that it will just go right to the DLG. GREAT job TK17 the script is awesome i'm going to use it in my new mod. ___________________________ FIRST THIS THEN THIS HAHAHAHA ___________________________ Link to comment Share on other sites More sharing options...
tk102 Posted November 13, 2004 Author Share Posted November 13, 2004 I've updated the User Define script to automatically resume the conversation. I also fixed a missing set of quotation marks in the OnSpawn script. This a generic technique for use with customized .utc -- it is useful for recruitment mods (eg. Darth Bandon) where the recruitee starts off as hostile. Link to comment Share on other sites More sharing options...
Xavier2 Posted November 13, 2004 Share Posted November 13, 2004 Originally posted by tk102 In the dialog's StartingList, first create a pointer to the "after fighting" dialog. Then specify the conditional script for this fork. The conditional script should contain something like this: int StartingConditional() { int nResumeTalk = GetLocalBoolean(OBJECT_SELF,0); return nResumeTalk; } The "before fighting" fork should be referenced in the StartingList next, and should not have a script conditional. Could you please explain it further? I got lost with some terms... What you mean by pointer to the "after fighting" dialog. Also how The "before fighting" fork should be referenced in the StartingList is done in DLGEditor? Link to comment Share on other sites More sharing options...
tk102 Posted November 13, 2004 Author Share Posted November 13, 2004 The order of your StartingList is important in determining how the dialog is evaluated. Here is how a .dlg might look within GFFEditor. StartingList - 0 - - Active: havefought - - Index: 1 - 1 - - Active: blank - - Index: 0 EntryList - 0 - - Text: Let's fight! - - RepliesList - - - 0 - - - - Index: 0 - 1 - - Text: You are too strong for me - - RepliesList - - - 0 - - - - Index: 1 ReplyList - 0 - - Script: beginfight - - Text: Bring it on. - 1 - - Text: And don't you forget it, Xavier2. In DLGEditor it would look like this (with indices, conditionals, and scripts displayed) my.dlg - <havefought>[E1]You are to strong for me.<> - - <>[R1]And don't you forget it, Xavier2.<> - <>[E0]Let's fight!<> - -<>[R0]Bring it on!<beginfight> Note how the 'after-fighting-fork' is listed first, so that the havefought script can be evaluated. If they haven't fought, the dialog will fall through to the next entry in the startinglist until it finds one that doesn't have a condition or one that evaluates to TRUE. Link to comment Share on other sites More sharing options...
whitguy Posted November 15, 2004 Share Posted November 15, 2004 Hey tk102 i was wondering if you could send me the nss file for these scripts (talk-fight-talk nss files) then it would probobly be easier for me to understand (im not to in to the c++ stuf so i don't really understand some stuff) just check your PM and my e-mail will be there. THANKS ___________________________ FIRST THIS THEN THIS HAHAHAHA ___________________________ Link to comment Share on other sites More sharing options...
Darth333 Posted November 15, 2004 Share Posted November 15, 2004 Well, tk102 gave you everything up there: all you have to do is to copy and paste it in notepad, add the correct tags and save with a .nss extension. And I already gave you the link to the .nss files of my Bandon mod in this thread, just a few days ago: http://www.lucasforums.com/showthread.php?s=&threadid=139989 just change the last line of the band_ud.nss for: ActionDoCommand(ActionStartConversation(oPC)); Link to comment Share on other sites More sharing options...
whitguy Posted November 15, 2004 Share Posted November 15, 2004 Originally posted by Darth333 Well, tk102 gave you everything up there: all you have to do is to copy and paste it in notepad, add the correct tags and save with a .nss extension. And I already gave you the link to the .nss files of my Bandon mod in this thread, just a few days ago: http://www.lucasforums.com/showthread.php?s=&threadid=139989 just change the last line of the band_ud.nss for: ActionDoCommand(ActionStartConversation(oPC)); OK i know that he put every thing up there it just im getting confused about like where i attach the scripts and if i have to put any thing else in the scripts (i have never tryed to do this before and i just want to get it right the first time because if i don't then it takes me a long long time to fxe the problom (cosidering im new at this) and i i don't get very much time to try my mods out because i don't really have my own computer the one im on right now is the family computer and it can't run kotor but the other family computer can but i don't get to go on that one very much so i just want to get it all right the first time. Sorry if im bothering some of you but like i said i would like to get it right the first time. THANKS for all the help though. ___________________________ FIRST THIS THEN THIS HAHAHAHA ___________________________ Link to comment Share on other sites More sharing options...
Darth333 Posted November 15, 2004 Share Posted November 15, 2004 Originally posted by whitguy OK i know that he put every thing up there it just im getting confused about like where i attach the scripts and if i have to put any thing else in the scripts (i have never tryed to do this before and i just want to get it right the first time because if i don't then it takes me a long long time to fxe the problom (cosidering im new at this) This is just normal and experimenting is the only way you will learn something. No one gets it right the first time. You have no idea of all the time tk102 and I spent on the Bandon mod, trying to get this thing working. If you want to learn modding, then you have to put some time and effort. It's all explained above where you have to attach the scripts. If you have doubts, download the Bandon mod and look at where the scripts are attached. You have everything you need in hands. and i i don't get very much time to try my mods out because i don't really have my own computer the one im on right now is the family computer and it can't run kotor but the other family computer can but i don't get to go on that one very much so i just want to get it all right the first time. Everyone here would love to have more time on their own for this kind of stuff. Tk102 and I work full time and we cannot spoonfeed everyone. We like to help people but we also appreciate when they put reasonable efforts. Having always everything right the first time is impossible. So please try with what you presently have in hands and ifyou have difficulties after reasonably trying, post specific questions and people here will be happy to answer them. Now, please let's get back on topic and do not discuss the present post. I will delete any further off-topic posts in this thread since I don't want to close it as it is useful. Link to comment Share on other sites More sharing options...
whitguy Posted November 15, 2004 Share Posted November 15, 2004 ok i'll try thanks for the bandon mod it will really help but i have one more question, were you say code:-------------------------------------------------------------------------------- void main() { object oNPC=GetObjectByTag("npc_tag"); ChangeToStandardFaction(oNPC, 1); } -------------------------------------------------------------------------------- do i just replace the part were it says (npc_tag) or do i also replace the (oNPC, 1) and if i do have to replace the (oNPC, 1) then what do i replace it with? ___________________________ FIRST THIS THEN THIS HAHAHAHA ___________________________ Link to comment Share on other sites More sharing options...
Darth333 Posted November 15, 2004 Share Posted November 15, 2004 Originally posted by whitguy ok i'll try thanks for the bandon mod it will really help but i have one more question, were you say void main() { object oNPC=GetObjectByTag("npc_tag"); ChangeToStandardFaction(oNPC, 1); } do i just replace the part were it says (npc_tag) or do i also replace the (oNPC, 1) and if i do have to replace the (oNPC, 1) then what do i replace it with? You simply replace npc_tag by the tag of your npc (look at the tag field in the .utc file). The 1 after oNPC is to change the faction of your npc to hostile. Link to comment Share on other sites More sharing options...
whitguy Posted November 15, 2004 Share Posted November 15, 2004 Originally posted by Darth333 You simply replace npc_tag by the tag of your npc (look at the tag field in the .utc file). The 1 after oNPC is to change the faction of your npc to hostile. oh ok cool THANKS ___________________________ FIRST THIS THEN THIS HAHAHAHA ___________________________ Link to comment Share on other sites More sharing options...
Xavier2 Posted November 15, 2004 Share Posted November 15, 2004 I have some questions. I am interested in making a boss npc dialog owner to fight after dialog (no need to fight-talk-fight), but also his henchmen npc. So: Originally posted by tk102 At the point in the dialog where you want to make the NPC fight you, make a reference to a script that contains something like the following: void main() { object oNPC=GetObjectByTag("npc_tag"); ChangeToStandardFaction(oNPC, 1); } ] Do i have to make a script for each npc or place all "npc_tag" in between the GetObjectByTag("npc_tag") or should i repeat these comand lines for each npc in the same script? In that case what should it look like? Originally posted by tk102 Now change the ScriptSpawn field to point to a new script file that contains the following: #include "k_inc_generic" void main() { //This will make our user-defined event fire GN_SetSpawnInCondition(SW_FLAG_EVENT_ON_DAMAGED); GN_SetDayNightPresence(AMBIENT_PRESENCE_ALWAYS_PRESENT); GN_SetListeningPatterns(); GN_WalkWayPoints(); } Finally, the ScriptUserDefine field should point to a script containing: #include "k_inc_generic" #include "k_inc_utility" void main() { int nCurrentHP; int nUser = GetUserDefinedEventNumber(); if(nUser == 1006) // DAMAGED { nCurrentHP=GetCurrentHitPoints(); if (nCurrentHP<10) { CancelCombat (OBJECT_SELF); ClearAllActions(); ChangeToStandardFaction(OBJECT_SELF, 5); //record that we have fought SetLocalBoolean(OBJECT_SELF,0,TRUE); //Turn off the imortality SetMinOneHP(OBJECT_SELF,FALSE); object oPC=GetFirstPC(); ActionDoCommand(ActionStartConversation(oPC)); } } } Do i still need to make these other scripts and edit the scripts entrys on the npc.utc? In that case. It means i will have to make a script for each henchmen npc, besides the boss npc? Link to comment Share on other sites More sharing options...
Darth333 Posted November 15, 2004 Share Posted November 15, 2004 Originally posted by Xavier2 I have some questions. I am interested in making a boss npc dialog owner to fight after dialog (no need to fight-talk-fight), but also his henchmen npc. ...blablabla... All you need is this: void main() { object oThug1 = GetObjectByTag("npc1_tag"); object oThug2 = GetObjectByTag("npc2_tag"); object oThug3 = GetObjectByTag("npc3_tag"); ChangeToStandardFaction(oThug1, 1); ChangeToStandardFaction(oThug2, 1); ChangeToStandardFaction(oThug3, 1); } Link to comment Share on other sites More sharing options...
whitguy Posted November 17, 2004 Share Posted November 17, 2004 i need to do the talk fight talk thing but i want it to be one of my party mmbers that fight not me could some one tell me how to do this Link to comment Share on other sites More sharing options...
tk102 Posted November 17, 2004 Author Share Posted November 17, 2004 I need to do the talk fight talk thing but i want it to be one of my party mmbers that fight not me could some one tell me how to do this. Once upon a time Doom_Dealer, Darth333, and myself were experimenting with the values passed to the ChangeToStandardFaction function. We found that these two values: STANDARD_FACTION_PREDATOR STANDARD_FACTION_PREY are hostile to each other but neutral to everyone else. Doom_Dealer implemented this on his Holowan Spire mod where a Jedi and a Dark Jedi are seen fighting each other. Hope this helps. Link to comment Share on other sites More sharing options...
whitguy Posted November 20, 2004 Share Posted November 20, 2004 Originally posted by tk102 STANDARD_FACTION_PREDATOR STANDARD_FACTION_PREY are hostile to each other but neutral to everyone else. ok i got that but now i have a question\problom where do i put it and what do i do with it don't i just make it a script but then where would i put it im getting confused Link to comment Share on other sites More sharing options...
tk102 Posted November 20, 2004 Author Share Posted November 20, 2004 You use those constant values when you call the ChangeToStandardFaction function. This code would make Bastila and Carth fight and you could watch without getting involved. void main() { ChangeToStandardFaction(GetObjectByTag("Carth"),STANDARD_FACTION_PREDATOR); ChangeToStandardFaction(GetObjectByTag("Bastila"),STANDARD_FACTION_PREY); } Link to comment Share on other sites More sharing options...
Xavier2 Posted December 5, 2004 Share Posted December 5, 2004 I would like to turn off the Min1HP of the npc during a dialog and as a part of the following code: [size=1]void main() { object oNPC = GetObjectByTag("my_npc_tag"); ChangeToStandardFaction(oNPC, STANDARD_FACTION_HOSTILE_1); DelayCommand(0.1, AssignCommand(oNPC, ActionAttack( GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC ) ))); }[/size] The solution tk102 came up with is fantastic but is not exactly what i need. Can someone help me? Link to comment Share on other sites More sharing options...
Darth333 Posted December 5, 2004 Share Posted December 5, 2004 You simply insert the following line wherever you want: (it was in tk's first post) SetMinOneHP(oNPC, FALSE); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.