Where's the script that controls serving jail time?

Post » Thu Jun 21, 2012 1:05 am

In particular I'm searching for the instance where you get released after serving jail time and your stuff gets put back into your inventory.

I've searched through all the jail and guard scripts/dialogue but couldn't find anything.
User avatar
An Lor
 
Posts: 3439
Joined: Sun Feb 18, 2007 8:46 pm

Post » Thu Jun 21, 2012 2:06 pm

So does anyone know?
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Wed Jun 20, 2012 11:23 pm

I suspect the function you're after is Game.ServeTime(). I haven't tested it yet, but the documentation sounds promising.
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Thu Jun 21, 2012 5:35 am

I suspect the function you're after is Game.ServeTime(). I haven't tested it yet, but the documentation sounds promising.

That's not exatly what I ment. I need to find the portion of the default jail script that puts you in front of jail after you served your jail time. This is when you activate the bed to serve your sentence in jail, you then get teleported to the next exit after serving your time.
User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Thu Jun 21, 2012 3:05 pm

I can't guarantee this 100%, but I think that's hard-coded. I once looked for this same script when trying to modify the player's skill progress (the one that get's reset after serving jail), and all I found was a deprecated "servejail" function, that had some developer comments about "hopefully this will be temporary", meaning skill progress couldn't be controlled by scripting after all.

So, I don't know about putting you in front of jail, but I can almost assure that hitting the bed in jail calls some kind of hard-coded scripting, so depending on what you're looking for, you may not find it.
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Thu Jun 21, 2012 2:26 am

I can't guarantee this 100%, but I think that's hard-coded. I once looked for this same script when trying to modify the player's skill progress (the one that get's reset after serving jail), and all I found was a deprecated "servejail" function, that had some developer comments about "hopefully this will be temporary", meaning skill progress couldn't be controlled by scripting after all.

So, I don't know about putting you in front of jail, but I can almost assure that hitting the bed in jail calls some kind of hard-coded scripting, so depending on what you're looking for, you may not find it.

That's what I thought. I was searching like half a day and didn't find anything usefull. I stumbled across the same script as you 'JailBedScript'...

Spoiler
Scriptname JailBedScript extends ObjectReference  {hopefully temp script to serve jail time}Faction Property CrimeFaction  Auto  {crime faction that owns this jail}int jailTimeimport GameMessage Property JailBedMsg  Auto  Event OnActivate(ObjectReference akActivateRef)	if akActivateRef == Game.GetPlayer()		; jailTime = CrimeFaction.GetDaysInJail()		; TEMP:		jailTime = 10		if JailBedMsg.Show( jailTime ) == 0			serveTime()		endif	endifendEvent

...the problem was I didn't found the object or quest or which ever reference that controls this script. I also found the message belonging to the bed, it's named 'JailBedMSG' and it reflects exactly the message you get when activating the bed in jail. I don't necessarily think it's hard coded. Could just be a script that doesn't have a regular name, there are tons of them.

I also found tons of instances in certain quests, factions, packages, formlists and dialogues, but none that controls the event I'm searching for. There are also references jail markers that controls the teleport in between serving jail time, but no trace of the wanted script.

I finally included a spell to my mod, so that you're able to fix the bug players get by your own.

What I did in my mod was giving weight to arrows and whenever you serve jail time the arrow weight dummys get duplicated after you're released from jail. It doesn't happen when you escape from jail though.
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Thu Jun 21, 2012 12:00 am

My impression so far is that jails to which the player can be sent are owned by Crime Factions (e.g. CrimeFactionRift).

Faction > Crime tab defines various objects used by that prison, including the external marker to which the player is sent after serving time.

It seems that the CK requires the latter to be a PrisonMarker object (filed under Doors).

My guess is that Game.ServeTime() is supposed to send the player to that pre-defined marker.

I'm not certain about this yet. My plug-in is not a standard guard-sends-player-to-jail scenario. For some reason, right now, CrimeFaction.SendPlayerToJail() results in a CTD if that marker is defined, but if it is not I get a CTD with Game.ServeTime(). More testing required!

EDIT : crossed with the previous post.
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am

Post » Thu Jun 21, 2012 7:35 am

Hmmm, maybe it works if I put a script on every exiting jail marker to remove arrow dummys...yeah, this should work. Will report back if it does.
User avatar
Matthew Warren
 
