Part 2.3: Finishing Up the Encounter

Finishing Up the Encounter

Now that I have made sure my scamp will be summoned at the appropriate stage of the quest, I want to deal with the aftermath. While most players will kill the scamp and that will be that, there will always be that smart player who tries to magically calm it instead, or the cowardly one who tries to talk to Kevaar anyway with it chewing away on their back. While in some cases this may be appropriate, Kevaar has a particular fear of scamps after walking into a house with over 1,000 of them crammed inside, and wants the thing dead before he can even think of talking to the player again.

Just like summoning the scamp, there are a couple ways I can do this. Once again, you may want to consider saving your mod now so that you can go back and try each method with a clean .esp. These same methods can also be used as general kill counters, such as when giving the player a quest to kill a certain guy for a Morag Tong writ, or become the next Saint Jiub by slaying 5,000 cliffracers.

First, both methods entail making another special Greeting for Kevaar, intended to block progress while the scamp is still alive This Greeting will have to go in Greeting 1, right after the Oath of Silence Greeting, so that it can't be overriden by anything else. As usual, I will want to condition it for Kevaar. I will also want to be sure to condition it so it only appears during Journal Index 52. Finally, I want to add a Goodbye script into the Results window, so the player can't convince Kevaar to talk to them anyway. The final Greeting will look thus:

The next step is making the game engine aware that the scamp is dead and so the blocked Greeting is no longer necessary. There's a few different methods for determining whether the scamp is dead.

The "Dead" Dialogue-Condition Method

One method of checking for the scamp's death is using the death counter built right into the dialogue window. Opening up the same Greeting I just created above, I will add one more Function/Variable to its conditions. I choose the "Dead" Function, then "TR_scamp" in the next drop-down, then finally < 1.

This means the blocking Greeting only shows when the player hasn't yet killed the scamp. If the player has, the engine skips right past this dialogue, and Kevaar will talk to the player as normal. This is certainly the easiest method, and can also be used when the player must kill more than one type of creature to advance a quest. For instance, maybe not only a scamp attacked, but a clannfear too, and Kevaar also can't stand clannfears because they smell. Or maybe a scamp and a clannfear AND a golden saint attacked, and Kevaar....er. Hold that thought while I retrieve him from the closet...

The OnDeath Script Method

Ahem. The second way to make Kevaar refuse to speak to the player until the scamp dies is to add a script to the scamp. This can be more daunting for new modders, as it involves editing any script I might have placed on the scamp before (such as the Disable script), as well as creating a new journal entry, BUT, because of the journal entry, this method is more useful when killing Creatures or NPCs while out in the field, as the player does not have to return to the questgiver to see if they've succeeded in slaying the right thing yet.

First, I will add a new Journal entry:

Journal Index 54
"I killed the scamp. Kevaar has calmed down enough to talk to me now."

Now, just like when I added my Disable script to the scamp, I will want to open up the scamp's attached script by clicking on the "..." button in its statistics window. Then I will want to add the following lines into the script (Don't forget to add a Begin Scriptname and End if you are creating a whole new script.):

 

if ( OnDeath == 1 )
    Journal "TR_KevaarShiny" 54
endif

This will update the journal to stage 54 once the game registers the scamp has been killed, once again allowing the player to bypass that blocking Greeting.

 

ProTip: The command, GetDeadCount "creature ID", can be used in a similar manner to OnDeath, with the added bonus that it can be put inside any script, not just the local script attached to the creature you're tracking for, as well as track for multiple creatures of the same type being killed. However, caution must be taken with this one, as GetDeadCount will try and count up all the instances the given monster has died in the entire playthrough each thread, much to the detriment of your framerate! For this reason, GetDeadCount should be conditioned with timers or other methods to keep it from trying to run all the time.

Finishing the Quest, Take Two

Finally, I will want to check if Kevaar will now agree to speak to the player after the scamp is slain, by checking the conditions on the rest of his dialogue. And oops, it's a good thing I did! My old "ring I found" topic was set to complete the quest only if the quest journal index equalled 50 exactly! I will need to change this to a new set of conditions:

Journal "TR_KevaarShiny" > 50
Journal "TR_KevaarShiny" < 60

Adding both of these conditions means the quest finishing dialogue will appear if the current quest journal index is anywhere between 50 and 60, but not 50 and 60 themselves (for remember, 50 is now what triggers the scamp to appear in one of my scamp summoning methods, and 60 is for when the quest has been completed). Whew, problem averted.

If I didn't do so already when testing out the different scamp methods, I now want to playtest my mod, and see if I forgot any other conditions or introduced any other bugs by accident. If everything plays cleanly, then I have successfully added combat to my simple quest!