Modifié par Alupinu, 26 avril 2012 - 06:15 .
On Death, start conversation (Solved)
Débuté par
Alupinu
, avril 26 2012 03:56
#1
Posté 26 avril 2012 - 03:56
Hey does anybody have a “On Death, start conversation” script? I seem to be stuck on stupid over here can’t get mine to work. Seems like it would be an easy script but maybe not.
#2
Posté 26 avril 2012 - 07:17
Try making a custom call to ExecuteScript() in the default OnDeath right at the top.
Or the reverse: a call to the default in your own custom OnDeath with the same ExecuteScript() function maybe with a short delaycommand(1.0f....)
Or the reverse: a call to the default in your own custom OnDeath with the same ExecuteScript() function maybe with a short delaycommand(1.0f....)
#3
Posté 26 avril 2012 - 07:26
AssignCommand(oPC, ActionStartConversation(oPC, "conv"));
Is that what you were trying? Cant imagine why it wouldnt work...
Is that what you were trying? Cant imagine why it wouldnt work...
#4
Posté 26 avril 2012 - 09:15
onDeath scripts are tricky in that you generally have only a split second before OBJECT_SELF decays.
Mor's suggestion to shunt the calling object off onto another object ( the area-object, say, or an IPoint ) should work. Matt came up with a script that re-fires with a pseudo-heartbeat, an attempt that ensures that post-combat conversation happens: The On Death Conversation Kick Start
i'm not sure what his results were like, but I've done similar w/ groupDeath customScript, that checks if other enemies are around ( within 20 m ) and if so delay the dialog for another 5 seconds, and it hasn't failed ...
Kaldor probably has a good function/script that works well, around here somewhere,
but we need more info to troubleshoot
----
here's the (pruned) script i Used to get Tholapsyx to talk onDeath of the FireGiant King, although please note it gets called by GroupOnDeathExecuteCustomScript( ) & I pray it's rock solid daily ;
nb. MakeConversable( ) removes bad effects that can stop a conversation. Careful, since it can also resurrect a dead critter. SetCommandable( ) is used to prevent a player/ NPC from screwing around while the fades are going on.
- anything more advanced than this, you'll want to use CSL i believe
Mor's suggestion to shunt the calling object off onto another object ( the area-object, say, or an IPoint ) should work. Matt came up with a script that re-fires with a pseudo-heartbeat, an attempt that ensures that post-combat conversation happens: The On Death Conversation Kick Start
i'm not sure what his results were like, but I've done similar w/ groupDeath customScript, that checks if other enemies are around ( within 20 m ) and if so delay the dialog for another 5 seconds, and it hasn't failed ...
Kaldor probably has a good function/script that works well, around here somewhere,
but we need more info to troubleshoot
----
here's the (pruned) script i Used to get Tholapsyx to talk onDeath of the FireGiant King, although please note it gets called by GroupOnDeathExecuteCustomScript( ) & I pray it's rock solid daily ;
#include "ginc_cutscene"
void kL_TalkTholap(object oTholap, object oIPoint, object oPC)
{
SetCommandable(TRUE, oTholap);
MakeConversable(oTholap);
AssignCommand(oTholap, ClearAllActions(TRUE));
AssignCommand(oIPoint, ActionStartConversation(oPC, "3031_tholapsyx", FALSE, FALSE, TRUE, FALSE));
object oPCFacMem = GetFirstFactionMember(oPC);
while (GetIsObjectValid(oPCFacMem))
{
SetCommandable(TRUE, oPCFacMem);
FadeFromBlack(oPCFacMem, 2.0f);
oPCFacMem = GetNextFactionMember(oPC);
}
}
void main()
{
object oIPoint = GetObjectByTag("3033_ip_conversations");
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_CONTROLLED, oIPoint, 1, CREATURE_TYPE_IS_ALIVE, CREATURE_ALIVE_BOTH);
object oPCFacMem = GetFirstFactionMember(oPC);
while (GetIsObjectValid(oPCFacMem))
{
SetCommandable(FALSE, oPCFacMem);
FadeToBlack(oPCFacMem, 3.0f, 5.0f, 0);
oPCFacMem = GetNextFactionMember(oPC);
}
oPC = SetOwnersControlledCompanion(oPC);
MakeConversable(oPC);
ClearPartyActions(oPC, TRUE);
MakeConversable(oIPoint);
AssignCommand(oIPoint, ClearAllActions(TRUE));
object oTholap = GetObjectByTag("3031_tholapsyx");
SetCommandable(FALSE, oTholap);
DelayCommand(2.2f, kL_TalkTholap(oTholap, oIPoint, oPC));
}nb. MakeConversable( ) removes bad effects that can stop a conversation. Careful, since it can also resurrect a dead critter. SetCommandable( ) is used to prevent a player/ NPC from screwing around while the fades are going on.
- anything more advanced than this, you'll want to use CSL i believe
#5
Posté 26 avril 2012 - 12:04
I have a custom include script that has a function. I'll dropbox it to you if you are interested.
I like to put in code to get rid of negative effects applied to the speaker, so they don't interfere with the convo, also I like to put in code to remove all areas of effect because sometimes these can interfere with the conversation, for example, a left over wall of fire can inadvertently kill the PC mid-conversation.
I like to put in code to get rid of negative effects applied to the speaker, so they don't interfere with the convo, also I like to put in code to remove all areas of effect because sometimes these can interfere with the conversation, for example, a left over wall of fire can inadvertently kill the PC mid-conversation.
Modifié par M. Rieder, 26 avril 2012 - 12:10 .
#6
Posté 26 avril 2012 - 12:05
I'm not at my modding computer. I'll dropbox it when I get back to it.
The function you will be using has two arguments. The string of the conversation that will be started, and also the name of a local integer that you set on all the creatures in the group that you want to start the conversation when they are dead. The function will fire the conversation specified when all the creatures with the specified integer (set it to 1) are dead. It save a lot of time coding. I haven't tested it out completely, but I pulled all the components straight from TWA2, which was tested heavily, so I think it should work. I'm going to be testing it very soon in its present form.
The function you will be using has two arguments. The string of the conversation that will be started, and also the name of a local integer that you set on all the creatures in the group that you want to start the conversation when they are dead. The function will fire the conversation specified when all the creatures with the specified integer (set it to 1) are dead. It save a lot of time coding. I haven't tested it out completely, but I pulled all the components straight from TWA2, which was tested heavily, so I think it should work. I'm going to be testing it very soon in its present form.
Modifié par M. Rieder, 26 avril 2012 - 12:12 .
#7
Posté 26 avril 2012 - 02:41
I don't know if you will have companions, but you might have to take into consideration in the event a companion lands the killing blow, instead of the PC.
#8
Posté 26 avril 2012 - 04:48
Yep. The function I made gets the owned character of the faction leader of the creature doing the killing. Now, if you have non-party creatures that are helping, then you will run into problems if one of them lands the killing blow. I have to sure up that part of my code still.
#9
Posté 26 avril 2012 - 05:24
Thanks everybody for your replies.
Here’s the background on the situation, should of done this last night but it was late and I was tired.
The PC is speaking with a NPC, suddenly a creature enters the room, battle takes place, creature dies and new conversation opens with the NPC.
Here’s the script I was using or trying to use.
*ScriptStart*
//Put this script OnDeath
#include "x2_inc_compon"
#include "x0_i0_spawncond"
void main()
{
string sDeathScript = GetLocalString(OBJECT_SELF, "DeathScript");
if (sDeathScript != "")
ExecuteScript(sDeathScript, OBJECT_SELF);
int nclass = GetLevelByclass(class_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(nclass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
// Call to allies to let them know we're dead
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
/*if (!GetIsSpirit(OBJECT_SELF))
craft_drop_items(oKiller);*/
object oTarget;
oTarget = GetObjectByTag("c_myconid_leader");
AssignCommand(oTarget, ActionStartConversation(oKiller, "i7_myconidleader2"));
}
*ScriptEnds*
As you can see it’s just an extension of “nw_c2_default7.
Assigning oTarget to an ipoint as kevL’s script suggest sounds interesting, let me try that.
Here’s the background on the situation, should of done this last night but it was late and I was tired.
The PC is speaking with a NPC, suddenly a creature enters the room, battle takes place, creature dies and new conversation opens with the NPC.
Here’s the script I was using or trying to use.
*ScriptStart*
//Put this script OnDeath
#include "x2_inc_compon"
#include "x0_i0_spawncond"
void main()
{
string sDeathScript = GetLocalString(OBJECT_SELF, "DeathScript");
if (sDeathScript != "")
ExecuteScript(sDeathScript, OBJECT_SELF);
int nclass = GetLevelByclass(class_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(nclass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
{
AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);
}
// Call to allies to let them know we're dead
SpeakString("NW_I_AM_DEAD", TALKVOLUME_SILENT_TALK);
//Shout Attack my target, only works with the On Spawn In setup
SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
/*if (!GetIsSpirit(OBJECT_SELF))
craft_drop_items(oKiller);*/
object oTarget;
oTarget = GetObjectByTag("c_myconid_leader");
AssignCommand(oTarget, ActionStartConversation(oKiller, "i7_myconidleader2"));
}
*ScriptEnds*
As you can see it’s just an extension of “nw_c2_default7.
Assigning oTarget to an ipoint as kevL’s script suggest sounds interesting, let me try that.
Modifié par Alupinu, 26 avril 2012 - 05:30 .
#10
Posté 26 avril 2012 - 05:37
M. Rieder wrote...
Yep. The function I made gets the owned character of the faction leader of the creature doing the killing. Now, if you have non-party creatures that are helping, then you will run into problems if one of them lands the killing blow. I have to sure up that part of my code still.
I do, the same creature that the conversation opens with will also be helping in the battle.
#11
Posté 26 avril 2012 - 06:14
Hey everybody! I got it to work! I just assigned "oTarget" to an ipoint that I painted down and the script fired perfectly. Also I had to go into the “Nobe” tab and assign all the NPC nodes to the appropriate NPC to get the camera angles to work correctly.
I Like to thank kevL for giving me the ipoint idea and the rest of you Morbane, Matt and Dorteen for taking the time to help me with my little problem – Thank you.
I Like to thank kevL for giving me the ipoint idea and the rest of you Morbane, Matt and Dorteen for taking the time to help me with my little problem – Thank you.
#12
Posté 26 avril 2012 - 06:59
the IPoint is a common method in the OC ( too common sometimes; they really go nutz with it for some functions )
- hope the script i posted above gives good ideas. (safeties for issues others pointed out !) of note, is the def'n for oPC ... it's not perfect but it bypasses the infamous GetFirstPC( ) tale, and means that if an NPC is the actual oKiller the dialog starts with the PC anyway
glad yer movin' forward, Alu
- hope the script i posted above gives good ideas. (safeties for issues others pointed out !) of note, is the def'n for oPC ... it's not perfect but it bypasses the infamous GetFirstPC( ) tale, and means that if an NPC is the actual oKiller the dialog starts with the PC anyway
glad yer movin' forward, Alu
#13
Posté 26 avril 2012 - 07:05
Good job. Glad you got it working.





Retour en haut







