Creating a Custom Crime Faction

From the CreationKit Wiki
Jump to navigation Jump to search

According to Sun Tzu, there are few greater delights in life than to be thrown in a jail one made for oneself. The same is true in mods. However, it takes a bit of work to get such a jail set up, along with the crime faction that tracks the player’s bounty and (optionally) custom guard dialogue. This tutorial will walk you through these necessary steps.

The Prison[edit | edit source]

This step is skippable if your crime faction has no prison, as is the case with the Orc strongholds. You will have to place two references to the PrisonMarker object (this is a Door). One should be placed outside the building where the jail is located. This is where the player ends up after paying the fine or being released from jail. The other is inside the prison cell, and marks the location the player will be sent to if he submits. These two markers must link to eachother in their teleport data. Make sure there is a locked jail door (the lock level can be chosen freely), and at least one bedroll inside the prison cell. As far as the author can see, nothing special needs to be done with these references. There also needs to be an EvidenceChestPlayerInventory and EvidenceChestStolenGoods somewhere. Their locations can be chosen freely (so you can make it more difficult for a jailbreaking player to retrieve his items), as long as they are not in the prison cell.

The Crime Faction[edit | edit source]

Make a new faction. I recommend giving it an EditorID like “<YourPrefix>CrimeFaction<RegionName>”. For example, CYRCrimeFactionBruma if we’re making a Bruma crime faction in a Cyrodiil mod. The “Name” field will be displayed in the “40 Gold added to ...” message, so be sure to fill it. In the “Interfaction Relations” field, add PCVampireFaction and PlayerWerewolfFaction, and mark them both as Enemy.

Obviously, the Crime tab is the one you need to be focusing on next. Check “Track Crime”. If you have a jail, you can start pointing the faction to the objects that you placed in the world. For “Exterior Jail Marker”, select the PrisonMarker reference that you placed outside. For “Follower Wait Marker”, select the same PrisonMarker (optionally, you can direct it to a nearby XMarkerHeading instead, if things are a little too cozy for your taste). For “Stolen Goods Container” and “Player Inventory Container”, select the EvidenceChestStolenGoods and EvidenceChestPlayerInventory, respectively.” Jail Outfit” denotes the clothes the player will get in jail; usually, this is set to BeggarOutfit.

Most vanilla crime factions have all the checkboxes at the top of the window empty (the ones related to ignoring crimes), so you can leave them empty as well. Attack on Sight, Arrest and Use Defaults are checked, but creative use of these is possible. If you don’t check Use Defaults, you can set how much bounty is allocated for each crime, allowing you to diversify the laws in each region (perhaps Bruma cracks down harder on stealing and Chorrol on murder?) If you don’t check Arrest, guards will always try to kill the player on sight if there is a bounty. If Attack on Sight is unchecked, guards will always try to arrest first before resorting to violence.

The Populace[edit | edit source]

Now that CYRCrimeFactionBruma is up and running, you can add this faction to all citizens and guards that reside in Bruma and the settlements under its jurisdiction. This is done in the Factions Tab of the Actor base record of each of your unique NPCs, and whichever guard template in your setup that holds the faction list for Bruma guards. Once the crime faction is added to the list, you will also need to select it in the “Assigned crime faction” drop-down menu. It pays to double check this after closing the actor, as this setting has a tendency to become unset when you’re messing with the factions. The guards will need two extra factions: IsGuardFaction (which enables the AI routines for arresting or eliminating lawbreakers) and GuardDialogueFaction (which grants the guard access to the dialogue for arrest events). Save your plugin and go try it out! Go slap a random passer-by in the face and marvel at the stern conversation with the nearest guard that ensues. And if such a thing does not ensue, please find out why and edit this article accordingly.

Custom Dialogue[edit | edit source]

This is all well and good, but when that Bruma guard opened his mouth and informed you of your crimes against Skyrim and her people, the resulting experience may have been “immersion breaking” for you. That’s why we will need to hook our guards up with dialogue of our own. First of all, make another custom faction, such as CYRGuardDialogueFaction. Remove the GuardDialogueFaction from your guards and substitute it with the one you just made. Next, browse to the DialogueCrimeGuards quest and duplicate it. Name it CYRDialogueCrimeGuards (if you haven’t guessed, appending our prefix to copies of vanilla forms is what we’ll be doing a lot of in this tutorial). Open the new quest. In the Quest Data tab, you should see a “GetInFaction, Faction: GuardDialogueFaction” condition; change it to point to your new guard dialogue faction. Also remove the GuildCost text display global, as we won’t be needing it. In the scripts tab, remove CrimeGuardsScript; we will access its functions through the instance of the script that is attached to the original quest, using properties.

InDepth.jpg Adventurous souls will notice a bunch of properties in the script that point to crime factions in the base game. Fear not, as this is only needed for Thieves Guild-related bounty discounts. If you want to have something like this in your mod, then you’ll need to make your own script, but we don’t need it for functions related to jailing, resisting arrest and other basic necessities.

Now we will add the dialogue. The dialogue view in DialogueCrimeGuards contains some of the worst dialogue spaghetti that I’ve ever seen. Thankfully, we won’t need to recreate all of it, specifically leaving out the Thieves Guild options and dialogue related to specific quests (particularly the Forsworn Conspiracy).

Starting Topics[edit | edit source]

