Scripting Question - Equivalent of "SetItemValue"?

Post » Mon Jun 18, 2012 9:57 pm

I'm checking to see if anybody knows how to script a change in an item's gold value, since "SetItemValue" as used in Oblivion, and as used in the Skyrim console, isn't recognised as a function (and isn't listed in the list of functions on the CK wiki).

Here's my bit of script:

Key Property RangerShackDoorKey  AutoBook Property RShackDeed  Auto  int countEvent OnRead ()	if count == 0		Game.GetPlayer().AddItem(RangerShackDoorKey)		RShackDeed.SetItemValue(0)	endifendEvent


Saves and works fine without the "SetItemValue" line, and otherwise gives me the error "SetItemValue is not a function or does not exist". Any input would be much appreciated!
User avatar
Amy Smith
 
Posts: 3339
Joined: Mon Feb 05, 2007 10:04 pm

Post » Tue Jun 19, 2012 12:54 am

I don't think there is a Papyrus function that let you do that. Here's a list of all documented functions: http://www.creationkit.com/Category:Papyrus

Cipscis
User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am

Post » Mon Jun 18, 2012 11:17 pm

you can however replace the deed in the player's inventory with an identical deed that has the changed value
User avatar
Minako
 
Posts: 3379
Joined: Sun Mar 18, 2007 9:50 pm

Post » Mon Jun 18, 2012 11:37 pm

Hmm, that's what I'm afraid of - I checked that list as well.

There must be a way around it, though - at least, I'd be surprised if there was no way to script an item value change, especially since it can be done in the console.
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm

Post » Mon Jun 18, 2012 11:15 am

you can however replace the deed in the player's inventory with an identical deed that has the changed value

Oh, good idea. I'll use that workaround - thanks!
User avatar
Taylah Haines
 
Posts: 3439
Joined: Tue Feb 13, 2007 3:10 am

Post » Mon Jun 18, 2012 6:44 pm

There are quite a few things that can be done in the console that can't be done via script, though. I think Ditre's suggestion would be your best bet for now.

Cipscis
User avatar
Kristian Perez
 
Posts: 3365
Joined: Thu Aug 23, 2007 3:03 am

Post » Mon Jun 18, 2012 8:37 pm

There are quite a few things that can be done in the console that can't be done via script, though. I think Ditre's suggestion would be your best bet for now.

Cipscis

I think you're right - thanks for looking into it.
User avatar
Emily Martell
 
Posts: 3469
Joined: Sun Dec 03, 2006 7:41 am

Post » Mon Jun 18, 2012 10:19 am

Ok, I have one more question to ask in relation to this.

I'm trying to add and remove the objects silently with an "absilent" boolean, but I'm not sure how to set that up as a parameter (or whatever it is I need to be doing to make it work).

There's a reference http://www.creationkit.com/AddItem_-_ObjectReference, but I'm not getting it right. What line to I need to insert into my script and where, so I can run that as "true" (silent).

Thanks again for the help!
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm

Post » Mon Jun 18, 2012 9:38 pm

Something like this should do the trick:
CallingObject.AddItem(MyItemToAdd, 1, true)

Cipscis
User avatar
Mackenzie
 
Posts: 3404
Joined: Tue Jan 23, 2007 9:18 pm

Post » Mon Jun 18, 2012 12:48 pm

Something like this should do the trick:
CallingObject.AddItem(MyItemToAdd, 1, true)

Cipscis

Oh, so it did! My problem is that I was writing "MyItemToAdd, true" and skipping the "1" (assuming 1 was default).

Thanks again, I really appreciate it! You've saved me hours of angst and woe.
User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Mon Jun 18, 2012 7:55 pm

Glad to hear it!

The problem with your approach is that the compiler was interpreting "true" as the value of the second parameter, and leaving the third one (which you wanted to change) with its default value.

Cipscis
User avatar
Mr. Ray
 
Posts: 3459
Joined: Sun Jul 29, 2007 8:08 am


Return to V - Skyrim