[Register] [785014 Members] [42678 Online; 134 Members, 42544 Guests]  
The Elder Scrolls 4
File Search

 Picture of the Month

 The Files
 » Browse Files
 » Search
 » Submit Files

 The News
 » News
 » News Archive
 » Submit News

 Elder Scrolls IV: Oblivion
 » About
 » Features
 » Screenshots
 » Cheats
 » Mod FAQ
 » System Requirements
 » Browse
    - Media
    - Miscellaneous
    - Modifications
    - Official
    - Skins
    - Utilities

 TES III: Morrowind
 » About
 » Features
 » Screenshots
 » System Requirements
 » Browse
    - Media
    - Modifications
    - Official
    - Skins
    - Utilities

 Elder Scrolls Lore
 » Races
    - Orc
    - Breton
    - Imperial
    - Redguard
    - Nord
    - High Elf
    - Dark Elf
    - Wood Elf
    - Argonian
    - Khajiit
 » Provinces
    - High Rock
    - Cyrodiil
    - Hammerfell
    - Skyrim
    - Summerset Isle
    - Morrowind
    - Valenwood
    - Black Marsh
    - Elsweyr
 » Elder Scrolls Universe

 The Community
 » Links
 » ES4 Forums
    - General Discussion
    - Modding & Editing
    - Problems & Help
 » PotD Archive
 » Submit PotD
 » Taking Screenshots

 The Site
 » Latest Poll
 » Staff
 » Apply To Volunteer
 » Contact

  Modding Tutorial: Inns - Mods
  Posted by: Fire_Legion on 09-25-2007 @ 08:46 - Source: Super Llama
This News Item has been viewed 25,973 times
Inn tutorial
by Super Llama

LEVEL: Intermediate to Advanced

Before I start, I would like to apologize. When this tutorial was requested, I responded "inns are easy." I was wrong! As soon as I started writing this, I noticed how hard inns actually were, and I realized all the more how valuable a tutorial on how to do them would be. So I set to work, looking at already-made inns and how they work, and figured out how to do it. This tutorial is the result of my work. It is important that you READ EVERY DETAIL CLOSELY, because it is so complex, you can't afford to make a mistake.

Many people have trouble with Inns, because they are so complex; what with getting the owner to work, making the beds rentable, etc. This tutorial will walk you through the process of creating your very own working inn interior.

To start, duplicate a premade interior and re-name it. Delete all the references to start from a blank cell. Add an interior static like LowerClassTavern01. To find it, go to the WorldObjects section, then Static, then Architecture, then LowerClass, and it should be in the list. Click and drag it onto the render window. Don't forget to add lights!

Layout your inn any way you want it. There are three things you have to do right, however; first, you need to make the bed that the player can rent. Put it wherever you like; then doubleclick on it. Give it a Reference Editor ID of "(INN)RentBed", replacing (INN) with the name of your inn; and make it a Persistant Reference, and click OK. Then, for the door to the room with your bed in it, choose any door that fits and place it as you like. Double-click on it, and give it an ID of "(INN)RentDoor", replacing (INN) with your inn's name, and make it a Persistant Reference. Click the Lock tab and give it a lock level of Average or Hard, and then press OK.

The next step is to make the NPC. If you want it to sell things, see my Merchant Tutorial for creating it. If you don't, simply Edit one of the TestNPCs and change its ID.

Press OK. Now click on the pencil on the main toolbar to bring up the script window. In Script menu, click New. Copy the following script into the box, replacing all instances of (INN) with the name of your inn, (CELL) with the ID of your interior, and (OWN) with the ID of your NPC. If this looks scary, that is because it is an advanced script. I have included comments to show you what each line does. REMEMBER TO REPLACE (INN), (CELL), and (OWN)!


Scriptname Publican_(INN) ;names the script.

;Todo: replace (INN) with the name of your inn, (CELL) with the ID of your inn's interior, and (OWN) with the ID of your owner NPC.

short rent ;if the player has rented a bed.
short rentday ;what day the player has rented a bed.
short rentmonth ;what month the player has rented a bed.
short cleanup ;if it is time to put the bed back to normal
short setup ;if it is time to check if the day has changed

begin gamemode ;do every second

if ( rent == 1 ) ;if the player has rented a room

if ( setup == 0 ) ;if the player does not yet have ownership of the bed

set rentday to GameDay ;set the rentday variable to the current GameDay
set rentmonth to GameMonth ;set the rentmonth variable to the current GameMonth
set setup to 1 ;start the setup process
(INN)RentDoor.unlock ;unlock the bed door
(INN)RentBed.SetOwnership ;make the bed owned by no one

else ;otherwise,

if ( GameDay != rentday ) ;if it is not the day that the player rented the bed,

