Part 2.2: Scripting the Scamp to Appear

Scripting the Scamp to Appear

Now there are several ways I could do this, and the choice is yours. I have taken the time to explain the methods and what situations they are best used for. I highly recommend you create a Save of your mod now, so you can go back and try each of the Methods on a clean .esp.

Disable Script Method

The first way is through use of a Disable script. In this method, I place the scamp ingame where I want the player to encounter it. I then attach a script to the scamp so that it is disabled (essentially invisible) except during the appropriate quest step. This method is best used for statics (aka scenery) or other Objects that I want placed in an exact location and position.

The first thing to do is place my scamp where I want it. I want it to attack the player in the Seyda Neen Lighthouse, so I open up the correct interior and place it inside.

Next, I want to give the scamp its disable script. I open up its stats window, then locate the Script subfield. I click the "..." button next to the drop down to write my script:

 

 

Begin TR_DisabledScamp

if ( GetDisabled == 1 )
     if ( GetJournalIndex "TR_KevaarShiny" == 50 )
          enable
          Journal "TR_KevaarShiny" 52
     endif

else
     if ( GetJournalIndex "TR_KevaarShiny" < 52 )
          disable
     endif
endif

End

This may look rather scary to a non-coder, but have no fear. In this script, I have simply told the game engine to check if the scamp is Disabled ( GetDisabled == 1 ). If it is, check what stage the quest is on, and if on Index 50, Enable it and update the journal so it doesn't keep trying to enable it. Otherwise, if it is not Disabled, and if the quest is still at a stage where it should be, Disable it.


 

Pro Tip: The script will keep running in a loop for as long as the player is in the same cell as the scamp, checking every thread if the scamp is disabled or not. For the small Seyda Neen Lighthouse cell, this shouldn't cause much of an issue, but if this were in the middle of the city, I might want to consider alternative ways of writing this script so that the computer has one less thing to worry about among so many Objects.

And there we are! The scamp has now been placed and is waiting in Oblivion to appear! I can move on to writing in Kevaar's reaction to it, or, I can reload my saved .esp and try out some of the other methods for making it appear.

PlaceAtMe Method

Another method involves talking to Kevaar first, and does not involve the use of a script attached to the scamp. Instead, I will open up my old friend, the dialogue window. In this method, I want to write this scene as if the player is ambushed by a scamp shortly after speaking to Kevaar.

First, I give Kevaar a new Greeting, to appear only when the player has returned from talking to Fargoth: in other words, during the Journal stage 50.

Journal "TR_KevaarShiny" = 50
Hello! You've come back! Did you find the owner of the ring I found?

Now while I could summon the scamp with this Greeting, putting scripts in the Results window of Greetings is risky. As you've seen when creating Greetings, there are many many other Greetings that may override mine depending on the circumstances the player finds themselves in when speaking to Kevaar, and so my quest may not always trigger. To circumvent this, I would either need to put this Greeting among the Greeting 0's or 1's, or I could instead move the triggering script into its own Topic.

To be on the safe side, I will do the latter. The player will be expecting to click on the Topic "ring I found" to advance the quest with Kevaar, and so I can write in a little surprise for the player instead. I start off with writing in a new Response to the "ring I found" Topic:

"That was quick. Are you sure you didn't have any trouble on the way? Wait. What is that? B'Vehk, look behind you!"

Like all Responses, I will want to make sure this is Conditioned properly so it shows up when I want it to. For instance, though I would want to condition this Response with Journal "TR_KevaarShiny" = 50, I already have another Response that is conditioned the exact same way! I would want to make sure this new Response goes on top of the old one, or it would never appear.

Then, to summon the scamp, I will then want to add these three lines into the Results window:

Journal "TR_KevaarShiny" 52
Goodbye
PlaceAtMe, "TR_scamp", 1, 120, 3

The Journal script you have seen before. This updates the quest journal so that it is on the next step of the quest. This serves the additional of role of making sure Kevaar can't keep warning the player about the scamp when the "ring I found" Topic is clicked, and so inadvertently summoning an endless pile of scamps for the player to deal with.

The Goodbye script is also one you have probably seen played out ingame before. This forces the player to end the conversation by clicking "Goodbye", and is often used in conjunction with dialogue that ends in a fight scene, as otherwise the player would be free to chat Kevaar up for hours while the poor scamp is drooling behind them, waiting their turn.

The PlaceAtMe script is then the command that summons the scamp beside Kevaar. The first number is the amount of scamps you want to summon. (While you COULD summon more than one, they would be stacked on top of each other at first, and hence look rather funny). The second number is how far away from the calling NPC (in this case Kevaar, as it's Kevaar's dialogue) you want the scamp to be. The last number is where in relation to Kevaar you want the scamp to be. 0 is in front, 1 is behind, and 2 and 3 are to the left and right side, respectively.

For the sake of immersion, it's worth noting that PlaceAtMe places an Object immediately, with no flash, bang, or puff of smoke to accompany its sudden appearance. This function is then best used when the object will be placed out of sight of the player, such as when they have their back turned or their nose stuck in a book. You may notice that in my above scheme it's possible the scamp will poof into existence where the player can see it. This is when you might want to also consider using PlaceAtPC instead.

You can do much the same effect using the PlaceAtPC script (the syntax is the same, just "PC" instead of "Me"). The only difference in function is that the object will always appear in relation to the player instead of in relation to the calling Object. However, in a cramped interior like the Lighthouse, this is risky, as the player could be standing with their back to a wall. Though the game engine will make best effort to make sure the scamp is placed in such a way it is still "inside" the interior, placing it right on top of the player if it has to, I have better control of exactly where the scamp appears by using Kevaar as a reference instead. For our quest, it becomes a tossup of which function you prefer.

 

Pro Tip: To better offset the sudden appearance of the scamp (or any other object) in the player's field of vision, you could make use of PlaySound "sound id" and/or write the line FadeIn, 1 into your Results followed by FadeOut, 1 on the next line. PlaySound plays the given sound once. I could make it seem like the scamp appeared out of Oblivion by using the sound ID "mysticism hit", or that it jumped from a hiding place by using the sound IDs "Body Fall Medium" or "scamp roar" (choose one, for unfortunately without creating a special timer script, both sounds will be played at once). FadeIn/FadeOut makes the whole screen turn black and is a good indicator of the passage of time. However, since it may seem a little strange to insinuate that the player was standing staring slack-jawed at Kevaar for an indeterminate amount of time while the scamp sauntered into position, the PlaySound trick alone is probably the best pick.

As you can see, the PlaceAtMe method of placing the scamp is dependent on the position of Kevaar (or in the case of PlaceAtPC, of the player), and so can move around if Kevaar (or the player) has moved around. This contrasts to the Disable method described above, where you have already told the engine exactly where you want the scamp to appear. I'll leave it up to you to decide which one makes the most thematic sense, and how you may make best use of these methods for future encounters you may script for.

 

ProTip: There is actually a third method, PositionCell, X Coord, Y Coord, Z Coord, Rotation, "CellID", that can be used to summon the scamp. Like the Disable method,  PositionCell allows you to place the creature exactly where you want it, and unlike the Disable script, is only called once (usually in a Dialogue Result) and so may be easier on the computer.  This method is technically better suited for moving Objects than summoning them though, as it won't work unless the Object has already been placed in the game world. (In the case of the scamp, this placement could be in a test cell or sectioned off room in the lighthouse that the player otherwise doesn't have access to.) The Object being moved must also have a unique ID, so that the game isn't trying to figure out which guard out of 50 guards you're trying to move.