Jump to content

Crime Detection and Licences Integration.


thor3222

991 views

My original design plan relied on using "Licenses" detection to handle the guard interactions. I had a half decent flow working. The player would trigger the conditions required to trigger the crime -> The crime would call the detection script -> the detection script registers the licenses enforces for LOS -> hitting LOS would call licenses bounty and detection scripts -> the enforcer would come running and confront the player.

 

However, I was stuck on this for a while as it wouldn't hit consistently, and it made managing the guards very difficult.

 

For licenses, a select few roaming enforcers make a ton of sense. At least in my head, not all guards feel like they could be assed to check people for licenses, and it allows a reasonable amount of aliases to manage to reduce script overhead.

 

However, for these petty crimes, they are more visually obvious than a license. IMO, the guards should ALWAYS confront a player they see committing these crimes. However, depending on the area, there are maybe 2, or maybe 30 guards. Tracking these individually by alias makes no sense. its a lot of overhead, scripts, and performance hit. However, the detection of these crimes requires very little overhead.

 

  • For lock-picking - I just register for the menu opening
  • For weapons/magic drawn - I register for object equipped
  • For shouting - on spell cast
  • etc.

 

These tend to be just one alias registered for these events.

 

Once the crime is detected, we turn on the crime controller. This tells our script to find the nearest guard. However, there is another issue here: Aliases don't auto refresh as they move. so say you start picking a lock right after a guard walks by. The guard isn't just going to turn around and run to you, he can't see you. For all he knows you are being a good little girl picking daisies or something. He is going to move, and a new guard will get closer.

 

So to handle this we do a few things - When the player enters a WorldSpace we use powerofthree's papyrus extender, and call "GetAllActorsInFaction()" for the GuardDialogueFaction. This seems to be a pretty expensive call. it seems to take a while to run, so we only call it at the WorldSpace level to make sure we aren't calling it too often. This is something that needs to be further tested. my suspicion is this is not something I am running enough. I think on cell load is too frequent, but I think it needs to rerun every time I hit a loading screen. After this initial grab, we then create a static guard list of only the guards inside the WorldSpace . This has a max of 128, but I don't expect there is a realistic scenario where that is hit. Then, once the crime is hit, every second we run through that list calling a "GetDistance()" function on the player to find the nearest guard. With this, we set the nearest guard alias, only changing that alias if a new guard is closer, and the original guard isn't trying to confront us.

This nearest guard gets registered for los, and will come running once he sees you - when this happens we add him to the "ConfrontingGuard" alias, which triggers the ForceGreet package. There are a couple different attitudes you can take when the guard confronts you, and based on that, as well as how often you are a problem it will change the potential responses the guard will give you.


SubmitNewBlogEntry-LoversLabMozillaFirefox12_1_20248_04_50PM.thumb.png.06d4c2cf738583abe5e381dd0f873f6c.png

 

The guard may decide you aren't worth the hassle, and tell you to move on, maybe they will send you to prison, or maybe they will generate a random punishment for you. Before a punishment is assigned, you as the player will have the opportunity to run away. Running away will cause the guards to dislike you more, and apply a bounty to you based on the crime (set in MCM). However, if you stay, you will take the punishment.

 

SubmitNewBlogEntry-LoversLabMozillaFirefox12_1_20248_05_03PM.thumb.png.a0adddee30659745a574f1c10f3271c0.png

Once a punishment is assigned, your movement is stopped, to make sure the scene continues properly. Sometimes it will be an uninteractive scene (devices), sometimes it will be a more complex dialogue back and forth that the player has choices to make. (drinks)
 

SubmitNewBlogEntry-LoversLabMozillaFirefox12_1_20248_05_27PM.thumb.png.4ae0c9856182954bcf9855d460f98a16.png

 

 

Other interesting things: I always had in my head that I want the guards to stop the player if they are picking the lock on a door, sure - if they catch you they will confront you, but its after you already made it in. I particularly like using "Skyrim Souls" in my game, so I made it so the guards will confront the player while they are in the lockpicking menu, and boot them out of it. However, the one issue with that is it takes a moment, and for some reason I can't get what the guard is staying to stay in the subtitle. (but i'll be generating voices so the player should be able to hear them coming) Additionally, the menu takes about a second to turn off, where the player loses control momentarily. I need to see how I can clean up that interaction to make it more smooth.

 

SubmitNewBlogEntry-LoversLabMozillaFirefox12_1_20248_04_43PM.thumb.png.bdb72505caa0d8fdf221f08f3df1fa90.png

(look at that guard sprinting at me)

 

I have the flow working, so now is just a matter of polishing the confrontation behavior:

  • Make sure the guard loses confrontation behavior/force greet once the assignment is done - Seems a tad delayed, maybe need to pause the confrontation immediately after they forcegreet to prevent a double confrontation
  • Make the player turn to face the punishing guard. - Right now they stupidly stare in the direction they were already facing. I hate that.
  • Make sure the crimes are all triggering correctly - As I was writing this up I realized by detatching the enforcers, I may have lost the detect magic/weapons trigger.

 

Licenses is still going to be a dependency. I want to make the enforcers potentially randomly stop to search the player when bumped into, and using the existing aliases just makes sense. Additionally, I use Licenses for the curfew handling, and the licenses themselves will come up in cases with dialogues.

 

Additionally, I need to continue working on the various punishments and dialogues. I will likely only launch with the Whiterun Kennel, but I am hoping to be launching by the end of the year.

Hope some of that at least sounds promising! I'm quite slow but things are trucking along!



 

Edited by thor3222

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...