Jump to content

Is there a script to change ownership of a cell?


angelmendez003

Recommended Posts

Ok so I have this plugin that I'm working on in which a player can talk to any NPC in the game that's in the _JobMerchant Faction and buy their shop for 1000 gold. I have all the dialogues set up and everything but I don't seem to find any script in changing the ownership of the current cell I'm in. I also need to change all of the items within the cell so their the owner of the player as well. Is this possible? I need the script to run during dialogue mode and since I am making this quest as a radiant quest, is it possible to do this in a way where the script changes ownership based on who I am talking to? I know this sounds like a lot to ask for guys but if this can work out I'm sure it would be a great mod, if not then I'll just have to do it the old fashioned way and just make a custom shop somewhere in whiterun and do everything there. No pressure guys lol, I appreciate any suggestions thank you.

Link to comment
Share on other sites

  • Replies 48
  • Created
  • Last Reply

Top Posters In This Topic

I know this is a bit out of topic, but I'd recommend u look for "Visual Papyrus Reference" on the Nexus. It's a spreadsheet/PDF style reference with listings to huge amount of functions and Papyrus related stuff. Every command is linked to its reference page on the CK wiki. Its great. Saved my life a whole bunch of times.

Link to comment
Share on other sites

SetActorOwner and SetFactionOwner functions can both set ownership of cells an items.

Hey guys thanks for the responses, I've been busy lately, sorry for my tardiness. I have a question Sloppy, does the SetActorOwner and SetFactonOwner make all of the items within the specified cell change ownership automatically as well or do i have to do that manually?

 

Thanks Dionysys for the link, I'll check it out for sure.

Link to comment
Share on other sites

Depends on if the items are as owned by another faction or actor owner.

 

So for a cell that has items that aren't owned by anything else then setting ownership of the cell will be the governing owner (in most cases).

 

If some items in the cell have been set to a owner, then setting the cell owner will not change the original owner.

 

Example go into an Inn and the food on the tables is flagged as Steal when you target it.

You set cell ownership player faction or player and the food will no longer be flagged as steal.

But if the food had an individual owner then they will still be flagged as steal.

 

Anotehr example:

In Riverwood outside at the Blacksmiths when you first get to town.

There are ingots under the workbench and they show as steal before you befriend the blacksmith.

There are also weapons/armor on the table.

If you stand there and set cell ownership, the ingots under the bench won't be flagged as steal any longer.

But the weapons/armor on the table will still be flagged as steal.

 

So cell ownership is sort of hard to tell what items will be flagged or not.

 

Another example:

At Septimus Signus little ice cave where he has a cupboard with some firesalts and some gems and whatnot.

When you complete his mission and he dies the stuff on the shelves is still flagged as steal.

Setting Cell ownership in the ice cave does not remove the steal flag.

 

Another example:

In Windhelm in Calixto's house if you set cell ownership, most stuff on the shelves are no longer flagged as steal.

 

 

If your wondering how I find some of this out, it's due to my own mod has a set cell ownership function...lol

And I abuse it regularly :smile:

Mainly when I'm in an Inn, tavern or Shops.

Due to how many times I've accidentally picked something up when I didn't mean to and all the cells occupants go hostile.

 

I also have so I can target an item and it removes ownership at the press of a button.

Handy for when you get dead or missing owners that the stuff is still flagged as steal.

Also beats having to use the console to do the same thing :)

Link to comment
Share on other sites

Thanks again Sloppy for the information, so pretty much it depends on whether or not the items in the cell are owned by a faction or an individual actor. I think I can get away with this situation this time because the shop owners that are only allowed the give you the quest to buy their shop is if they belong to the _JobMerchantFaction. So assuming that, I think if I were to use the SetFactionOnwership it should work with no problem. I'll just try it out and see what results I get, my only concern is that since i want to make this quest a radiant quest, I'm trying to make everything as generic as possible without applying any aliases or specific actor names or values so that this quest can be done at any shop in the game. Is there a way I can create a function or script that will reference the current actor I am talking too or current cell I am in?

 

For Example, I talk to the owner of the shop and buy the shop, can I run a script like this? GetCurrentCell().SetCellOwnership(player)

 

 

If that doesn't work can I write a script like so? GetCurrentActor().SetCellOwnership(player)

 

 

haha, yeah that mod would be useful indeed, it does suck when your sitting at a table and your trying to get out of the chair and you press it on an item and you by accidently steal it. Maybe instead of using that script in your mod that will allow you and players to take advantage over the system maybe you can create a script that prompts the player when they click on an item that is not theirs whether they want to steal it or leave it alone like a dialogue box message. :)

Link to comment
Share on other sites

SetCellOwnership is a console command and not a papyrus script command.

SetCellOwnership is only useful if you open the game console and type it in.

SetCellOwnership will not work from a papyrus script.

 

Use a script fragment on your dialogue/topic info.
Since dialogue fragment will add the akSpeaker (Actor your talking with) initially in the fragment which is created from akSpeakerRef objectreference that is the Fragment parameter.

eg paste something like this in the End fragment box at the bottom on the dialogue topic info:
Cell kCell = akSpeakerRef.GetParentCell()
If kCell
kCell.SetActorOwner(Game.GetPlayer())
EndIf

The reason I first check to see if the parent cell is returned before setting ownership is if for some unknown reason GetParentCell() fails to return a cell (it happens sometimes) then papyrus log wont spit spam something like: "Can't SetActorOwner on none"

Link to comment
Share on other sites

Hey Sloppy, I've tried to past your code into the topic response that pretty much makes the merchant tell the player that he has purchased the shop and gives the player a manual and removes the gold. this is what The error message suggests.

Starting 1 compile threads for 1 files...
Compiling "TIF__010012CB"...
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__010012CB.psc(18,10): type mismatch on parameter 1 (did you forget a cast?)
No output generated for TIF__010012CB, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on TIF__010012CB

this is what I have in total in the end script:


Game.GetPlayer().RemoveItem(Golds, Subtraction)
Game.GetPlayer().AddItem(ManualGuid)

GetOwningQuest().SetObjectiveDisplayed(10)
GetOwningQuest().SetStage(10)


Cell kCell = akSpeakerRef.GetParentCell()
If kCell
kCell.SetActorOwner(Game.GetPlayer())
EndIf

 

Thanks again,

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...