Posts: 3463
Joined: Fri Oct 19, 2007 11:37 pm

Post » Thu Jun 21, 2012 5:30 am

...Faction > Crime tab defines various objects used by that prison, including the external marker to which the player is sent after serving time...
It turns out that the Jail functions work correctly when the above-mentioned PrisonMarker [B] is configured as a teleport to a PrisonMarker [A] in the jail itself.

SendPlayerToJail() sends the player to A. ServeTime() sends the player to B.

Once the markers are set up, inventory removal and restoration are hard-coded (the functions are defined as Native).

So, I hope your script on exit markers works for you.
User avatar
matt oneil
 
Posts: 3383
Joined: Tue Oct 09, 2007 12:54 am

Post » Thu Jun 21, 2012 4:12 am

It turns out that the Jail functions work correctly when the above-mentioned PrisonMarker [B] is configured as a teleport to a PrisonMarker [A] in the jail itself.

SendPlayerToJail() sends the player to A. ServeTime() sends the player to B.

Once the markers are set up, inventory removal and restoration are hard-coded (the functions are defined as Native).

So, I hope your script on exit markers works for you.

No. this is how the script looks like at the moment. I've put it on a quest and made it OnInit, so I didn't had to modifie the markers:

Spoiler
Scriptname SI_RemoveArrowDummyScript extends Quest  Armor Property SI_ArrowWeigthDummyIron AutoActor PlayerEvent OnInit()	RegisterForUpdate(1)EndEventEvent OnUpdate()	Player = Game.GetPlayer()	If Game.ServeTime()		Player.RemoveItem(SI_ArrowWeigthDummyIron, 5000, true)	EndIfEndEvent

As soon as I enter the cell (when SendPlayerToJail() fires and sends me to marker A) , the game is crashing. I didn't had served my time then.

Edit: According to the wiki SendPlayerToJail() won't work because it's a faction script varaible and can't be apllied to quests or refrences.
User avatar
Gemma Woods Illustration
 
Posts: 3356
Joined: Sun Jun 18, 2006 8:48 pm

Post » Thu Jun 21, 2012 8:55 am

You could also place a trigger attached to an activator, with an OnTriggerEnter() event, just in the prison exit area, and do your code there. I exactly don't know what you need to do, but in case you have to check some item count about something, you could use a global variable that gets updated before going to jail, while playing (for instance, when adding or removing that certain item), so when player exits jail you can just check that global variable and do whatever you need to do. Only thing to keep in mind is to make sure nothing weird happens if player didn't go to jail at all and is just walking into the trigger.
User avatar
Sarah Kim
 
Posts: 3407
Joined: Tue Aug 29, 2006 2:24 pm

Post » Thu Jun 21, 2012 1:09 pm

You could also place a trigger attached to an activator, with an OnTriggerEnter() event, just in the prison exit area, and do your code there. I exactly don't know what you need to do, but in case you have to check some item count about something, you could use a global variable that gets updated before going to jail, while playing (for instance, when adding or removing that certain item), so when player exits jail you can just check that global variable and do whatever you need to do. Only thing to keep in mind is to make sure nothing weird happens if player didn't go to jail at all and is just walking into the trigger.

I've also tried a trigger, didn't work. But I got it working with very basic code on a quest that fires on the event 'servetime'. Now I just have to bring more control to the script, because the OnInit function permanently deletes the weight dummys. Problem is I don't have a clue how to get around this.
User avatar
Leanne Molloy
 
Posts: 3342
Joined: Sat Sep 02, 2006 1:09 am

Post » Wed Jun 20, 2012 11:12 pm

...the OnInit function permanently deletes the weight dummys...
How is that different from what you want to achieve?
User avatar
Tessa Mullins
 
Posts: 3354
Joined: Mon Oct 22, 2007 5:17 am

Post » Thu Jun 21, 2012 10:15 am

How is that different from what you want to achieve?

I want them to be deleted only once when I served my time and exit the jail. The dummys simulate weight for arrows. If I premanently delete them, there will be no weight for arrows...:D
User avatar
Scotties Hottie
 
Posts: 3406
Joined: Thu Jun 08, 2006 1:40 am


Return to V - Skyrim