set cleanup to 1 ;start the cleanup process

elseif ( GameMonth != rentmonth ) ;also, if it is not the same month,

set cleanup to 1 ;do the same

endif ;end the if block


if ( Player.GetinCell (CELL) == 0 ) ;if the player is not in the inn,

if ( Cleanup == 1 ) ;and if the cleanup has started,

set Cleanup to 2 ;start the bed reset process

endif ;end the if block

endif ;end the if block

if ( Cleanup == 2 ) ;if it is time to reset the bed,

set rent to 0 ;reset the rent variable, so the player no longer has a bed rented
set setup to 0 ;reset the setup variable, so the script can be run again later,
set rentday to 0 ;reset the rentday variable, so the script can be run again later,
set rentmonth to 0 ;reset the rentmonth variable, so the script can be run again later,
set cleanup to 0 ;reset the cleanup variable, so the script can be run again later,

(INN)RentDoor.SetOpenState 0 ;close the bed door
(INN)RentDoor.lock 30 ;lock the bed door
(INN)RentBed.SetOwnership (OWN) ;make it so it is illegal to sleep in the bed

endif ;end the if block

endif ;end the if block

End ;end the script


Then save the script and close the script window.

Now go back to your NPC's form and double-click on it.
Then, in the Script Box, choose the script you made above; Publican(INN). Click the AI button and make sure his Aggression is 5 so he won't try to murder you.
Change anything else you want to change; add AI, change its race, gender, or face; give it clothes, etc. When done, press OK, and when asked "create new form," click yes. Once your NPC is finished, drag it into your cell.

Next, you need to add the Bed Rental dialogue. Go to the Character menu and click Quests. In the list, find BedRental and click it. Go to the Topics tab, and select the "bed" topic. Right-click on the list of responses and click new. In the Response Text box, type what you want your character to say when asked about "Bed." Example: "Yes, I have a bed available. It's 20 gold." Then press OK. Right-click in the Choices box, and click Add Topic. In the list, select BedYes and BedNo. Then click OK.

Now select the "BedYes" topic. TOPIC, not Choice; it's on the left with "bed." Right-click on the list of responses and click new. In the Response Text box, type what you want your character to say when the player says "I'll take it." Example: "Wonderful. It's up the stairs to the right." Then click OK. In the Result Script box, type the following script, replacing (OWN) with the ID of your NPC:

player.removeitem gold001 20
set (OWN).rent to 1

And click compile.

