Aller au contenu

Photo

How do I get an npc to destroy himself after a conversation?


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

#1
Baishi7

Baishi7
  • Members
  • 23 messages
How do I get an npc to destroy himself after a conversation? here is the script i tried to make. But its not working.

int nInt;
object oTarget;
/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.c...&id=4683&id=625    */
//Put this on action taken in the conversation editor
#include "nw_i0_tool"
void main()
{
object oPC = GetPCSpeaker();
if (GetIsSkillSuccessful(oPC, SKILL_TAUNT, 4))
   {
   ActionSpeakString("Okay, Okay, don't hurt me. Take it");
   ActionGiveItem(GetItemPossessedBy(OBJECT_SELF, "Jirovens_Coin"), oPC);
   RewardPartyXP(45, oPC, FALSE);
   oTarget = OBJECT_SELF;
//Visual effects can't be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP's location instead
   nInt = GetObjectType(oTarget);
   if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), oTarget);
   else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_COM_BLOOD_CRT_RED), GetLocation(oTarget));
   DestroyObject(oTarget, 3.0);
   }
else
   {
   ActionSpeakString("HA, HA, ohh, I'm so scared.");
   }
}

Modifié par Baishi7, 21 juillet 2010 - 11:02 .


#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
change Object oPC = GetPCSpeaker;



To : object oPC = GetLastPCSpeaker;





If you want the script to just work by clicking on the NPC without starting a conversation window.

place the script in the OnConversation Event on the NPC.


#3
Genisys

Genisys
  • Members
  • 525 messages
SetPlotFlag(oTarget, FALSE);
DestroyObject(oTarget, 3.0f); - NOT THIS >>> DestroyObject(oTarget, 3.0);

God is in the Details...

(by "A famous Architech")

Modifié par Genisys, 21 juillet 2010 - 11:49 .


#4
KooKoo88

KooKoo88
  • Members
  • 151 messages
Make him super sad.

#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Genisys wrote...

SetPlotFlag(oTarget, FALSE);

The DestroyObject function does not care If the object is set to plot or not. The Plot flag only stops things from dieing from combat.  Now if you stated to  SetIsDestroyable (TRUE);  You could be onto something. 

 
DestroyObject(oTarget, 3.0f); - NOT THIS >>> DestroyObject(oTarget, 3.0);


There is no differance between the two statments above.  They do and are compiled to the exact same thing.

God is in the Details...

(by "A famous Architech")



#6
Genisys

Genisys
  • Members
  • 525 messages
I stand corrected, doh!

#7
Baishi7

Baishi7
  • Members
  • 23 messages


This line object oPC = GetLastPCSpeaker;

causes



ERROR: VARIABLE DEFINED WITHOUT TYPE

#8
Baishi7

Baishi7
  • Members
  • 23 messages
and ERROR: PARSING VARIABLE LIST

#9
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
object oPC = GetLastPCSpeaker();

#10
Baishi7

Baishi7
  • Members
  • 23 messages
ok the variable defined error went away but the ERROR: PARSING VARIABLE LIST is still there

#11
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Ooops. I goofed too. Should be: object oPC = GetLastSpeaker();




#12
Baishi7

Baishi7
  • Members
  • 23 messages
DING DING!! That's it. Thnaks for the help everyone.