Difference between revisions of "Rent A Room Tutorial"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Vswe
(Rewrote this as it stood in "Things you can do" in the AI Portal)
imported>Morerunes
(fixed code, grammar)
Line 7: Line 7:


===Preparing the room===
===Preparing the room===
We Start with the door;<br> First set Ownership to your Npc:s BaseID. <br>Then Lock it. Not with a key, just choose hard or something.<br> Add a Reference ID, Example: "''(YourInnsname)Rentdoor''" And check the ''Persistent Reference'' box.<br>
We Start with the door;<br> First set Ownership to your Npc's BaseID. <br>Then Lock it. Not with a key, just choose hard or something.<br> Add a Reference ID, Example: "''(YourInnsName)Rentdoor''" And check the ''Persistent Reference'' box.<br>
Then set the same Ownership to the bed and add a Refrence ID, Example: "''(YourInnsname)Rentbed''". Then check the ''Persistent Reference'' box.
Then set the same Ownership to the bed and add a Refrence ID, Example: "''(YourInnsname)Rentbed''". Then check the ''Persistent Reference'' box.


===The Npc===
===The Npc===
The Npc Needs a Script To be able to rent you the bed.<br><br>
The Npc needs a script to be able to rent you the bed.<br><br>


Add a Name:
Add a Name:
Line 18: Line 18:
Then add the variables;
Then add the variables;
  short rent        ;if you have rent the room or not
  short rent        ;if you have rent the room or not
  short rentday      ;Which day you rent the room
  short rentday      ;make sure it's the same day
short rentmonth    ;Which month you rent the room
  short cleanup      ;For the Reseting
  short cleanup      ;For the Reseting
  short setup        ;Check if the first part has been run
  short setup        ;Check if the first part has been run
Line 27: Line 26:
  begin gamemode
  begin gamemode
   
   
  if ( rent == 1 )                        ;If you have rent the room
  if ( rent == 1 )                        ;If you have rented the room
 
 
   if ( setup == 0 )                      ;If this haven't been done before
   if ( setup == 0 )                      ;If this hasn't been done before
   set rentday to GameDay                ;Saves the day of the rental
   set rentday to GameDaysPassed        ;Saves the day of the rental  
  set rentmonth to GameMonth            ;Saves the month of the rental  
   set setup to 1                        ;We don't want this to happen again
   set setup to 1                        ;We don't want this to happened again
   ''(YourDoorRef)''.unlock                  ;Unlock the door
   ''(YourDoorRef)''.unlock                  ;Unlock the door
   ''(YourBedRef)''.SetOwnership            ;Makes it legal to sleep in the bed
   ''(YourBedRef)''.SetOwnership            ;Makes it legal to sleep in the bed
   
   
   else                                  ;If we already have done that
   else                                  ;If we have already done that
 
 
   if ( GameDay != rentday )            ;If it is a new day
   if ( GameDaysPassed != rentday )            ;If it is a new day
     set cleanup to 1                    ;Makes the Reset Ready
     set cleanup to 1                    ;Makes the reset ready
  elseif ( GameMonth != rentmonth )    ;Prevent Error at new month
    set cleanup to 1                    ;Makes the Reset Ready
   endif
   endif
   endif
   endif
   
   
   if Player.GetinCell ''(YourInnCell)'' == 0 ;If The player is outside the inn
   if Player.GetinCell ''(YourInnCell)'' == 0 ;If the player is outside the inn
   if ( Cleanup == 1 )                  ;If the Reset Is Ready
   if ( Cleanup == 1 )                  ;If the reset Is ready
     set Cleanup to 2                    ;Start The Reset
     set Cleanup to 2                    ;Start the reset
   endif
   endif
   endif
   endif
Line 53: Line 49:
   
   
   
   
   if ( Cleanup == 2 )                    ;If the Reset should Start
   if ( Cleanup == 2 )                    ;If the reset should start
   
   
   
   
Line 61: Line 57:
   set setup to 0                         
   set setup to 0                         
   set rentday to 0
   set rentday to 0
  set rentmonth to 0
   set cleanup to 0
   set cleanup to 0
   
   
   
   
   ''(YourDoorRef)''.SetOpenState 0        ;Close The door
   ''(YourDoorRef)''.SetOpenState 0        ;Close the door
   ''(YourDoorRef)''.lock 30                ;Lock the door
   ''(YourDoorRef)''.lock 30                ;Lock the door
   ''(YourBedRef)''.SetOwnership (NpcID)    ;Make it Illegal to sleep in the bed
   ''(YourBedRef)''.SetOwnership (NpcID)    ;Make it illegal to sleep in the bed
   endif
   endif
  endif
  endif
Line 74: Line 69:


