I have been using Lilac Soul's program to a good amount of success except for some random discrepancy where something stopped working until I deleted it and made the exact same thing. I am trying to trigger an NPC to start a conversation with the PC on the death of another NPC. I tried putting the script in the other NPC's "OnDeath" script but so far this hasn't yielded any results. Any suggestions?
Conversation Start @ Certain NPC Death
Débuté par
Werthers Chewbackas
, nov. 09 2010 11:52
#1
Posté 09 novembre 2010 - 11:52
#2
Posté 09 novembre 2010 - 11:59
Would the PC you want to start the convo with be the killer of the NPC?
#3
Posté 10 novembre 2010 - 12:04
Yup and I have it set to reflect on the PC even if his NPC henchman (the NPC starting the conversation) kills the NPC in question. I tried putting in a 10s delay (in case the fact that you can't speak because you're so excited after combat is the reason) but that didn't work either.
#4
Posté 10 novembre 2010 - 12:14
Delays will not work from an OnDeath script. The reason is that the object ( the NPC ) is no longer around after he dies. The delayed command gets erased along with the object it was going to run on.
You will need to assign the command to the other object (the NPC who is going to be doing the talking.)
Could you post the script you are currently trying to get to work.
You will need to assign the command to the other object (the NPC who is going to be doing the talking.)
Could you post the script you are currently trying to get to work.
#5
Posté 10 novembre 2010 - 12:20
void main()
{
object oPC = GetLastKiller();
while (GetIsObjectValid(GetMaster(oPC)))
{
oPC=GetMaster(oPC);
}
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
object oTarget;
oTarget = GetObjectByTag("APsychoticDruid");
AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye"));
}
Maybe I could have my character receive a local integer of 1 on this NPC's death and provide an if conditional that the NPC who starts the conversation checks for on heartbeats to start the conversation?
{
object oPC = GetLastKiller();
while (GetIsObjectValid(GetMaster(oPC)))
{
oPC=GetMaster(oPC);
}
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
object oTarget;
oTarget = GetObjectByTag("APsychoticDruid");
AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye"));
}
Maybe I could have my character receive a local integer of 1 on this NPC's death and provide an if conditional that the NPC who starts the conversation checks for on heartbeats to start the conversation?
Modifié par Werthers Chewbackas, 10 novembre 2010 - 12:23 .
#6
Posté 10 novembre 2010 - 12:44
Loaded a henchman script set to have the NPC actually work as a henchman and now the NPC no longer follows ANY scripts I have created.
No reason anywhere why this should be happening.
No reason anywhere why this should be happening.
Modifié par Werthers Chewbackas, 10 novembre 2010 - 12:52 .
#7
Posté 10 novembre 2010 - 01:32
I reworked the script you posted there, I pulled the do once stuff. Try that as the ondeath of your NPC that has to die. I am not sure about the assign command thing, but try it as it is.
void main()
{
object oPC = GetLastKiller();
object oMaster = GetMaster(oPC);
object oTarget = GetObjectByTag("APsychoticDruid");
if(GetIsObjectValid(oMaster))
{
oPC = oMaster;
}
if (!GetIsPC(oPC)) return;
AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye"));
}
Modifié par Baragg, 10 novembre 2010 - 01:32 .
#8
Posté 10 novembre 2010 - 01:59
Thanks, that worked perfectly. I have to add a delay because you can't talk after combat first. Hopefully it will work after I do.
DelayCommand(15.0,(AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye"));
DelayCommand(15.0,(AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye"));
Modifié par Werthers Chewbackas, 10 novembre 2010 - 02:23 .
#9
Posté 10 novembre 2010 - 03:46
Bump. Can anyone please tell me how to add a DelayCommand script?
I've tried every combination of spacing possible to no avail.
DelayCommand(15.0, AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye")));
Does not work.
I've tried every combination of spacing possible to no avail.
DelayCommand(15.0, AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye")));
Does not work.
#10
Posté 10 novembre 2010 - 04:01
once again you can not delay a command from a death script you have to assign it.
AssignCommand(oTarget, DelayCommand(15.0,ActionStartConversation(oPC, "goodbye")));
EDIT:
I'll try and explain the differance here a little better. When you use
DelayCommand( xx , AssignCommand( oTarget, Action)));
You are telling the current object to wait xx anount of time then tell oTarget to do Action.
The problem with this from the death script is that the original object will not be around in xx amount of time to pass the command to oTarget
AssignCommand( oTarget , DelayCommand( xx, Action)));
Tells the original object to tell oTarget to ( DelayCommand( xx, Action) ) .
In this case the delayed command in now attached to oTarget and in xx amount of time will do the Action.
I hope that make since to you. .
AssignCommand(oTarget, DelayCommand(15.0,ActionStartConversation(oPC, "goodbye")));
EDIT:
I'll try and explain the differance here a little better. When you use
DelayCommand( xx , AssignCommand( oTarget, Action)));
You are telling the current object to wait xx anount of time then tell oTarget to do Action.
The problem with this from the death script is that the original object will not be around in xx amount of time to pass the command to oTarget
AssignCommand( oTarget , DelayCommand( xx, Action)));
Tells the original object to tell oTarget to ( DelayCommand( xx, Action) ) .
In this case the delayed command in now attached to oTarget and in xx amount of time will do the Action.
I hope that make since to you. .
Modifié par Lightfoot8, 10 novembre 2010 - 04:36 .
#11
Posté 10 novembre 2010 - 04:36
Thanks much!
#12
Posté 10 novembre 2010 - 04:38
bump.
added better information above.
added better information above.
#13
Posté 10 novembre 2010 - 01:29
Oh sorry let me add a clearaction to it. I think this should work to clear the excited state. Untested:
void main()
{
object oPC = GetLastKiller();
object oMaster = GetMaster(oPC);
object oTarget = GetObjectByTag("APsychoticDruid");
if(GetIsObjectValid(oMaster))
{
oPC = oMaster;
}
if (!GetIsPC(oPC)) return;
AssignCommand( oPC, ClearAllActions(TRUE));
AssignCommand(oTarget, ActionStartConversation(oPC, "goodbye"));
}
Modifié par Baragg, 10 novembre 2010 - 01:31 .
#14
Posté 10 novembre 2010 - 11:50
Thanks much. I was able to throw in a delay with Lightfoot's explanation.





Retour en haut






