Talk:SetOwnership

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Is it possible to set it to no ownership? Or is that considered player ownership? --MaXiMiUS 21:25, 7 June 2006 (EDT)

Well, in Morrowind, if the ownership was BLANK, then the player could freely take the item. However, in Oblivion, if the cell belongs to an NPC, most of the items contained within are considered to belong to the cell's owner. I don't know, what are you trying to do? TheImperialDragon 22:04, 7 June 2006 (EDT)
Trying to reset the ownership of a horse, after it had been set to a specific NPC, via the SetOwnership command in a script. --MaXiMiUS 00:21, 8 June 2006 (EDT)
I see, well, there shouldn't be any problem using the SetOwnership that I know of, though it may be a different case with creatures... If this function does work with a horse, I see no problem in setting the ownership to different NPCs. Hmm... I'll probably have a look at this scenario tomorrow. The Imperial Dragon 00:36, 8 June 2006 (EDT)


I tried to set the ownership of a horse using the console commands. Unfortunately, it said that player was an invalid owner. You can, however, just type SetOwnership and put nothing as a parameter. This probably sets it to no ownership, meaning anybody should be able to take it, and continue using it, including the player. The Imperial Dragon 18:23, 8 June 2006 (EDT)
The official method used by Bethesda is to call "setOwnership PlayerFaction" for horses. You'll have to use the correct FormID instead of PlayerFaction if you want to use it in console. --JustTim 19:00, 8 June 2006 (EDT)
I see. So horses can only be owned by factions? The Imperial Dragon 19:39, 8 June 2006 (EDT)
No, you just have to use the base NPC as mentioned in the discussion below. Scruggs 21:29, 24 March 2008 (EDT)

Note that a Console command for clearOwnership exists, and is functional at the Console. I've used it successfully for an Imperial Horse. --Laisren 20:46, 24 March 2008 (EDT)

Valid 'Owner' References? Syntax??[edit source]

Does anyone know (or can find out) what the correct syntax is for the <Owner> variable, at the Console? I've tried:

  • Player Character name; e.g. [SetOwnership Laisren]
  • NPC names: e.g. [SetOwnership Toothless Joe]
  • the above with quotes, e.g. [SetOwnership "Toothless Joe"], [SetOwnership "Laisren"]
  • PC and NPC reference IDs, with and without leading zeros..., e.g. [SetOwnership 00000004] (I also tried these with quotes, just be thorough)

... but I always get a message like "not valid for argument 'Owner' (optional)" ... (I'm paraphrasing the error message as I don't have it verbatim.)

If not NPC names, what could the list of valid 'Owners' be?

Perhaps the problem lies with the types of objects I am trying to set Ownership on? (such as the pecularities with Horses mentioned above...)

--Laisren 20:43, 24 March 2008 (EDT)

Valid params are a BASE NPC (not a reference) or a faction. In the console you must use the formID as editorIDs won't be recognized. Use 7 for the player. Scruggs 21:26, 24 March 2008 (EDT)

Doesn't seem to support being called on a reference variable[edit source]

Trying to do

set RefVariable to AnObject
RefVariable.SetOwnership ActorOrFaction

doesn't seem to work, even though the seemingly-equivalent

AnObject.SetOwnership ActorOrFaction

does. The former, if placed in an OnActivate block and activated manually from the console, gives me the message: "Unknown reference object for function 'SetOwnership'. Execution of script ' ' stopped."

Can others confirm that this really can't be done, or am I just doing something wrong?

Odd, but I'm having problems too. I'm trying to use it on a PlaceAtMe object, so it might simply be the function doesn't work on non-persistent objects?
...nope - setting it to AhMalz (base record 293D5) in console worked just fine and counted as stealing when I picked it up.
From looking at the script (sqv), I'm sure the PlaceAtMe reference is set correctly. I can also verify that the function acts as a return when the reference variable is used (but it doesn't stall the script). Script
begin GameMode
	if Own
		if (Own != -1)
			set Own to -1
			set rOwn to (player.PlaceAtMe Apple 1)
			return
		else
			set Own to 1
			rOwn.SetOwnership AhMalz
			player.Activate rOwn
			player.AddItem Apple 5
		endif
	else
		player.AddItem Apple 10
	endif
	
	set cobGenReplaceItemFAR.rOldItem to Apple
	set cobGenReplaceItemFAR.rNewItem to Orange
	set cobGenReplaceItemFAR.ShowMessages to ShowMessages
	cobGenReplaceItemFAR.Activate cobGenActRef, 1
	
	message "Done"
	StopQuest cobDebugGenReplaceItemQ
end
If I set Own to 1 and run the quest, I see an Apple appear, check sqv and Own is -1. Wait 5 seconds and Own has been set to 1, but the Apple is still there and the 5 other apples weren't added to the player. 5 seconds later another Apple pops out (ran Own != 1 again).
--Haama 12:00, 20 April 2009 (EDT)
Funny - It works in the scripts I used in PiiiP. I grab a reference to the currently grabbed item using getCrosshairRef and save it to a ref. variable. After that, in the same frame, I switch the ownership to the player. And when the grab-key is released, I switch back to the original owner, whose reference is stored in yet another variable. And I pretty sure that it works for non-persistent items as well.
-- shadeMe TALK 20:55, 20 April 2009 (EDT)
The point was that non-persistent items did work (via console), and that wasn't an explanation why the function acted as a return.
Maybe it simply doesn't like new items (ffxxxxxx, created by PlaceAtMe)? That would make a lot more sense than it doesn't accept reference variables. Shademe - you already have the mod ready...
--Haama 02:04, 21 April 2009 (EDT)
Dang ! It's happened again ! Sorry about that, I just read the first sentence and blindly made that post. Strangely, for awhile now, I've been having issues with the core script - some clauses are being skipped. The return call could just be true, after all ( come to think of it, this happened when I installed mods and upgraded OBSE ). In any case, I'll test it out a little more.
-- shadeMe TALK 21:10, 21 April 2009 (EDT)