Author Topic: Conversation Start @ Certain NPC Death  (Read 464 times)

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« on: November 09, 2010, 11:52:49 pm »


               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?
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #1 on: November 09, 2010, 11:59:42 pm »


               Would the PC you want to start the convo with be the killer of the NPC?
               
               

               
            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #2 on: November 10, 2010, 12:04:29 am »


               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.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #3 on: November 10, 2010, 12:14:46 am »


               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.  



               
               

               
            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #4 on: November 10, 2010, 12:20:36 am »


               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 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #5 on: November 10, 2010, 12:44:52 am »


               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 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #6 on: November 10, 2010, 01:32:12 am »


               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 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #7 on: November 10, 2010, 01:59:17 am »


               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 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #8 on: November 10, 2010, 03:46:51 am »


               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.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #9 on: November 10, 2010, 04:01:47 am »


               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 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #10 on: November 10, 2010, 04:36:07 am »


               Thanks much!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #11 on: November 10, 2010, 04:38:01 am »


               bump.

added better information above.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #12 on: November 10, 2010, 01:29:21 pm »


               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 .
                     
                  


            

Legacy_Werthers Chewbackas

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
Conversation Start @ Certain NPC Death
« Reply #13 on: November 10, 2010, 11:50:07 pm »


               Thanks much. I was able to throw in a delay with Lightfoot's explanation.