GetGoldValue() returning 0 for some items

Post » Sun Nov 18, 2012 3:06 pm

I'm noticing some items are returning 0 values when GetGoldValue() is used on them, even if they show a value in inventory. For example:

Scriptname somescript extends somethingweapon property IronGreatsword autosomeEvent ()	 debug.notification("Iron great sword is worth: "+IronGreatsword.GetGoldValue())	 ; reports 0	 Game.GetPlayer().AddItem(IronGreatsword)	 objectreference myOR = Game.GetPlayer().DropObject(IronGreatsword)	 debug.notification("Iron great sword is worth: "+myOR.GetGoldValue())	 ; reports 0endsomeEvent

I tried uninstalling all mods (except my little test mod) but it did not change the 0 result. Does anyone get a different result? Is my code wrong?
User avatar
Beast Attire
 
Posts: 3456
Joined: Tue Oct 09, 2007 5:33 am

Post » Sun Nov 18, 2012 4:03 pm

GetGoldValue() must be called on a form and you call it on an ObjectReference.
Try this one:

"Iron great sword is worth: "+myOR.GetBaseObject().GetGoldValue())

EDIT - the first notification you use is right though, I don't see what's wrong there :confused:
User avatar
anna ley
 
Posts: 3382
Joined: Fri Jul 07, 2006 2:04 am

Post » Sun Nov 18, 2012 8:13 pm

Adding GetBaseObject() did nothing. Can't seem to get a gold value from anything... Can someone confirm GetGoldValue() is working and what you got a value from?


Edit:

With SKSE I wrote a small script that examines everything in an NPC's inventory and gives me a copy of items found with a gold value > 0. It finds all kinds of stuff, like salt piles, weapons and gems. But if I form property those items into my script and use GetGoldValue() on them, the value is always 0. (The properties are filled.)

Edit #2

More weirdness.


form property saltpile autoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)	 game.getplayer().additem(saltpile)	 objectreference myOR = game.getplayer().dropobject(saltpile)	 debug.notification("form is is worth: "+myOR.GetBaseObject().GetGoldValue())EndEvent


While in inventory while pickpockeing the code returns 0. While in my own inventory, I get a value of 2.


Edit #3

Scratch that. It's not the particular inventory. The first time the script is run, the value is zero. The second time the script is run, I get a value. I also get the same result with the GetWeight() function. Anyone know what's up with that?
User avatar
Jonathan Montero
 
Posts: 3487
Joined: Tue Aug 14, 2007 3:22 am


Return to V - Skyrim