Silveredge9 Posted June 28, 2007 Share Posted June 28, 2007 Hi, I'm having some trouble trying to determine what kind of script I would need to perform a function I intend to use. What I'm trying to do is to have an event activate (For examples sake: Dialogue) when all 3 (and not just 1 or 2) of enemy NPC's have been killed in a fight. Wondering if anybody could suggest a possible script? Any help is appreciated. Link to comment Share on other sites More sharing options...
stoffe Posted June 28, 2007 Share Posted June 28, 2007 Hi, I'm having some trouble trying to determine what kind of script I would need to perform a function I intend to use. What I'm trying to do is to have an event activate (For examples sake: Dialogue) when all 3 (and not just 1 or 2) of enemy NPC's have been killed in a fight. Wondering if anybody could suggest a possible script? Any help is appreciated. You could give the three enemy NPCs a custom OnDeath event script that checks if all three are dead or gone and if so triggers a conversation. For example: void main() { [color=PaleGreen]// Set the tags of the three NPCs here.[/color] object oNPC1 = GetObjectByTag("FirstNPCTag"); object oNPC2 = GetObjectByTag("SecondNPCTag"); object oNPC3 = GetObjectByTag("ThirdNPCTag"); [color=PaleGreen]// Check if all three NPCs are dead or removed.[/color] if ((!GetIsObjectValid(oNPC1) || GetIsDead(oNPC1)) && (!GetIsObjectValid(oNPC2) || GetIsDead(oNPC2)) && (!GetIsObjectValid(oNPC3) || GetIsDead(oNPC3))) { [color=PaleGreen]// Assign the tag of the NPC who dialog should start with here.[/color] object oTalker = GetObjectByTag("NPCToTalkTo"); AssignCommand(oTalker, ClearAllActions()); [color=PaleGreen]// Set the name of the DLG file to use here[/color] AssignCommand(oTalker, ActionStartConversation(GetFirstPC(), "AllDeadDialog", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE)); } [color=PaleGreen]// Standard AI OnDeath shouts and custom event signals.[/color] SpeakString("GEN_I_AM_DEAD", TALKVOLUME_SILENT_TALK); SpeakString("GEN_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK); SignalEvent(OBJECT_SELF, EventUserDefined(1007)); } Link to comment Share on other sites More sharing options...
Silveredge9 Posted June 29, 2007 Author Share Posted June 29, 2007 Yup, the script works fine. Thanks for the help again. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.