Now go back to the "bed" topic, and select the dialogue you created earlier. In the Conditions box, right-click the list and click New. The defualt condition is GetDisposition; but we don't want that right now, so in the "Condition Function" dropdown box, select GetIsID. See the button to the right under Function Paremeters? It should say INVALID. Click it now. In the dialog box that comes up, there is a box that says "01." Click it and in the list, choose the ID of your NPC. Press OK. This condition will check to see if it is your NPC that is saying this. We don't want EVERYONE to say it! That would be a disaster! (believe me, it's happened to me before...)

Again, right-click in the Conditions box and click "New." In the Condition Function dropdown box, select the function GetScriptVariable.
The button should say ( TARGET ), UNKNOWN. Click it now, and then click the [TARGET] button. Click "Select Reference in Render Window" and double-click on your NPC. Then press OK. In the Variable Name box, select rent, and press OK. The conditions box should now look like this:

no GetScriptVariable Reference: '(OWN)', rent == 0.00 AND
no GetIsID NPC: '(OWN)' == 1.00 AND

Don't worry if it is upside-down, it doesn't matter what order they are in.
Now, right-click in the Conditions box again, and click "Copy All Conditions." This will make it so that you wont have to do all that again for the next topics.
Go back to the BedYes topic, and click the dialogue you created earlier. Right-click on its Conditions box, and click Paste Conditions. This will add the conditions that we created in the last step. But this time, select the GetScriptVariable condition, and change it to GetItemCount. Check the "Run on Target" box. Click the function paremeters button, which probably says "INVALID", and for the ObjectID, select Gold001, and press OK. For the Comparison, instead of ==, choose >=. Then in the value box, type 20. The conditions screen should look like this:

yes GetItemCount miscitem: 'Gold001' >= 20.00 AND
no GetIsID NPC: '(OWN)' == 1.00 AND

If you haven't guessed what this does; it checks to see if the player has at least 20 gold. The inn will now work, but there would be some bugs. If you have already rented a room, he wouldn't say anything when you click bed, and if you don't have enough gold when you say "I'll take it," he won't say anything either. Either way the game has a chance of Crashing, and we don't want that.

To fix these, we need to add alternative dialogue in case these conditions are NOT met. Go back to the "bed" topic now. Right-click again in the list of responses, and click New. In the Response Text box, type what you want your NPC to say when the player asks for a room when he has already bought one; example: "Quit joking. You already bought my only room." Press OK. In the conditions box, right-click and select "Paste Conditions." Select the GetScriptVariable condition and change the value from 0.000 to 1. The conditions window should now look like this:

no GetScriptVariable Reference: '(OWN)', rent == 1.00 AND
no GetIsID NPC: '(OWN)' == 1.00 AND

Now go back to the "BedYes" topic. Create a new response in the same way you have earlier; by right-clicking in the list and clicking New. In the Response Text box, type what you want your NPC to say when you don't have enough gold to buy the room. Example: "You don't have enough gold; you need at least 20 septims." Press OK, and in the conditions box, once again, right-click and select Paste Conditions. Once again, select the GetScriptVariable condition, change it to GetItemCount and check the "Run on Target" box. Click the function paremeters button, which probably says "INVALID", and for the ObjectID, select Gold001. For the Comparison, instead of ==, choose <=. Then in the value box, type 20. The conditions screen should now look like this:

yes GetItemCount miscitem: 'Gold001' <= 20.00 AND
no GetIsID NPC: '(OWN)' == 1.00 AND

Now press OK to close the Dialogue Window, and finish furnishing your inn.
Don't forget to make a load door so you can go in and out of this inn!
Now your inn should work. Put a building and door somewhere in an exterior worldspace, double-click on the door, and on the Teleport tab, check the "Teleport" box. In the Cell dropdown list, choose your Inn's interior cell. In the "Reference" box, choose the load door that was NOT the Rent Door. Press OK. Move the Doormarker (that big yellow thing) to the place you want it, and Right-click-and-drag it to rotate it. Double-click on it and press Yes, then do the same for the other end.

Now for the fun part: Start up Oblivion and test it out!
Hope this tutorial helps.

Happy Modding from Super Llama and the Tutorial Team!

          Next News Post 09-27-2007 @ 09:12 - Gaming Against Cancer Weekend
          Previous News Post 09-21-2007 @ 17:16 - [OVERHAULED] FileFront Network Insider #110

Average User Rating: 9
Number of Votes: 4
E-Mail to FriendSave to del.icio.usStumble It!Share on FacebookFark It!

User Comments  
The following comments are owned by the user that posted them. The Elder Scrolls Files is not responsible for their content.

Total comments: 8 | Last comment: 10-01-2007 at 17:14

 #1 - 09-25-2007 at 21:46
From: (NSW)
Joined: July 2nd, 2007
Posts: 9
sorry to ask here but im new to game and i was wondering how do you put things in chests?? when moddin that is?

 #2 - 09-26-2007 at 13:27
Joined: March 4th, 2007
Posts: 148
If you are 100% new to modding and don't have a clue about the CS, you MUST read this.


 #3 - 09-26-2007 at 19:12
Joined: April 16th, 2007
Posts: 476
To put things in chests, you have to make a new chest. Find a chest in the object window and right-click it. Click Edit. Change the ID to something unique, then drag-and-drop items into it, then press OK and then Yes.

 #4 - 09-27-2007 at 06:49
From: (New York)
Joined: June 12th, 2007
Posts: 39

I have a pre-existing 2 cell inn. It has AI and script free placeholder npcs. When I saw this tutorial I thought, OK I'll try making the inn functional. I started reading up to the point where you refer to the merchant making tutorial.

I'm currently working on the latest version of my mod, and have 8 cells finished with one cell in the process of being cluttered, and another 3 empty of all except room piecesgeometry, teleport doors, lights and light fixtures.

I was planning on adding fuctional merchants thanks to your earlier tutorial. I was putting it off until the other v059 work was done, but when I saw this I thought OK why not try it now. Especially since I asked for it and you know when you just need a break from one long stretch to go do something else smile

But I noticed a problem. (This is a merchant related question, I'm sure I'll have inn related ones once this is finished) I followed the directions of the tutorial with a few minor changes. Instead of using aaaserviceseditorloc8x12lockatend512, I used just the aaaserviceseditorloc8x12 package because I didn't want the Inn to be locked up at night. The character I used it on is a wood elf female (who I had to redo because she wasn't a merchant) with 0 agression (the second change, instead of 5) and 100 confidence, energy, personality and responsibility. She is also the owner of both cells.

The problem I had was, she offered for sale not just what was in her merchant container, but like all the misc item, potion, etc clutter in the cell! Like the glasses on the table and the books in her bookshelf. How do I get her to sell only the stuff in her container? I thought about removing her as owner but then everything would just be open for theft.

Thank you for your help and for both tutorials. big grin

 #5 - Models - 09-30-2007 at 03:25
From: (New Milton)
Joined: August 7th, 2006
Posts: 81
if theres anything i want to know for using the tes CS for oblivion, its how to load in my own models and get collision working. Could this be the next tutorial?

 #6 - 09-30-2007 at 19:04
