Jump to content

Home

Dialog then attack on sight?


Recommended Posts

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

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

  • 3 weeks later...

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...