Faction change during conversation
#1
Posté 06 février 2011 - 06:27
Unfortunately, when she changes to hostile, the PC's companion attacks her. I even tried temporarily changing the companion's and PC's factions to a neutral one before changing the NPC's faction, but it didn't help.
#2
Posté 06 février 2011 - 09:11
#3
Posté 06 février 2011 - 09:34
#4
Posté 14 février 2011 - 12:14
PC with companion hit speech trigger that initiates conversation which forces them to enter room containing 2 NPCs. 1 NPC is known enemy and other is friend. During the conversation, the friendly NPC kills the enemy NPC and then turns on the PC. But before she attacks the PC, they need to finish the conversation (PC reacts to the killing and change of NPC's status). One other thing - the conversation has multiple paths, another of which is that the enemy NPC attacks the PC. So, I have a script attached to the enemy NPC's death state that checks to see how he dies by checking the status of the friendly NPC - if she's still friendly (because the enemy attacked before she could change her behavio), when he dies, another conversation starts. If when the check is made, she's no longer friendly, then it's because she attacked him, and nothing further happens (the conversation continues as I stated above). Heh, does that all make sense?
I guess instead of checking her faction, I could maybe check to see who kills the NPC? Is that possible? Then I could just not worry about her faction.
Modifié par Artfoundry, 14 février 2011 - 12:14 .
#5
Posté 14 février 2011 - 01:54
You aren't giving enough information to know all of the use cases, but this will cover some of them.
When you enter the room the enemy NPC should be set to a neutral faction (create a faction called neutral that is 50 to all other factions and 100 to itself). The friendly NPC should be in a friendly faction so you can speak to him/her. You can use a standard faction like commoner for that.
Use Case 1: Friendly NPC attacks enemy NPC and then talks and turns on the party
At the point in the conversation where the friendly NPC and enemy NPC fight change the enemy NPC to a faction that is neutral to you but hostile to the friendly NPC, and change the friendly NPC to a faction that is neutral to you but hostile to the enemy NPC. They will then fight each other without your party being involved. In the death script of the enemy NPC change the friendly NPC faction back to commoner and initiate the post-death conversation. At the end of the conversation change the friendly NPC faction to hostile.
You don't say what should happen if the enemy NPC kills the friendly NPC in the battle. If you want the enemy NPC to attack the party in that case then the death script of the friendly NPC should set the faction of the enemy NPC to hostile.
Use Case 2: Enemy NPC attacks party while friendly NPC is still friendly to party
If the enemy NPC is supposed to attack the party and the friendly NPC stand by and do nothing then set the faction of the friendly NPC so that he/she is neutral to the party and the enemy NPC, and set the enemy NPC so he is hostile to the party but neutral to the friendly NPC. If the friendly NPC is supposed to join in the fight against the enemy NPC then set his/her faction to defender.
You may need several custom factions to make this work. Good luck.
Regards
Modifié par Kaldor Silverwand, 14 février 2011 - 01:56 .
#6
Posté 14 février 2011 - 04:56
There actually is no fight between the two NPCs. I simply have the friendly NPC cast a fake spell and immediately kill off the enemy NPC. Since they're not in a real fight, would I still need another faction in which they're hostile to each other but neutral with the PC?
For case 2, I don't have to worry about it because at that point the PC is supposed to fight the enemy NPC. The friendly NPC just stands by.
#7
Posté 14 février 2011 - 05:05
Artfoundry wrote...
There actually is no fight between the two NPCs. I simply have the friendly NPC cast a fake spell and immediately kill off the enemy NPC. Since they're not in a real fight, would I still need another faction in which they're hostile to each other but neutral with the PC?
For a fake fight you don't need to have them change factions. Just have one cast a fake spell and then destroy the other.
Regards
#8
Posté 14 février 2011 - 05:26
#9
Posté 15 février 2011 - 10:39
During the conversation with the friendly one of two things can happen: (1) the enemy breaks off the conversation and attacks you, (2) the friendly destroys the enemy, talks more with you and then goes hostile.
In the first case just set the enemy to hostile and end the conversation.
In the second case when the friendly npc destroys the enemy set a local integer variable on the friendly npc to indicate he destroyed the enemy npc. His death script should check a local variable on the friendly npc to see if he was destroyed by the friendly npc (see below), and if so then initiate the conversation between the friendly npc and the party again. At the end of that conversation set the friendly npc to hostile. [edit: see next post though. You can do your fake kill without leaving the conversation.]
So you only need to create the neutral faction for the enemy npc and use a local variable on the friendly npc to decide what to do.
Regards
Modifié par Kaldor Silverwand, 15 février 2011 - 03:52 .
#10
Posté 15 février 2011 - 10:44
#11
Posté 22 février 2011 - 12:15
Kaldor Silverwand wrote...
Start the enemy in neutral faction and the friendly in a friendly faction.
During the conversation with the friendly one of two things can happen: (1) the enemy breaks off the conversation and attacks you, (2) the friendly destroys the enemy, talks more with you and then goes hostile.
In the first case just set the enemy to hostile and end the conversation.
In the second case when the friendly npc destroys the enemy set a local integer variable on the friendly npc to indicate he destroyed the enemy npc. His death script should check a local variable on the friendly npc to see if he was destroyed by the friendly npc (see below), and if so then initiate the conversation between the friendly npc and the party again. At the end of that conversation set the friendly npc to hostile. [edit: see next post though. You can do your fake kill without leaving the conversation.]
So you only need to create the neutral faction for the enemy npc and use a local variable on the friendly npc to decide what to do.
Regards
Yes, the variable is what I did before going with this faction change, but it didn't seem to be working. Of course, i could have been doing it wrong. I was setting the variable (tried both local and global) at the beginning of the conversation and then changing it if the friendly went hostile (after killing the enemy NPC). Then I had the enemy death script check for that variable. Maybe I can't set it in the conversation? What was happening was that if the friendly killed the NPC, then it all worked, but if the enemy attacked the PC, after the PC killed the enemy, nothing would happen (the new conv that was supposed to start, wouldn't).
#12
Posté 22 février 2011 - 12:22
Kaldor Silverwand wrote...
Even simpler, why leave the conversation at all? You should be able to have the friendly npc destroy the enemy npc within the conversation and then just continue to the next conversation node. Then there is no need for a special death script for the enemy npc or setting a variable.
I don't leave the conv if the friendly NPC kills the enemy, but for some reason, the companion attacks anyway, and a battle ensues while still in the middle of the conversation.
However, I do need the special death script because if the enemy NPC attacks the PC, then when the enemy NPC dies, I need to check whether the friendly NPC is still around and friendly. If she's around and friendly, then that means the PC killed him and new conversation 1 starts. If she's around but not friendly, then she killed him and orig. conv. continues. If she's not around, then the PC killed him and new conversation 2 starts.
#13
Posté 22 février 2011 - 01:11
Modifié par Artfoundry, 22 février 2011 - 01:11 .
#14
Posté 22 février 2011 - 07:40
This is the code I added to the death script:
object oPC = GetFirstPC();
object oNPC = GetNearestObjectByTag("n_stepmother", oPC, 1);
object oCale = GetNearestObjectByTag("c_human_cale", oPC, 1);
if (GetIsObjectValid(oNPC))
if (GetGlobalInt("factionChange") == 0)
{
AssignCommand(oCale, ClearAllActions(TRUE));
AssignCommand(oCale, ActionStartConversation(oPC, "conversation_cale_finloralive", FALSE, FALSE, TRUE, FALSE));
}
else
{
AssignCommand(oCale, ClearAllActions(TRUE));
AssignCommand(oCale, ActionStartConversation(oPC, "conversation_cale_niledead", FALSE, FALSE, TRUE, FALSE));
}
The first if statement (and its nested if statement ) works. It's the contents of the else statement that's not firing. n_stepmother is the friendly NPC. c_human_cale is the companion. Does that look right?
Modifié par Artfoundry, 22 février 2011 - 07:43 .
#15
Posté 22 février 2011 - 03:46
The two scenarios I've talked about, in which the friendly kills the enemy and in which the PC kills the enemy while the friendly NPC is still around, both work. However, the third scenario, in which the PC kills the enemy and the friendly NPC is NOT around, does not work. After killing the enemy, the new conversation doesn't begin.
Okay, let me "logic" this out, because throughout this I have had a hard time wrapping my head around your scenario. (And I respect that you don't want to give too much away.)
Mise En Scene: You have a place. There is an Enemy NPC. There is a Friend NPC. There is the PC/Party.
Scenario One: Friendly NPC kills Enemy NPC, Friendly NPC still there (meaning still alive and kicking?) conversation starts. Check.
Scenario Two: PC/Party kills Enemy NPC, Friendly NPC still there (meaning still alive and kicking?) conversation starts. Check.
Scenario Three: PC/Party Kills Enemy NPC, Friendly NPC is NOT there, no conversation starts. Check.
I know this is probably just density on my part, but in Scenario Three, exactly who is there to start a conversation with in that situation? Seems to me you don't have someone to start a conversation with and not having one start sounds about right.
Or am I really missing something here?
Like I said, I'm having trouble wrapping my head around the situations as you describe them, because it seems like they are working as anyone might expect, based on your description of the conditions at the end of the fight in each case. Is there someone else to initiate the conversation?
dunniteowl
#16
Posté 22 février 2011 - 06:55
Artfoundry wrote...
Ugh, I spoke too soon. The two scenarios I've talked about, in which the friendly kills the enemy and in which the PC kills the enemy while the friendly NPC is still around, both work. However, the third scenario, in which the PC kills the enemy and the friendly NPC is NOT around, does not work. After killing the enemy, the new conversation doesn't begin.
This is the code I added to the death script:object oPC = GetFirstPC(); object oNPC = GetNearestObjectByTag("n_stepmother", oPC, 1); object oCale = GetNearestObjectByTag("c_human_cale", oPC, 1); if (GetIsObjectValid(oNPC)) if (GetGlobalInt("factionChange") == 0) { AssignCommand(oCale, ClearAllActions(TRUE)); AssignCommand(oCale, ActionStartConversation(oPC, "conversation_cale_finloralive", FALSE, FALSE, TRUE, FALSE)); } else { AssignCommand(oCale, ClearAllActions(TRUE)); AssignCommand(oCale, ActionStartConversation(oPC, "conversation_cale_niledead", FALSE, FALSE, TRUE, FALSE)); }The first if statement (and its nested if statement ) works. It's the contents of the else statement that's not firing. n_stepmother is the friendly NPC. c_human_cale is the companion. Does that look right?
I strongly suggest you use braces with if statements always. Without braces it is not possible to tell if your if/else's are correct or not.. If the second conversation is only supposed to fire when the stepmother is not around then use this:
object oPC = GetFirstPC();
object oNPC = GetNearestObjectByTag("n_stepmother", oPC, 1);
object oCale = GetNearestObjectByTag("c_human_cale", oPC, 1);
if (GetIsObjectValid(oNPC))
{
if (GetGlobalInt("factionChange") == 0)
{
AssignCommand(oCale, ClearAllActions(TRUE));
AssignCommand(oCale, ActionStartConversation(oPC, "conversation_cale_finloralive", FALSE, FALSE, TRUE, FALSE));
} // end if (GetGlobalInt("factionChange") == 0)
} // end if (GetIsObjectValid(oNPC))
else
{
AssignCommand(oCale, ClearAllActions(TRUE));
AssignCommand(oCale, ActionStartConversation(oPC, "conversation_cale_niledead", FALSE, FALSE, TRUE, FALSE));
} // end else
Regards
Modifié par Kaldor Silverwand, 22 février 2011 - 06:58 .
#17
Posté 24 février 2011 - 08:07
dunniteowl wrote...
The two scenarios I've talked about, in which the friendly kills the enemy and in which the PC kills the enemy while the friendly NPC is still around, both work. However, the third scenario, in which the PC kills the enemy and the friendly NPC is NOT around, does not work. After killing the enemy, the new conversation doesn't begin.
Okay, let me "logic" this out, because throughout this I have had a hard time wrapping my head around your scenario. (And I respect that you don't want to give too much away.)
Mise En Scene: You have a place. There is an Enemy NPC. There is a Friend NPC. There is the PC/Party.
Scenario One: Friendly NPC kills Enemy NPC, Friendly NPC still there (meaning still alive and kicking?) conversation starts. Check.
Scenario Two: PC/Party kills Enemy NPC, Friendly NPC still there (meaning still alive and kicking?) conversation starts. Check.
Scenario Three: PC/Party Kills Enemy NPC, Friendly NPC is NOT there, no conversation starts. Check.
I know this is probably just density on my part, but in Scenario Three, exactly who is there to start a conversation with in that situation? Seems to me you don't have someone to start a conversation with and not having one start sounds about right.
Or am I really missing something here?
Like I said, I'm having trouble wrapping my head around the situations as you describe them, because it seems like they are working as anyone might expect, based on your description of the conditions at the end of the fight in each case. Is there someone else to initiate the conversation?
dunniteowl
In Scenario 1, the conversation resumes (not starts) - the kill is part of the conv. Otherwise, yes, you have it correct.
The conversations (and there are two separate ones) in Scenarios 2 and 3 are meant to start with the companion ("Cale").
Kaldor, yes, I put the brackets in - haven't tested it yet, but I will in the next few days.
#18
Posté 24 février 2011 - 01:01
If that's the case, wouldn't you set up a "fall through" series of checks starting with the most likely character to die, then the next most likely and then if there is no NPC, fall through to a default CaleBeginsTalking event? I'm very weak in my script-fu, but logically from what I've been reading that seems to be the general method and most logical format. Maybe something in that could provide a kernal of use?
dunniteowl
#19
Posté 24 février 2011 - 06:19
dunniteowl wrote...
Ah. Now I think I get it. Thanks, so it all STARTS from a conversation and the issues are coming up between the start, then a scuffle, THEN the conversation's continuation afterwards. That right? Even so, though, if the Enemy NPC is dead and the Friendly NPC is "gone," then one of your Companions is supposed to "finish" the conversation in some appropriate manner?
If that's the case, wouldn't you set up a "fall through" series of checks starting with the most likely character to die, then the next most likely and then if there is no NPC, fall through to a default CaleBeginsTalking event? I'm very weak in my script-fu, but logically from what I've been reading that seems to be the general method and most logical format. Maybe something in that could provide a kernal of use?
dunniteowl
Heh, no, you're still confused
Here's what happens:
1) player sees enemy NPC talking to friendly NPC in a room
2) player tries to enter room, but hits a speech trigger, initiating the main conv
3) player immediately gets a choice of whether to barge in or wait and listen
4a) if barging in, two paths are available ultimately:
1. player attacks enemy NPC while friendly NPC stands aside. If player survives, companion initiates new conv
2. friendly NPC kills enemy NPC as part of main conv then resumes conv with PC and eventually attacks PC. If player survives, companion initiates new conv (though different from the one in path 1)
4b) If not barging in, player listens to conv and hears that friendly NPC is actually evil. THEN PC barges in and eventually fights enemy NPC after friendly NPC (no longer friendly though) exits room. If player survives, companion initiates new conv (different from the two listed in 4a)
So, 4a is working, but 4b is not - it works up until the NPC dies - companion does not initiate his conv.
Capiche?
Modifié par Artfoundry, 24 février 2011 - 06:22 .
#20
Posté 24 février 2011 - 07:00
Example:
In your case the opening conversation I would tag something like:
A1_NPCF (for Opening [A]1 conversation starting with NPCF [=Friendly NPC])
The enemy NPC would be labeled NPCE (and of course whatever makes sense for anyone else to do, feel free)
So their conversation might look like this:
A1_1_NPCF : dialog
A1_1_NPCE: dialog
A1_1a_NPCF: dialog
A1_1a_NPCE: dialog
and so forth up to the point where a decision/choice has to come into play. Let's say, that the Barge in Point comes right after hearing just that much dialog above.
The choice point then gets named:
A1_2_NPCE (or NPCF, depending on which character speaks at the choice point)
And you put in your decision matrix and track the split:
They listen:
A1_2a_NPCF (or E, whichever it should be)
A1_2a_NPCE
and so forth to the point where combat is initiated.
Then, when that combat ends, you have, either the NPCE or NPCF still standing, right? so CombatEnd and you check to see who initiates depending on who survives. (I'm still not sure if the NPCe can kill the NPCf in your equation, but let's just flow with it for the moment)
If NPCE still lives
A3_1 convo start
If NPCF still lives
A3_2 convo start.
Then the convo would go:
A3_1a_NPCE
PC respond
A3_1b_NPCE
PC respond
etc.
or:
A3_2a_NPCF
PC respond
yadda yadda yadda to next combat round encounter.
And then, of course, you have to be able to branch back for your Companion (and I am not totally clear on what you're doing, and it doesn't really matter) so that the companion dialog would be something on the order of
A1/A2/A3_1/2/3_CompA (and the slashes are to denote whichever section of dialog would be appropriate, as the naming convention would remain the same to the CompA/B/C set of choices)
It's a bit of work, but I have found it instrumental in preventing me from running into things like you're having taking an awfully long time to troubleshoot. With it all separated and branched out in some other format/medium, I then have the ability to compare notes, look at it from several different angles and will see where I goofed. It's almost always something simple (like I forgot a step, or forgot to name a node properly, etc.)
With this method, it can get convoluted and still be completely under control, because the loops from a previous branch are named and inserted back into the conversation based on their initial brancing conditions and names. It's like using this to follow your door transitions or waypoint makers for pathing.
It's a bit of work and effort to get used to doing it like this, but I have found so far, it saves me greater headaches down the line when I am, by that time, *Really, REALLY* tired and more prone to making mistakes from fatigue or being too close to my work.
I'm guessing you missed attaching the proper node or fall through condition to get the Companion to pipe up at the proper moment.
dunniteowl
*(I hope anyone who finds this method of tracking useful at all will avail themselves of it and modify it to fit their personal requirements.)
#21
Posté 07 mars 2011 - 07:22
Kaldor Silverwand wrote...
I strongly suggest you use braces with if statements always. Without braces it is not possible to tell if your if/else's are correct or not..
Finally got around to testing again, and that was it - adding the braces fixed it - thanks!
Modifié par Artfoundry, 07 mars 2011 - 07:22 .
#22
Posté 08 mars 2011 - 01:39
Regards
#23
Posté 08 mars 2011 - 06:20
Kaldor Silverwand wrote...
Glad to hear it. I'll withhold the orthodonture pun bouncing around in my brain.
Regards
lol, thanks





Retour en haut






