Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Dialog then attack on sight?

Page: 1 of 1
 DarthJebus05
05-05-2008, 4:14 AM
#1
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
 Papership
05-05-2008, 7:42 AM
#2
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~
 DarthJebus05
05-06-2008, 1:23 AM
#3
Thanks a lot mate, much appreciated.
 DarthJebus05
05-23-2008, 9:06 AM
#4
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
 zbyl2
05-23-2008, 9:19 AM
#5
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.
 DarthJebus05
05-23-2008, 9:41 AM
#6
Same error still.
 Seamhainn
05-23-2008, 9:58 AM
#7
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...
 DarthJebus05
05-23-2008, 10:22 AM
#8
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.
 Seamhainn
05-23-2008, 10:29 AM
#9
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));
}
 DarthJebus05
05-23-2008, 10:46 AM
#10
Thats why I love you, Seamhainn. Thanks.
 DarthJebus05
05-24-2008, 4:54 AM
#11
One last question: how would I go about putting them both into one script?
 sekan
05-27-2008, 9:51 AM
#12
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);
}
}
Page: 1 of 1