DarthJebus05 Posted May 5, 2008 Share Posted May 5, 2008 For my mod, Revans Choice, I want a NPC to say one line (not in a actual conversation, but in the blue box that pops up when you talk to random NPC's) and then attack. I want the NPC to say it when it SEES/NOTICES the PC. But it can only be triggered if a certain party member is in the party. Example: *PC and Carth are walking through Taris* *A bounty hunter sees Carth* The blue box pops up and you see the message: "It's Carth!" and he attacks you. But if Carth isn't in the party, the Bounty hunter wont attack you or say that message. Thanks, Jebus Link to comment Share on other sites More sharing options...
Papership Posted May 5, 2008 Share Posted May 5, 2008 Without Kotor on this machine I can't be terribly specific. But what you need to do is... well, there are a few ways. But if you want the npc only to attack based on the condition of someone in the party, then you'll want to set the faction to neutral (5) in the .utc, using k-tool or kgiff. Then have an "OnNotice" script. (i'm not sure if OnNotice works if the NPC isn't hostile) The script will be something like; void main() { //check if member is in party, ie NPC_CARTH if IsNPCPartyMember(NPC_CARTH)== TRUE { object oNPC1 = GetObjectByTag("your_npcname"); //change hostile. This bit doesn't have to be a delay command, // but if you want the NPC to speak before attacking, then you //can delay the faction change by say 3 seconds. Pick a number. DelayCommand(3.0, ChangeToStandardFaction(oNPC1, 1)); //start the conversation file ActionStartConversation(oNPC1); } } By the way, that blue box you want happens if there is only 1 red line of NPC text in the dialog (with no blue player responses/continues). So just have what you want the NPC to say in that one red line of the dlg, and it should work. Alternatively, if you want to use OnNotice but it doesnt work when neutral, you can set the NPC to hostile (faction 1) then have the conditional bit of script set the NPC to neutral (5) if the member ISNT in the party. OR you can have the script act OnHeartbeat, but you'll have to set a range/distance conditional, so he doesn't say the line when you're still the other side of the module. This script might not be perfect. I don't have kotor here, and am waffling off my head. But it should be the right ballpark! GL ~Paper~ Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 6, 2008 Author Share Posted May 6, 2008 Thanks a lot mate, much appreciated. Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 23, 2008 Author Share Posted May 23, 2008 Okay, I finally got the time to try it, there is only one error: void main() { //check if member is in party, ie NPC_CARTH if IsNPCPartyMember(NPC_CARTH)== TRUE { object oNPC1 = GetObjectByTag("SithPatrol023"); //change hostile. This bit doesn't have to be a delay command, // but if you want the NPC to speak before attacking, then you //can delay the faction change by say 3 seconds. Pick a number. DelayCommand(3.0, ChangeToStandardFaction(oNPC1, 1)); } } The error is: Syntax Error at "IsNPCPartyMember Any ideas? Thanks, Jebus Link to comment Share on other sites More sharing options...
zbyl2 Posted May 23, 2008 Share Posted May 23, 2008 I'm not very good scripter but I think I know what is bad. It should be that: if IsNPCPartyMember(NPC_CARTH)== TRUE) And now it should work. Try it. Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 23, 2008 Author Share Posted May 23, 2008 Same error still. Link to comment Share on other sites More sharing options...
Seamhainn Posted May 23, 2008 Share Posted May 23, 2008 The Tag is Carth the TemplateResRef is p_carth. I always mix those two up and never know which one is the appropiate one. But I suck at scripting anyway... Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 23, 2008 Author Share Posted May 23, 2008 Unless I misunderstanding you, Seamhainn, the Tag is meant for the Sith Soldier thats meant to attack on sight. NPC_CARTH is correct... I think. I believe the IsNPCPartyMember is not worded correctly. Link to comment Share on other sites More sharing options...
Seamhainn Posted May 23, 2008 Share Posted May 23, 2008 Ah, okay sorry, my bad. But KotOR-Tool is your friend, so why not use it ;-) . Why don't you use this in-game script: //:: k_con_carthpm /* checks to see if carth is a party member */ //:: Created By: //:: Copyright (c) 2002 Bioware Corp. //:: modified by Aidan, Sept 28,02 //:: updated with the new party functions #include "k_inc_debug" int StartingConditional() { return ((IsNPCPartyMember(NPC_CARTH) == TRUE) && (GetDistanceBetween(GetPCSpeaker(), GetObjectByTag("carth")) <= 10.0)); } Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 23, 2008 Author Share Posted May 23, 2008 Thats why I love you, Seamhainn. Thanks. Link to comment Share on other sites More sharing options...
DarthJebus05 Posted May 24, 2008 Author Share Posted May 24, 2008 One last question: how would I go about putting them both into one script? Link to comment Share on other sites More sharing options...
sekan Posted May 27, 2008 Share Posted May 27, 2008 One last question: how would I go about putting them both into one script? This should work void main() { //check if member is in party, ie NPC_CARTH if ((IsNPCPartyMember(NPC_CARTH) == TRUE) && (GetDistanceBetween(GetPCSpeaker(), GetObjectByTag("carth")) <= 10.0)) { object oNPC1 = GetObjectByTag("your_npcname"); //change hostile. This bit doesn't have to be a delay command, // but if you want the NPC to speak before attacking, then you //can delay the faction change by say 3 seconds. Pick a number. DelayCommand(3.0, ChangeToStandardFaction(oNPC1, 1)); //start the conversation file ActionStartConversation(oNPC1); } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.