Quick Question About Merchants

Post » Sat Feb 19, 2011 1:40 am

Can NPCs in Oblivion sell keys? I'm trying to make a merchant who sells the key to a house, but I can't get him to put it up for sale. Help please :)
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Fri Feb 18, 2011 10:37 pm

What you have to do is make a receipt (ie deed or similar) that they sell and then when it is added to the player inventory have a script on it that adds the key - you can not have the NPC sell the key directly (IIRC this is so that NPC shop owners do not sell the key to their shop making it impossible for them to open\close shop each day !)

If you need to look at an example I did this in my One stop armor mod so that when you bought a set of armor from the vendor it adds the key to that armor display (chest)

Here is a screenie of the pertinent script and items for the amelion armor display -- ( http://i212.photobucket.com/albums/cc189/JDFanning_bucket/amelion.jpg )

As you can see I first made the key - then made a scroll that is the receipt for purchase and added the script that adds the key (I think I should have used the Editor ID instead of the Form ID but it was working using the Form ID so I left them that way but it makes it harder to know what is being added then if you use the Editor ID !) - added that to the vendor with the price for the purchase - this way when the player buys the display the key gets added to their inventory - you need the Doonce so that it will not add multiple copies of the key and the setitemvalue 0 changes the price of the receipt to zero so that the player can not buy the key and afterward sell the receipt ! If you need more info PM me and I'll see if I can explain it a bit more in detail.
User avatar
Veronica Flores
 
Posts: 3308
Joined: Mon Sep 11, 2006 5:26 pm

Post » Fri Feb 18, 2011 9:05 pm

(I think I should have used the Editor ID instead of the Form ID but it was working using the Form ID so I left them that way)

As JDFan said, you should use the Editor ID instead of the Form ID. The first two digits of Form IDs which aren't part of the Oblivion.esm are dependent on load order, so they change whenever your load order does. Editor IDs remain the same regardless of load order, so they're more reliable.
User avatar
lilmissparty
 
Posts: 3469
Joined: Sun Jul 23, 2006 7:51 pm

Post » Fri Feb 18, 2011 8:33 pm

Thanks guys, totally got it working thanks to you.

I have another question though. I think its kind of obvious that I'm making a house mod. I'm making a personal one for Morroblivion actually :P And now I want to add guards and other upgrades to the house that you can purchase from a merchant who lives inside the house with you. So basically I want to use the same idea, purchasing a contract; which in this case I would like to run a script when added to your inventory that enables specific objects around the house. Currently I am trying to figure out how to enable all the guards around the house using the script thats run off purchasing the contract. I know I need to use the enable command on the already disabled guards, but what exactly am I referencing here? The form ID of the guards, or do I need to set the reference editor ID of each individual guard? (Both of these I have attempted and neither have been successful.)

Thanks ahead of time for any help :) It will be greatly appreciated.
User avatar
Dj Matty P
 
Posts: 3398
Joined: Sat Jun 09, 2007 12:31 am

Post » Sat Feb 19, 2011 4:51 am

You would set a Reference Editor ID on the guards. Never use a numeric as the first character cause it will NOT work.

Or you could use an xmarker that the guards all parent to, and then you only have to enable the xmarker and all its children will also enable.

http://tesalliance.org/forums/index.php?app=gallery&module=images&img=3427
User avatar
Glu Glu
 
Posts: 3352
Joined: Sun Apr 01, 2007 5:39 am

Post » Sat Feb 19, 2011 4:47 am

The Reference Editor ID will not work for some reason. I'll post my script:

scriptname 00GuardContract

short doonce

begin onadd

if ( doonce == 0 )
setitemvalue 0
set doonce to 1
.enable Nordguard
.enable Nordguardd
.enable Nordguarddd
Messagebox "You have purchased a lifetime contract for Nordic Mercenaries to watch over your Morrowind household. They shall arrive immediately."

endif

end

There are three guards, each one with the Reference Editor ID listed above after ".enable"
User avatar
Lori Joe
 
Posts: 3539
Joined: Tue Jun 20, 2006 6:10 am

Post » Sat Feb 19, 2011 4:10 am

The Reference Editor ID will not work for some reason. I'll post my script:

*snip*

First, never start an Editor ID or script name with a number (it can cause all kinds of wacky problems). Use letters instead. Second, you need to put the reference name before the ".enable" command (and don't put a space in it). Try this:

scriptname AAGuardContractshort dooncebegin onadd  if ( doonce == 0 )	setitemvalue 0	set doonce to 1	Nordguard.enable 	Nordguardd.enable 	Nordguarddd.enable 	Messagebox "You have purchased a lifetime contract for Nordic Mercenaries to watch over your Morrowind household. They shall arrive immediately."  endifend

User avatar
i grind hard
 
Posts: 3463
Joined: Sat Aug 18, 2007 2:58 am

Post » Sat Feb 19, 2011 2:28 am

You might be interested in using the http://cs.elderscrolls.com/constwiki/index.php/CS_Functions if you plan on scripting.
User avatar
Emma Louise Adams
 
Posts: 3527
Joined: Wed Jun 28, 2006 4:15 pm

Post » Sat Feb 19, 2011 7:31 am

Alright, thanks a ton guys, everything is working quite well at the moment. I have another question though. I have a mine that you can purchase that I want you to be able to recieve earnings from. I set the chest containing the earnings to respawn, but I don't think thats really the most reliable way to implement the system. Do you guys have an idea as to how I can script the chest to refresh it's contents every few days, and send you a message each time it does? I would also like this script to govern multiple chests simultaneously, since I'm allowing the player to purchase the construction of new sections of the mine where new chests will be located, therefor increasing the earnings you would collect after every few days as a reward for expanding the mine.
User avatar
Nicole Elocin
 
Posts: 3390
Joined: Sun Apr 15, 2007 9:12 am


Return to IV - Oblivion