Change The Class to ''MerchPublican''.<br>
Change The Class to ''MerchPublican''.<br>
If you want you can add AI so the Npc can sale Beer And Food (see point 4, 4.2 and 5.2 in [[My First Shop]]
If you want you can add AI so the npc can sell beer And food (see point 4, 4.2 and 5.2 in [[My First Shop]]


===The Dialogues===
===The Dialogues===
Now The Last thing: The Dialogues.<br><br>
Now the last thing: The dialogues.<br><br>
Open The Quest window, select the ''BedRental'' quest and click on the ''Topics'' tab.<br>
Open the quest window, select the ''BedRental'' quest and click on the ''Topics'' tab.<br>
Select the ''Bed'' topic.<br> In the Response list you add a new response with a text like: "''Hope it suits you''".<br> Then add the audio, if you don't want to record your own voice you can unpack some voices from oblivion.<br><br> Then add Conditions; First add one with:
Select the ''Bed'' topic.<br> In the response list you add a new response with a text like: "''Hope it suits you''".<br> Then add the audio, if you don't want to record your own voice you can unpack some voices from oblivion.<br><br> Then add conditions; First add one with:
<br><br>
<br><br>
This make so you Can't rent a bed outside the inn<br>
If Your Npc Don't move away from the Inn you can Skip the first one.<br><br>


'''Target:''' No<br>
'''Target:''' No<br>
Line 92: Line 83:
'''Value:'''1<br>
'''Value:'''1<br>
AND<br><br>
AND<br><br>
This makes it so you can't rent a bed outside the inn<br>
If your npc Doesn't move away from the inn you can skip the first one.<br><br>


Add a new Condition:<br>
Add a new Condition:<br>
This Condition make so this dialogue only works for our Npc.<br><br>
This condition makes it so this dialogue only works for our npc.<br><br>


'''Target:''' No<br>
'''Target:''' No<br>
Line 104: Line 98:


Add the last Condition:<br>
Add the last Condition:<br>
He only say this dialogue if you have rent the bed<br><br>
He only says this dialogue if you have rented the bed<br><br>


'''Target:''' No<br>
'''Target:''' No<br>
Line 113: Line 107:
AND<br><br>
AND<br><br>


Go Back to the Response list and add a new response.<br> Write something like this: "''I've got a room, and a cheap one at that. You looking for one?''".<br>Add Audio. <br>Add the same Condition as last timer but change the Value of the GetSctiptVariable Condition to 0. <br>We want him to say this if you Haven't Rent the bed. <br>Then in The Choices LIst to the right you add: ''BedNo'' and ''BedYes''.<br><br>
Go back to the Response list and add a new response.<br> Write something like this: "''I've got a room, and a cheap one at that. You looking for one?''".<br>Add audio. <br>Add the same Condition as last time, but change the value of the GetSctiptVariable condition to 0. <br>We want him to say this if you haven't rented the bed. <br>Then in the Choices list to the right, you add: ''BedNo'' and ''BedYes''.<br><br>


The next part is opional, you only do this if you want to make a special response if you choose no.<br><br>
The next part is optional, you only need to do this if you want to make a special response if you choose no.<br><br>
Select ''BedNo'' in the list to the left.<br> Add a new Response with a text like this: "''Then stop wasting my time.''".<br> Add audio. <br>Add a Conditon; The same GetISId Contition as before.<br><br>
Select ''BedNo'' in the list to the left.<br> Add a new response with a text like this: "''Then stop wasting my time.''".<br> Add audio. <br>Add a Conditon; The same GetIsId Condition as before.<br><br>


If you Skiped the last part, Countinue here.<br><br>
If you skipped the last part, continue here.<br><br>


Select the ''BedYes'' in the left menu.<br> Make a new Response with a Text like this: "''Right then. Head up the stairs, and it's the first door on your right. Remember, I didn't say it was clean. I said it was cheap.''".<br> Add Audio.<br><br>
Select the ''BedYes'' in the left menu.<br> Make a new response with text like this: "''Right then. Head up the stairs, and it's the first door on your right. Remember, I didn't say it was clean. I said it was cheap.''".<br> Add audio.<br><br>
In the Result Script Box you write this:
In the Result Script box you write this:


  player.removeitem gold001(Priceoftheroom);Remove gold from the player           
  player.removeitem Gold001(Priceoftheroom) ;Remove gold from the player           
  set ''(YourNpcRef)''.rent to 1              ;You have now rent the room
  set ''(YourNpcRef)''.rent to 1              ;You have now rented the room


Then add the same GetIsId as allways.<br><br>
Then add the same GetIsId as always.<br><br>


Add this condition:<br>
Add this condition:<br>
Line 138: Line 132:
AND<br><br>
AND<br><br>


Then add a new response with a text like this: "''Not even ''(Priceoftheroom)'' gold to your name? And here I thought I had it bad. Sorry, but I need you to pay before I can let you stay here.''". <br>Add Audio.<br>Add the same Conditions as the last one had but change the Comp in the Getitemcont condition to <. So he say this if you don't have ''(Priceoftheroom)'' gold.<br><br>
Then add a new response with text like this: "''Not even ''(Priceoftheroom)'' gold to your name? And here I thought I had it bad. Sorry, but I need you to pay before I can let you stay here.''". <br>Add Audio.<br>Add the same conditions as the last one, but change the Comp in the Getitemcont condition to <. So he says this if you don't have ''(Priceoftheroom)'' gold.<br><br>


And now you're done.
And now you're done.

Revision as of 23:33, 7 August 2008

How to make a Npc Rent you a bed for the night.

Preparations

Preparing the room

We Start with the door;
First set Ownership to your Npc's BaseID.
Then Lock it. Not with a key, just choose hard or something.
Add a Reference ID, Example: "(YourInnsName)Rentdoor" And check the Persistent Reference box.
Then set the same Ownership to the bed and add a Refrence ID, Example: "(YourInnsname)Rentbed". Then check the Persistent Reference box.

The Npc

The Npc needs a script to be able to rent you the bed.

Add a Name:

Scriptname Publican_(Youinnsname)(yourNpcsname)

Then add the variables;

short rent         ;if you have rent the room or not
short rentday      ;make sure it's the same day
short cleanup      ;For the Reseting
short setup        ;Check if the first part has been run

Write the rest of the Script:

begin gamemode

if ( rent == 1 )                        ;If you have rented the room
	
 if ( setup == 0 )                      ;If this hasn't been done before
  set rentday to GameDaysPassed         ;Saves the day of the rental 
  set setup to 1                        ;We don't want this to happen again
  (YourDoorRef).unlock                  ;Unlock the door
  (YourBedRef).SetOwnership             ;Makes it legal to sleep in the bed

 else                                   ;If we have already done that
	
  if ( GameDaysPassed != rentday )             ;If it is a new day
   set cleanup to 1                     ;Makes the reset ready
  endif
 endif

 if Player.GetinCell (YourInnCell) == 0 ;If the player is outside the inn
  if ( Cleanup == 1 )                   ;If the reset Is ready
   set Cleanup to 2                     ;Start the reset
  endif
 endif



 if ( Cleanup == 2 )                    ;If the reset should start


;Resets The Variables
	
  set rent to 0                         
  set setup to 0                        
  set rentday to 0
  set cleanup to 0


  (YourDoorRef).SetOpenState 0         ;Close the door
  (YourDoorRef).lock 30                ;Lock the door
  (YourBedRef).SetOwnership (NpcID)    ;Make it illegal to sleep in the bed
 endif
endif

End

Change The Class to MerchPublican.
If you want you can add AI so the npc can sell beer And food (see point 4, 4.2 and 5.2 in My First Shop

The Dialogues

Now the last thing: The dialogues.

Open the quest window, select the BedRental quest and click on the Topics tab.
Select the Bed topic.
In the response list you add a new response with a text like: "Hope it suits you".
Then add the audio, if you don't want to record your own voice you can unpack some voices from oblivion.

Then add conditions; First add one with:

Target: No
Fuction Name:GetInCell
Function Info: (YourInnCell)
Comp:==
Value:1
AND

This makes it so you can't rent a bed outside the inn
If your npc Doesn't move away from the inn you can skip the first one.

Add a new Condition:
This condition makes it so this dialogue only works for our npc.

Target: No
Fuction Name:GetIisId
Function Info: (YourInnNpc)
Comp:==
Value:1
AND

Add the last Condition:
He only says this dialogue if you have rented the bed

Target: No
Fuction Name:GetScripVariable
Function Info: (YourInnNpc)Rent
Comp:==
Value:1
AND

Go back to the Response list and add a new response.
Write something like this: "I've got a room, and a cheap one at that. You looking for one?".
Add audio.
Add the same Condition as last time, but change the value of the GetSctiptVariable condition to 0.
We want him to say this if you haven't rented the bed.
Then in the Choices list to the right, you add: BedNo and BedYes.

The next part is optional, you only need to do this if you want to make a special response if you choose no.

Select BedNo in the list to the left.
Add a new response with a text like this: "Then stop wasting my time.".
Add audio.
Add a Conditon; The same GetIsId Condition as before.

If you skipped the last part, continue here.

Select the BedYes in the left menu.
Make a new response with text like this: "Right then. Head up the stairs, and it's the first door on your right. Remember, I didn't say it was clean. I said it was cheap.".
Add audio.

In the Result Script box you write this:

player.removeitem Gold001(Priceoftheroom) ;Remove gold from the player           
set (YourNpcRef).rent to 1               ;You have now rented the room

Then add the same GetIsId as always.

Add this condition:
It makes the npc say this only if you have enough gold.

Target: Yes
Fuction Name:GetItemCount
Function Info:Gold001
Comp:>=
Value: (Priceoftheroom)
AND

Then add a new response with text like this: "Not even (Priceoftheroom) gold to your name? And here I thought I had it bad. Sorry, but I need you to pay before I can let you stay here.".
Add Audio.
Add the same conditions as the last one, but change the Comp in the Getitemcont condition to <. So he says this if you don't have (Priceoftheroom) gold.

And now you're done.