Jump to content

[LE] Trouble getting the game to recognize "player not in jail"


nerdofprey

Recommended Posts

This concern is actually completely unrelated to my other thread about trying to make a custom crime/arrest system. Right now I'm having issues with a different mod and the default vanilla arrest system.

 

I'm having a lot of trouble getting the conditions on an AI package to work. I want the package to start when the player goes to jail and stop when they get out.

 

I recently added a feature to my follower mod where the characters will lose their items, change into prison clothes, and land in a cell along with the player whenever you're arrested. I set it up as start/end scripts on an AI package, and the package has a condition that "JailQuest" has to be active. It works perfectly when you get arrested, and it works perfectly if you escape; if you reach the "prisoner belongings chest" JailQuest stops, the AI package stops and the followers' inventories are immediately restored.

 

The problem is, if you simply serve your time in jail, the package never stops and the followers lose their items indefinitely.

 

I've done a lot of testing of this and found that:

 

- JailQuest starts if you're arrested but doesn't actually stop when you are released

- If I use the console to forcibly stop JailQuest, the AI package will update and they will get their stuff back

- Checking the current stage of JailQuest before and after stopping it always returns stage 10; it doesn't really seem to use other stages, and it just sits there at stage 10 doing nothing before and after you serve your time

- If I walk into the nearest jail and interact with the prisoner belongings chest, even with nothing in it, the package updates and they get their stuff back; this might be "immersive" in a sense but it's tedious

 

 

I've been testing a bunch of other conditions for the AI package, but anything I add either makes no difference or stops the package from ever starting.

 

I can't figure out a reliable way to test for the player being in jail. I can't go off quest stages if JailQuest is literally always at stage 10. I can't go off location keywords because some jails in the game are apparently not tagged with jail keywords, plus if JailQuest stays active forever then just walking into a jail as a free citizen would trigger the AI package and the followers would suddenly lose their stuff again. There's a "GetArrestedState" condition but I can't find any documentation and I can't get it to do anything. Apparently you can use "IsArrested" in scripts but there's no "GetIsArrested" condition function.

 

I could work around this with a dialogue option that restores their inventories, but I'd prefer that this be a nice seamless feature where the player does not need to micromanage it.

Link to comment
Share on other sites

What about factions? I'm just guessing, but does the player get added to, or removed from, any special factions when put in jail, or released from jail? I know there's a crime faction, etc, so maybe there's something there that you could use?

Link to comment
Share on other sites

I don't think so? I have not seen anything to indicate that.

 

 

I was thinking I might just have to put in a little dummy dialogue line, like a split second of silence with no subtitle so the player never sees anything happen, that tests for JailQuest running, the character being in an exterior cell and not having their gear on them, with a script that resets and stops JailQuest. I think the effect would be that the player tries interacting with the follower one time and nothing happens, then when they try again the issue is fixed.

Link to comment
Share on other sites

In looking at the jail related scripts (jaildoorscript, jailbedscript, jailquestplayerscript, and jailquestevidencechestscript) the jail quest isn't actually stopped but is sent to stage 100 as long as the stage is less than 20. Which might explain why it is always at stage 10 for you. It only gets set to 100 on the player script (location change) and the chest script (retrieve items). The bed script does not change the quest stage at all. All it does is runs a native global function from the Game script called servetime. No idea what it specifically does. Perhaps, you could see if adding the stage set to 100 line after the servetime call would do the trick for you.

Link to comment
Share on other sites

Yeah, but in this case I'm not trying to change how the arrest system works, I'm just trying to get my mod to react to it. Like I don't want to make a change to a core game script (even if it sucks) to get a gimmick to work in a comedy follower mod...

 

When you have never been arrested, JailQuest returns stage 0. So the crime system doesn't rely on it staying at 10 all the time. I think it's safe to manually stop the quest after it's started. I tested stopping it via the console and then punching a guard, and I got thrown in jail the same as I was the first time. I don't think it's necessary to set it to 100. I think the 100 stage has to do with escaping?

Link to comment
Share on other sites

Oh yeah, I remember poking at that a little bit and not really understanding how it related. It could work, though. I guess I would need to figure out how many game days typically pass when you serve your time.

Link to comment
Share on other sites

Being released from jail appears to be controlled by the game engine itself, using the game setting iCrimeMaxNumberofDaysinJail.

There doesn't appear to be any quest/story/script/global related to serving out your sentence in full, only for escaping.

 

I can think of two three possible workarounds.

 

1) when the player gets arrested, add a script that monitors for a change in their location and watch to see if they leave the jail location in less than <iCrimeMaxNumberofDaysinJail> days (not escaping), then give them their stuff back.

2) if the player hasn't escaped within <iCrimeMaxNumberofDaysinJail> days, then assume they have now been released and give them their stuff back, if they haven't retrieved it already.

3) try to get the GetArrestedState conditional to work :)

Edited by steve40
Link to comment
Share on other sites

I had another idea...

 

It really seems like being in an exterior by itself should be an easy test for whether you're out of jail, since there are no exterior jails in the game. I'm pretty sure every crime faction in the game also puts you in an exterior cell when you're released. The only other way to get from a jail to another cell is to escape, and I've established that escaping works...

 

I could add a condition on the AI package in question that the player has to be in an interior, then edit the script on the package to force JailQuest to stop when the package stops. That way I could avoid unintended side effects like the characters losing their stuff if you walk into a jail for some other reason later.

 

If there's a mod that puts a jail in an exterior somewhere, the package would never start... which is better than anything breaking, at least.

Edited by nerdofprey
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...