Aller au contenu

Photo

Conversation Start @ Certain NPC Death


  • Veuillez vous connecter pour répondre
13 réponses à ce sujet

#1
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
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?

#2
Baragg

Baragg
  • Members
  • 271 messages
Would the PC you want to start the convo with be the killer of the NPC?

#3
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
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
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.




#5
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
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?

Modifié par Werthers Chewbackas, 10 novembre 2010 - 12:23 .


#6
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
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.

Modifié par Werthers Chewbackas, 10 novembre 2010 - 12:52 .


#7
Baragg

Baragg
  • Members
  • 271 messages
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
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
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"));

Modifié par Werthers Chewbackas, 10 novembre 2010 - 02:23 .


#9
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
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.

#10
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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. .  
  

Modifié par Lightfoot8, 10 novembre 2010 - 04:36 .


#11
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
Thanks much!

#12
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
bump.

added better information above.

#13
Baragg

Baragg
  • Members
  • 271 messages
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
Werthers Chewbackas

Werthers Chewbackas
  • Members
  • 27 messages
Thanks much. I was able to throw in a delay with Lightfoot's explanation.