Selling Keys

Post » Fri May 04, 2012 2:42 am

In the CS is it possible to make an NPC sell a key? If so, what box should be checked in the AI?
User avatar
Tiffany Holmes
 
Posts: 3351
Joined: Sun Sep 10, 2006 2:28 am

Post » Thu May 03, 2012 3:18 pm

Yes it is possible. You need to set the AI to offer services. Basically set them up as a merchant.
User avatar
Chloe Lou
 
Posts: 3476
Joined: Sat Nov 04, 2006 2:08 am

Post » Thu May 03, 2012 9:15 pm

Ok thanks but whats the Buys/Sells box I have to check? Miscellaneous, Weapons etc.?
User avatar
Louise Lowe
 
Posts: 3262
Joined: Fri Jul 28, 2006 9:08 am

Post » Thu May 03, 2012 4:44 pm

You can't buy and sell keys. You could buy a title to a property (as a "book" - miscellaneous item) and get a key with it, but the key itself is different. I believe it would get too complicated if you could ever sell a key, as the game doesn't have any way to undo the ownership that goes with it. So the game doesn't let keys be be sold or bought at all.
User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am

Post » Thu May 03, 2012 5:40 pm

Ok thanks, how would you go about getting a key when you buy a certain book?
User avatar
Philip Rua
 
Posts: 3348
Joined: Sun May 06, 2007 11:53 am

Post » Thu May 03, 2012 3:53 pm

Actually I don't think keys can actually be sold --instead you have to set up a receipt like is done on the home sales in the vanilla game and then place a script on the book that when added to the players inventory changes the value of the receipt to 0 (so it can not be sold) and then adds the key to the players inventory. For my One Stop armors mod I first made the keys and then made a book\scroll for the merchant to sell (so the merchant was set up to sell books) -- then added the script below to the book -- then when the player bought the book from the merchant it would run the script (Only once so they did not get multiple keys) which changed the value of the book to 0 - and added the key to the players inventory. (NOTE : the same thing could be done in the background by making a new item (say food item or other item the merchant sells) and then adding the script to that item and adding the key to the player and removing the item that the script was placed on so that as far as the player can tell they just recieve the key. )

This is an example of the script I used in my one stop armors mod for the armor displays that the merchant sold :

Scriptname OneStopArmorsAmelionDisplayScript

short Doonce

begin Onadd

if ( Doonce == 0 )
SetItemValue 0
set Doonce to 1
player.additem JDFanAmelionDisplayKey 1
Messagebox "The key and receipt have been added to your Inventory - You will find the armor inside the display"

endif

end
User avatar
Jade
 
Posts: 3520
Joined: Mon Jul 10, 2006 6:42 am

Post » Thu May 03, 2012 2:14 pm

Ok thanks JDFan....I think I understand that, it's funny because I can understand Java but not TES scripting.
User avatar
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Fri May 04, 2012 12:21 am

Wait whats Doonce and Onadd?
User avatar
Raymond J. Ramirez
 
Posts: 3390
Joined: Sun Oct 14, 2007 8:28 am

Post » Thu May 03, 2012 9:59 pm

Wait whats Doonce and Onadd?

Doonce is a variable that is declared so it can be used in the script -- that way when the script is run the first time (Doonce is initialised as = 0) it passes the check in the line ( if ( Doonce == 0 ) ) so the rest of the script continues then once it runs the variable is set to = 1 so afterwards if the script runs again the check fails and the script does not run (without it the script would get stuck in an endless loop and run continually setting the recipt value to 0, adding the key, and displaying the messagebox over and over and over etc. !!)

SO it pretty much does what it says in the naming (makes the code run only once !)

OnAdd -- is a defined Block Type that runs when the item the script is on is added to the containers (in this case the players inventory) ( http://cs.elderscrolls.com/index.php/Begin )
User avatar
lacy lake
 
Posts: 3450
Joined: Sun Dec 31, 2006 12:13 am

Post » Thu May 03, 2012 2:41 pm

Oh right, ok thanks just setting up the NPC to sell the book now :biggrin:

Thanks very much for the help :biggrin:

EDIT: Later that day.....Wahoo it works :D
User avatar
[ becca ]
 
Posts: 3514
Joined: Wed Jun 21, 2006 12:59 pm

Post » Thu May 03, 2012 6:05 pm

Oh and I've set the price of the book to be 1000 gold but....it ends up being 1618 when I go to buy it. I know this is to do with the batering and everything but can I change it?
User avatar
Marie Maillos
 
Posts: 3403
Joined: Wed Mar 21, 2007 4:39 pm

Post » Thu May 03, 2012 11:35 pm

Oh and I've set the price of the book to be 1000 gold but....it ends up being 1618 when I go to buy it. I know this is to do with the batering and everything but can I change it?

THe actual sell price in game is always going to vary since it uses a formula that includes several variables to determine the price including :
  • http://cs.elderscrolls.com/index.php/FBarterBuyBase
  • http://cs.elderscrolls.com/index.php/FBarterBuyMult
  • http://cs.elderscrolls.com/index.php/FBarterDispBase
  • http://cs.elderscrolls.com/index.php/FBarterDispositionMod
  • http://cs.elderscrolls.com/index.php/FBarterHaggleBase
  • http://cs.elderscrolls.com/index.php/FBarterHaggleCurve
  • http://cs.elderscrolls.com/index.php/FBarterHaggleDispMult
  • http://cs.elderscrolls.com/index.php/FBarterHaggleMax
  • http://cs.elderscrolls.com/index.php/FBarterSellBase
  • http://cs.elderscrolls.com/index.php/FBarterSellMult

So I do not think there is a way to determine an exact price but you could adjust it so that the actual price that shows up in game is closer to what you wanted !
User avatar
A Boy called Marilyn
 
Posts: 3391
Joined: Sat May 26, 2007 7:17 am

Post » Fri May 04, 2012 2:06 am

Alright thanks :D
User avatar
Robert Devlin
 
Posts: 3521
Joined: Mon Jul 23, 2007 2:19 pm


Return to IV - Oblivion