I have a conversation starting in the middle of combat using a script, but the NPC keeps dying because not everything stops attacking. I have
AssignCommand(oPC, ClearAllActions(TRUE));
set up for the PC and for the companion (with the companion substituted for oPC), but how do I do the same for the summon creatures? I couldn't find a function for unsummoning/deleting them.
how to remove summoned creatures?
Débuté par
Artfoundry
, mars 28 2011 04:27
#1
Posté 28 mars 2011 - 04:27
#2
Posté 28 mars 2011 - 05:32
Change the NPC's faction to a faction that is neutral to your party and hostilities should automatically cease. You can also set him to plot at that point so that he cannot be killed by any effects.
Regards
Regards
#3
Posté 28 mars 2011 - 05:09
Ok, thanks. So now the NPC's not dying and combat stops, but her conversation doesn't start. Also, at the end of her conversation, I'm trying to get another conversation to start between the PC and companion, but that doesn't start either. However, what's weird is that if I click on the NPC, it initiates her dialog. When hers is done, if I then click on the companion, his initiates. So it's like the game knows it's supposed to do it, but something's holding it back.
Here's the code I have:
oLor is the NPC, oCale is the companion. In the last node of the NPC's conversation, I have an action ga_start_convo to start the conversation with the companion and PC.
Here's the code I have:
SetPlotFlag(oLor, 1);
ChangeToStandardFaction(oLor, STANDARD_FACTION_COMMONER);
AssignCommand(oCale, ClearAllActions(TRUE));
AssignCommand(oPC, ClearAllActions(TRUE));
BeginConversation("conversation_lorvinda_end", oPC, TRUE);
oLor is the NPC, oCale is the companion. In the last node of the NPC's conversation, I have an action ga_start_convo to start the conversation with the companion and PC.
Modifié par Artfoundry, 28 mars 2011 - 05:15 .
#4
Posté 28 mars 2011 - 05:28
Do you need to ClearAllActions(TRUE) for oLor as well?
Also, you may need to assign the command BeginConversation() to the object you want to have converse with oPC (unless the object you want to begin the conversation is the object which is calling the script).
Are you trying to start the second conversation from the first conversation? If so, I believe there is a "ga" script which does this. It may be called "ga_convo_start" or something like that. I've used it before and don't recall having any problems with it.
Also, you may need to assign the command BeginConversation() to the object you want to have converse with oPC (unless the object you want to begin the conversation is the object which is calling the script).
Are you trying to start the second conversation from the first conversation? If so, I believe there is a "ga" script which does this. It may be called "ga_convo_start" or something like that. I've used it before and don't recall having any problems with it.
#5
Posté 28 mars 2011 - 05:29
Oh, you may want to create a neutral faction that no one will attack. If you change the NPC's faction to commoner, and there are other hostiles around, they will begin to attack the NPC.
#6
Posté 28 mars 2011 - 09:27
I think I tried ClearAllActions for oLor with no change, but I'll try again just to be sure.
The script is attached to oLor's OnWounded event, and she's the one who will be talking to the PC, so I think it should work. I did try using AssignCommand(ActionStartConversation()) as well, but that didn't make any difference (though it did work in a different script attached to a different NPC in which I had a conv start with the PC and companion once the NPC was dead).
The second conv. is being started from the last node of the first conv. In that node, in the Actions tab, I have that ga_start_convo script attached. I don't understand why it's not working - I've triple checked the companion tag and conversation tag used in the parameters for that script. It's just odd that it DOES work once I click on the companion (after the first conv. is done).
And no, there are no other hostiles around that are attacking - it's just the NPC, the PC, the companion, and whatever summons they create.
The script is attached to oLor's OnWounded event, and she's the one who will be talking to the PC, so I think it should work. I did try using AssignCommand(ActionStartConversation()) as well, but that didn't make any difference (though it did work in a different script attached to a different NPC in which I had a conv start with the PC and companion once the NPC was dead).
The second conv. is being started from the last node of the first conv. In that node, in the Actions tab, I have that ga_start_convo script attached. I don't understand why it's not working - I've triple checked the companion tag and conversation tag used in the parameters for that script. It's just odd that it DOES work once I click on the companion (after the first conv. is done).
And no, there are no other hostiles around that are attacking - it's just the NPC, the PC, the companion, and whatever summons they create.
#7
Posté 28 mars 2011 - 09:42
The code you posted above, is that the entire code, or just a snippet? If you post the whole thing, it may help.
Is it possible that the first conversation is being stopped before the last node fires? This would explain why the second convo doesn't fire from within the convo.
Is it possible that the first conversation is being stopped before the last node fires? This would explain why the second convo doesn't fire from within the convo.
#8
Posté 31 mars 2011 - 05:11
The script is a modified version of the standard script used for the On Damaged event. Here are my additions:
I commented out the last AssignCommand function because that's an alternate to BeginConversation - I tried both of them.
As for the first conv, I don't think it's stopping, but I suppose it's possible. There are only 4 nodes in that conv, and I see at least 3 of them occur in game. The 3rd one has two action scripts attached - a ga_castspellatobject and a ga_effect. The last node is blank - just an end dialog node with the ga_start_convo script attached to it. Now that I think about it, I can't remember whether "Continue" appears after the 3rd node in the game. I'll have to check that.
object oPC = GetFirstPC();
object oCale = GetNearestObjectByTag("c_human_cale", oPC, 1);
object oLor = GetNearestObjectByTag("n_stepmother", oPC, 1);
if(GetCurrentHitPoints()<15)
{
if (GetCurrentHitPoints(oCale) < 1)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oCale);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oCale)), oCale);
RemoveEffects(oCale);
}
else if (GetCurrentHitPoints(oPC) < 1)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPC)), oPC);
RemoveEffects(oPC);
}
SetPlotFlag(oLor, 1);
ChangeToStandardFaction(oLor, STANDARD_FACTION_COMMONER);
AssignCommand(oCale, ClearAllActions(TRUE));
AssignCommand(oPC, ClearAllActions(TRUE));
// AssignCommand(OBJECT_SELF, ActionStartConversation(oPC, "conversation_lorvinda_end", FALSE, FALSE, TRUE, FALSE));
BeginConversation("conversation_lorvinda_end", oPC, TRUE);
}
I commented out the last AssignCommand function because that's an alternate to BeginConversation - I tried both of them.
As for the first conv, I don't think it's stopping, but I suppose it's possible. There are only 4 nodes in that conv, and I see at least 3 of them occur in game. The 3rd one has two action scripts attached - a ga_castspellatobject and a ga_effect. The last node is blank - just an end dialog node with the ga_start_convo script attached to it. Now that I think about it, I can't remember whether "Continue" appears after the 3rd node in the game. I'll have to check that.
#9
Posté 01 avril 2011 - 04:46
I don't see anything right off. If oLor is the creature that is going to do the conversing then you definitely need to ClearAllActions(TRUE).
When I run into stumpers like this, I start changing stuff one thing at a time. I also add in the line:
FloatingTextStringOnCreature("insert message here",GetFirstPC());
in all my conditionals to see which ones are firing. I put something like "first conditional met" for the message. This lets me see what is going on.
Another thing you can try is to make the PC have a conversation with him/herself. This will let you know if it is a problem with oLor.
I've never used the command BeginConversation, so I don't know much about it. I always use ActionStartConversation().
My first course of action would be to Clear all actions on oLor and go back to using ActionStartConversation to start the conversation.
When I run into stumpers like this, I start changing stuff one thing at a time. I also add in the line:
FloatingTextStringOnCreature("insert message here",GetFirstPC());
in all my conditionals to see which ones are firing. I put something like "first conditional met" for the message. This lets me see what is going on.
Another thing you can try is to make the PC have a conversation with him/herself. This will let you know if it is a problem with oLor.
I've never used the command BeginConversation, so I don't know much about it. I always use ActionStartConversation().
My first course of action would be to Clear all actions on oLor and go back to using ActionStartConversation to start the conversation.
#10
Posté 03 avril 2011 - 12:52
Ok, I finally figured out what was going wrong. The ga_start_convo script at the end of oLor's conversation asks for a target, and in the notes, it says to supply the name of the target that will talk to the PC. So.. I put in c_human_cale, the tag for the companion. But when I switched that to $PC_NEAREST instead, it finally started firing the conv. at the end of the NPC's conv. So for some reason, that parameter doesn't like tags - it prefers the constant. 
And yes, now that I have ClearAllActions and using ActionStartConversation in the NPC's script, her conversation is firing as well. So all is good.
Thanks to all for their help! I think I'm just about done with this module finally!
And yes, now that I have ClearAllActions and using ActionStartConversation in the NPC's script, her conversation is firing as well. So all is good.
Thanks to all for their help! I think I'm just about done with this module finally!
#11
Posté 03 avril 2011 - 01:19
One more thing - at the end of the NPC's conversation, I have her cast a fake spell on herself to give the impression that she's teleporting herself out of the room. She does the spell, then on the next (final) node, I destroy her. But this kind of ruins the illusion because she casts the spell and then remains there until the player clicks (or waits for the conv. to auto advance). I can't destroy her right after the spell though, because then the conversation won't continue since she's no longer there to carry on the conversation. So how do I make it appear that she disappears right after the spell? I tried using ga_effect, but that didn't do anything.
Modifié par Artfoundry, 03 avril 2011 - 01:20 .
#12
Posté 03 avril 2011 - 01:39
Try this:
______________________________________________
void main()
{
object oNPC = GetObjectByTag(place NPC's tag here);
SetScale(oNPC,0.001,0.001,0.001);
}
__________________________________________________
Make a new script with the above code and call it on the node where you want the NPC to disappear. The NPC will become so small that it will be invisible. Than you can destroy it whenever you want.
______________________________________________
void main()
{
object oNPC = GetObjectByTag(place NPC's tag here);
SetScale(oNPC,0.001,0.001,0.001);
}
__________________________________________________
Make a new script with the above code and call it on the node where you want the NPC to disappear. The NPC will become so small that it will be invisible. Than you can destroy it whenever you want.
#13
Posté 03 avril 2011 - 02:18
M. Rieder wrote...
Try this:
______________________________________________
void main()
{
object oNPC = GetObjectByTag(place NPC's tag here);
SetScale(oNPC,0.001,0.001,0.001);
}
__________________________________________________
Make a new script with the above code and call it on the node where you want the NPC to disappear. The NPC will become so small that it will be invisible. Than you can destroy it whenever you want.
Hi Matt,
You may even get away with SetScale(OBJECT_SELF, 0.001,0.001,0.001); if the conversation is attached to the NPC.
Lance.
#14
Posté 03 avril 2011 - 05:19
Yep, that would work too.
#15
Posté 04 avril 2011 - 06:14
This works great - thanks!





Retour en haut






