There are a number of ways you could to it and it need not be complicated at all.
If the goblins have been generated by an encounter, all you need do is check if the encounter is still active.
Encounters are considerd to still be active not only when a player has not yet entered them but as long as the creatures they generated are still alive. So in the "Text appears when" conversation slot you would put something like:
int StartingConditional()
{
if (GetEncounterActive(GetObjectByTag("ENCOUNTERTAG")));
return FALSE;
return TRUE;
}
Naturally for "ENCOUNTERTAG" substitue whatever tag the relevant encounter is actually using. Thus if the encounter has not been triggered, or has been triggered but not all creatures generated by it have yet been killed, that conversational line will not appear (returns False), otherwise it will (returns True). Note that a script stops running when it comes to a "return." So when setting up a conditional script like this one puts at the end the default (in this case "return TRUE"), what the script does if none of the conditions are met, and before that one or more conditions that could cause it to return false if any are met. When the script comes to a condition that causes it to "return FALSE," it stops and does that, so it will never get to the "return TRUE" at the end. One could also do the opposite, set up a conditional script so it will "return TRUE" (cause the conversational line to appear) if one or more conditions are met, but not otherwise.
If you are using preplaced goblins then make a custom goblin, go to the "OnDeath" slot in its scripts, open the script in that line ("nw_c2_default7", or if the script is "x2" something as some creature have replace it with nw_c2_default7) and add the following to it at or after line 29:
int nCount=GetLocalInt(GetModule(),"DEATHCOUNT");
SetLocalInt(GetModule(),"DEATHCOUNT",nCount+1);
Then USE "SAVE AS" TO SAVE THIS SCRIPT UNDER A DIFFERENT NAME, so the alteration don't apply to every standard creature you place. Actually you should probably save under a new name before making the change, just to be sure, and save again after. Also you don't have to name your integer "DEATHCOUNT", that's just an example, call the part in quotes anything you like. This will cause the variable "DEATHCOUNT" (or whatever you call it) to go up by one every time a creature with this death script is killed. Let's say you've placed ten goblins. If you don't want a conversational line to appear until all ten are killed you would put something like this in the "Text Appears When" script slot for that line:
int StartingConditional()
{
if (GetLocalInt(GetModule(),"DEATHCOUNT")==10)
return TRUE;
return FALSE;
}
Naturally if you are using multiple encounters or a combination of encounters and pre-placed creatures it gets a little more complicated. If you had 10 preplaced plus an encounter you might do something like:
int StartingConditional()
{
object oEncounter=GetObjectByTag("ENCOUNTERTAG");
int nCount=GetLocalInt(GetModule(),"DEATHCOUNT");
if (nCount < 10)
return FALSE;
if (GetEncounterActive(oEncounter));
return FALSE;
return TRUE;
}
Here "oEncounter" and "nCount" are arbitrary names, you could call them something else. It's generally helpful to predefine relevant variables like this as I have done here for simplicity and readability, particularly if you are using the same ones more than once. There are still other methods you might use like looping through various objects to see if any are live goblins but that starts to get beyond the very basics of scripting. Hopefully this gives you an idea of how what you are trying to do might work. If none of this makes any sense, then I refer you again to the tutorials I linked to in my first post.
This website might also be helpful.
Modifié par rogueknight333, 24 juillet 2010 - 12:18 .