Make your own Dialogue View in the new quest. Create a branch called CYRDGCrimeBlockingHello, along with the starting topic. Edit the branch so it becomes a Blocking branch (it should take on a green color). This branch will account for those cases where the player stupidly talks to a guard while having a bounty above the petty crime gold threshold. Create an info in the topic and add the following conditions (run all on Subject):

  • IsInDialogueWithPlayer == 1 AND
  • GetAlarmed == 0 AND
  • GetCrimeGold > 0 AND
  • GetDaysInJail == 0 AND
  • GetActorValue, Variable03 < Global: GameDaysPassed OR
  • GetCrimeGold > Global: CrimePettyCrimeThreshold OR

The last condition ensures that the guard will not bother you if your bounty is low. Remove it if you wish. The original dialogue on this info is “Wait… I know you” but you can have something more province-appropriate if you wish, such as “Stop right there, criminal scum!” The original quest has a second topic that allows the player to respond once before being presented with the complete choice list, but this is hardly necessary. Make a new dialogue branch called CYRDGCrimeForcegreet, along with its starting topic. Edit the Branch so it becomes a blocking branch, and change the starting topic’s type to “Forcegreet”. This branch holds the dialogue for when the guard actively arrests the player. Create an info in the topic with the following conditions:

  • GetAlarmed == 1
  • GetCrimeGold > 0

I think you’ll know what dialogue to put here.

Persuasion[edit | edit source]

In the CYRDGCrimeForcegreet branch, create a CYRDGCrimePersuade topic. This will let the player persuade the guard. Make the topic text something like “Any chance I could talk you into overlooking this? (Persuade)” and add an info with the following conditions:

  • Player: IsTrespassing == 0 AND
  • Subject: GetCrimeGold > 0 AND
  • Subject: GetCrimeGoldViolent == 0 AND
  • Subject: IsBribedbyPlayer == 0 AND
  • Target: GetActorValue, Speechcraft >= Global: SpeechHard OR
  • Player: GetEquipped, FormList: TGAmuletofArticulationList == 1 OR

Under these conditions, the persuasion will succeed if the player is not trespassing, is not indicted of any violent crimes and has a speech skill of at least 75, or is wearing the Amulet of Articulation. Adjust these if necessary. In the vanilla quest, there are no infos that occur when the conditions aren’t satisfied, so the dialogue option will simply not appear in those cases (see Speech Checks); add some if you like. Now for the script. In the “Begin:” papyrus fragment box, type a semicolon and hit Compile. This will generate a script which you can see on the right. Close and reopen the info, and check the script’s properties. Add a property with a type of CrimeGuardsScript (don’t choose from the drop-down list) and name it pCGS. Fill it with DialogueCrimeGuards, which should be the only possible value (unless you neglected to remove the script on your duplicated quest). Then, enter the following in the Begin box:

InDepth.jpg It also pays to rename the script and add your prefix so it can’t conflict with scripts from other mods, and it will be easier to scoop all your mod’s scripts from your folders later. You can do this with the “rename” button in the Advanced tab of any fragment. I also like to add something descriptive between the two underscores (usually the topic ID), so this script would be renamed to CYR_TIF_DGCrimePersuade_02000D6B

Paying the Fine[edit | edit source]

Add a CYRDGCrimePayFine topic with a topic text like “You caught me. I’ll pay off my bounty. (<CrimeGold> Gold)”. <CrimeGold> will be text-replaced by the bounty amount. In the vanilla quest, there are two infos that can be selected based on whether the guard caught the player red-handed or was approached by the player; the former sends the player to the castle, the latter lets him go immediately after paying the fine. For the first info, add the following conditions:

  • Subject: CanPayCrimeGold == 1 AND
  • Subject: GetAlarmed == 1 AND

And the following code in the End fragment box:


For the second info:

  • Subject: CanPayCrimeGold == 1 AND
  • Subject: GetAlarmed == 0 AND

And code:

akSpeaker.GetCrimeFaction().PlayerPayCrimeGold(True, False)

Of course, you can leave out the second info and remove the GetAlarmed condition on the first if you want your guards to be strict and always take the player to the castle.

Jail[edit | edit source]

Add a CYRDGCrimeGoToJail topic and make the topic text something like “I submit. Take me to jail.” In the info(s), no conditions are needed. Add the following in the End fragment box:


In the vanilla quest, there are multiple infos that can be said depending on the guard’s crime faction (e.g. “You’re going to rot in the Dragonsreach dungeon”). If you want to do something like this, every info will need the script.

Resist Arrest[edit | edit source]

Make a “CYRDGCrimeResistArrest” topic; make the topic text something like “I’d rather die than go to prison!” Conditions are not needed on the info. In the Begin fragment box, add:


The guard’s line will probably not be spoken as he will be interrupted by his own Start Combat dialogue.

Linking it up[edit | edit source]

Now you will have to link the dialogue topics to eachother. I recommend starting with the Info(s) in your forcegreet topic. Link it to CYRDGCrimePersuade, CYRDGCrimePayFine, CYRDGCrimeGoToJail and CYRDGCrimeResistArrest. You can right-click the “Link to:” window in the info dialog and select “Copy Stack” so you can paste it to all other infos in the forcegreet topic, and the info(s) of the last topic in your Hello branch. If you added failure infos for the persuade check, it’ll need the stack too.

That should just about do it. When testing in-game, always save and reload or generate a SEQ file to let the dialogue kick in, as the quest is Start Game Enabled.

See Also[edit | edit source]