Jump to content

need help figuring out how prison works


fg109

Recommended Posts

I'm trying to create a mod and part of it involves the player getting captured. I'd like the player to have all his/her items removed when they're captured, but using the "RemoveAllItems" command does nothing to quest items, and it can sometimes leave the player with an enchantment even though the item is no longer in the player's inventory.

 

So I looked at the GoToJail command, which does exactly what it needs to, except that the player ends up in jail. I've figured out how to create a prison out of my cell so the player ends up there, and I rigged a script to move all the items out of the stolen goods container and put them somewhere else so the player doesn't get access to their items until after they finish the quest. But the problem is that when the player goes to sleep, it pops up the "Do you serve your sentence?" message box. And also the fact that once they wake up, they would end up in an exterior cell with 1 of their skills permanently decreased.

 

I can't seem to find where this is controlled from through looking at the CS. To get around that, I thought about artificially triggering an escape by unlocking the cell door, but then it pops up the message that the player is escaping from prison, and I can't figure out how that is controlled either.

 

Right now, I'm not sure what to do. The only thing I can think of is to modify the script I had for moving things out of the stolen goods container and use it on the player. What it does right now is to set all quest items it finds as-non quest items, move it to another container, and set the items back as quest items again. But like the regular RemoveAllItems command, it leaves the player with enchantments without the actual items in their inventory. Here's the script I have for it so far:

 

 

scriptname fg109RemoveAllItemsFunction


array_var equipped
array_var quest_items

ref tempref
ref item
ref old_container
ref new_container

short tempshort


Begin Function {old_container new_container}

let equipped := old_container.GetEquippedItems
let quest_items := ar_Construct Array

;	Unequip any equipped items	
while (tempshort < ar_size equipped)
	let tempref := equipped[tempshort]
	tempref.UnequipMe
	let tempshort := (tempshort + 1)
loop

let tempshort := 0

;	Set everything as non-quest items and move them to new container
foreach (item <- old_container)
	if (item.IsQuestItem)
		let quest_items[tempshort] := item.GetBaseObject
		let tempshort := (tempshort + 1)
		item.SetQuestItem 0
	endif
	item.RemoveMeIR new_container
loop

;	Set the ex-quest items as quest items again
foreach (item <- new_container)
	let tempshort := 0
	while (tempshort < ar_size quest_items)
		let tempref := quest_items[tempshort]
		if (item.GetBaseObject == tempref)
			item.SetQuestItem 1
			Break
		endif
		let tempshort := tempshort + 1
	loop
loop

Player.AddItemNS JailPants 1
Player.AddItemNS JailShirt 1
Player.AddItemNS JailShoes 1
Player.EquipItemNS JailPants
Player.EquipItemNS JailShirt
Player.EquipItemNS JailShoes

End

 

 

I'm thinking of adding some code to check each item for enchantment, and then use RemoveSpell on the player. But I'm not sure if enchantments and abilities are the same thing.

Link to comment
Share on other sites

Couldn't you just make a single equipment piece that takes all the equipment slots, equip it on the player, then remove it and use the removeallitems command?

Also, instead of using GoToJail, couldn't you just use MoveTo to send the player to the cell so it doesn't trigger any of the normal jail stuff? The whole prison process is not a terribly complex one, so it should be simple enough to replicate the parts you need.

Link to comment
Share on other sites

Thanks whalecakes, I'll try that.

 

EDIT: Well, I tried what you said and it didn't really make a difference. I already had a section in my script to unequip everything the player has on.

 

The reason I was trying to use GoToJail was because RemoveAllItems doesn't remove quest items. And also, it didn't remove the enchantments from the Skeleton Key and Scales of Pitiless Justice.

 

In my script, I've managed to remove quest items, but I still haven't figured out what to do about the enchantments. It's not as though the items themselves have enchantments, it's that they're scripted to add the enchantments to the player. Really has me stumped atm.

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

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