I'll assume the problem is that you aren't getting your script to fire and that the block of cutscene code is correct.
This can all be done in the OnDeath script for the NPC quest givers.
Get the name of the OnDeath script for the NPC quest givers. I'll assume the name is "npc_death". Also I'll assume that you have 5 NPCs you are watching to die.
Make a new OnDeath script with a different name like "npc_death2".
void Main()
{
ExecuteScript( "npc_death");
object mod = GetModule();
int deadCnt = GetLocalInt(mod,"deadCnt");
SetLocalInt(mod,"deadCnt",deadCnt+1);
if( deadCnt == 4 )
{
//do the end stuff here
object pc = GetFirstPC();
AssignCommand( pc, ClearAllActions());
SetCutsceneMode(pc, TRUE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneDominated(), pc, 100.0f);
SetCameraMode(pc, CAMERA_MODE_TOP_DOWN);
DelayCommand (2.0f, AssignCommand(pc, FadeToBlack(pc, FADE_SPEED_SLOWEST)));
DelayCommand (3.0f, AssignCommand(pc, EndGame("")));
}
}
I haven't run this because I'm not at home. But the idea is sound and the code is close to what you need.
The variable used is called "deadCnt" and is on the module object.
It defaults to 0 so no need to set it at module startup.
Each time one of the selected NPCs dies they will increment the deadCnt.
When the 5th one dies the deadCnt will already be 4 so that will cause the block of ending code to run.
The name "npc_death" is not going to be the real name so you need to replace that with the real name of the OnDeath script that your NPCs are using.
If the number of NPCs is different than 5 then replace 4 with whatever it is minus 1. So if there were 3 NPCs you would put 2 in place of 4. Because 2 is 3 - 1.
Modifié par Mudeye, 16 novembre 2010 - 04:11 .