Joined: April 16th, 2007
Posts: 476
Are the other items persistant references? Because if they are, make sure they aren't. I will look into this problem and see If I can figure it out.

I think Mad_Griffin would be better for this, because although I am an expert modeler, he is better at collision. He knows more about exporting than I do.

 #7 - 10-01-2007 at 04:51
From: (New York)
Joined: June 12th, 2007
Posts: 39
Nevermind, I figured out what I was doing wrong.

I had to make a new faction for the innkeeper to belong to. Then I changed ownership of the cell from her to the new faction. Now only the stuff in her container is for sale, and the rest stays put and "red handed".

Also I followed the Inn tutorial and now have a functional inn.

I had one small problem though, it wouldn't let me compile the remove gold script at first. I had to come back to it after everything else was done. It still worked in the end though.

Thank you very much for both tutorials.

 #8 - 10-01-2007 at 17:14
Joined: April 16th, 2007
Posts: 476
yer welcome big grin

Any other requests? I will probably do a Dialogue tutorial next if nobody says anything.

When posting comments, you must follow these rules:
  1. No "Yay I got First Post!" posts, no exceptions and no matter what other content the post has!
  2. No Pornographic Material. Any sexually oriented imagery or links to such content will not be tolerated.
  3. No Warez or Illegal Software. This includes linking to software, posting about it, and suggesting to get it.
  4. No Cursing or Swear words. We encourage you to use our comment sections as a forum to debate files, news, etc., but please use proper adjectives to express yourself. We will not tolerate abuse upon another member or author.
  5. No Attacks / Retaliation of any kind against a member, or group of members.
  6. Please do not advertise for other sites or forums here.
  7. Maximum of 3 smileys per regular member.
The high interactivity of this site should be considered a luxury, not a right. If you cannot follow these simple rules, you can and will be warned or banned from the comments, site or the entire network for any period of time.
Now enjoy yourself and behave!

  • Register: To get your own Username, click here!
  • Forgot your password? click here!
  • You can use UBB here!
Username:     Password:  
Remember my username and password
Comment Title:
Your comments for this News please:

 Latest News
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..
 » Weekly Poll Results ..

 Latest Files
 » DUN.. (special addition)
 » Visible Mournhol.. (1.0)
 » Champions of Ligh.. (V2)
 » Champions of Lig.. (2.0)
 » Skyrim White Wer.. (1.0)
 » Faction Living.. (v1.00)
 » Dancing Boys (v1)
 » Necromancer Birthsig..
 » Black Rose Manor (1.0)
 » The Castle of Re.. (1.0)

 The Network
 » Gaming News
 » Game Demos
 » Game Patches
 » Trailer Videos
 » Gaming Forums

 Game Portals:
 » Age of Empires 3
 » Aliens vs Predator 2
 » America's Army
 » ArmA 2
 » Armada 2
 » Battlefield 1943
 » Bridge Commander
 » Brothers in Arms 2
 » Call of Duty 4
 » Command & Conquer
 » Company of Heroes
 » Crysis
 » Counter-Strike: Source
 » Dawn of War Series
 » Day of Defeat: Source
 » Diablo 3
 » Doom 3
 » Elite Force
 » Enemy Territory
 » Fallout 3
 » Far Cry 2
 » F.E.A.R.
 » Flight Simulator X
 » GTA San Andreas
 » Half-Life 2
 » Halo
 » Jedi Knight 3
 » Knights of the Old Republic
 » Left 4 Dead 2
 » LOTR: Battle 4 Middle Earth
 » Medal of Honor
 » Operation Flashpoint
 » Quake 4
 » Red Faction: Guerrilla
 » rFactor
 » Silent Hunter 4
 » Sins of a Solar Empire
 » Soldier of Fortune 2
 » S.T.A.L.K.E.R.
 » Star Trek: Legacy
 » Star Wars Battlefront 2
 » Star Wars Empire at War
 » StarCraft II
 » Starfleet Command III
 » Supreme Commander
 » Team Fortress 2
 » The Elder Scrolls IV
 » The Sims 2
 » TrackMania United
 » Unreal Tournament 3
 » Warcraft III
 » World of Warcraft
 » X3: Terran Conflict

You got served by in 0.1571 seconds using 11 MySQL queries and 12 includes
Copyright © 2015 FileFront, Inc. All rights reserved.
Design by Jos Jongejan aka Pro-Filer & FileTrekker. Use of The Elder Scrolls Files materials is subject to certain Terms & Conditions.
TM & © 2015 Bethesda Softworks LLC. All rights reserved. The Elder Scrolls and related marks are trademarks of Bethesda Softworks LLC