By default any creature has :
string sDeathScript = GetLocalString(OBJECT_SELF, "DeathScript");
if (sDeathScript != "")
ExecuteScript(sDeathScript, OBJECT_SELF);
So when you create the creature you can do :
object C1 = GetObjectByTag("Creature1");
object C2 = GetObjectByTag("Creature2");
SetLocalString(C1,"DeathScript","mydeathcounter");
SetLocalString(C2,"DeathScript","mydeathcounter");
And now you need “mydeathcounter” script
void main(){
int iDeathCount = GetLocalInt(GetArea(OBJECT_SELF),"DeathCount")+1;
SetLocalInt(GetArea(OBJECT_SELF),"DeathCount",iDeathCount);
if(iDeathCount == 2){
AddJournalQuestEntry("nw_mere_dragcult", 5, GetFirstPC(TRUE));
}
else{
SetLocalInt(GetArea(OBJECT_SELF),"DeathCount",iDeathCount);
}
}
That’s the hard way. It 's similar to what has been proposed so far, but it’s more flexible, it’s easy to have more than 2 creature involved, and most importantly it doesn’t mess or change the death script.
Now commes the easy way, you know what ? Obsidian&& Bioware already scripted all this stuff beceause you need that kind of functions all the time. It’s all in the librairy “ginc_group”
on on enter area script or before your encounter.
#include "ginc_group"
void main(){
string sGroup = "TheyWillDie";
object oCreature1 = GetObjectByTag("Creature1");
object oCreature2 = GetObjectByTag("Creature2");
AddToGroup(sGroup,oCreature1);
AddToGroup(sGroup,oCreature2);
GroupOnDeathSetJournalEntry(sGroup,"nw_mere_dragcult",5);
}
There is no limit on the number of creature involved, but the action set on the group needs to be made after you have formed the group.
Check that library there are a lot more action that can be triggered on a group death such starting a conversation or launching a custom script.