How to create buyable housemod extensions

Post » Tue Aug 02, 2011 5:54 pm

Hi all, i've recently started modding and i've actually created a pretty decent housemod (or so i think), what i would like to do though is make parts of it unavailable from the start, and when the PC buys the upgrade from some merchant, the place becomes available. Now, i don't know a thing about scripts or anything but i'm guessing it's all about setting objects as "initially disabled" and then enable them through a script that checks the PC's inventory for the upgrade item.

Am i right, and if yes/no would someone point me in the right direction (tutorial/hints)

Your help is very much appreciated! :D

-Joe
User avatar
james tait
 
Posts: 3385
Joined: Fri Jun 22, 2007 6:26 pm

Post » Tue Aug 02, 2011 4:49 pm

Considering you say you know nothing about scripting, you've got it pretty much exactly right.

The way the developers did it was to set one object in the house for that upgrade group as the parent, and assigned all the other grouped objects as its children. So for example, for a kitchen upgrade, one of the tables could have been placed and made persistent, being called ParentKitchenAreaBruma and marked as disabled. Then all other objects that would be part of the kitchen upgrade would be set as having ParentKitchenAreaBruma as their parent. (Read up on parent objects if you're confused, but basically objects that have a parent object assigned can't be enabled/disabled individually. If the parent object is enabled, all the children are enabled too, and vice versa).

They then have a script attached to the house quest, which does a GameMode check for a few things. The first thing it does is checks the quest stage to see if we've bought the house. If we have, it enables the merchant chest (in this example HouseBrumaAddonsRef) containing the upgrade scrolls (allowing us to buy upgrades).
if ( GetStage HouseBruma == 10 ) && ( MerchSetup == 0 )
HouseBrumaAddonsRef.Enable
HouseBrumaAddonsRef.SetOwnership Suurootan
set MerchSetup to 1
endif


Once this is done the script then checks to see if the individual upgrade scrolls are in the players inventory. If they are, it enables the relevant parent object.
if ( Player.GetItemCount HouseBrumaKitchenAreaReceipt == 1 ) && ( Doonce == 0 )
ParentKitchenAreaBruma.Enable
set TotalCount to ( TotalCount + 1 )
set Doonce to 1
endif

The total thing is just to check how many upgrades the player has bought, in order for the "I've bought everything" quest stage to happen.

I hope I've explained things enough. If you have any questions feel free to ask.
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Tue Aug 02, 2011 3:27 pm

Good explanation SomeWelshGuy, only one step missing. :)

The HouseBrumaKitchenAreaReceipt (from your example) has a script attached named HouseFurnReceiptScript. It is quite simple, and its only job is to set the upgrad scroll's price to 0 when you have bought it (so that you cannot sell it back after having received the furniture):

Scriptname HouseFurnReceiptScriptshort Dooncebegin OnAddif ( Doonce == 0 )	SetItemValue 0	set Doonce to 1endif


If you add new furniture upgrade scrolls, this part is as easy as adding this same vanilla script to your scrolls, and they'll change their price correctly. The fact that you do this, will also make my Enhanced Economy recognize the upgrade scroll as a real upgrade scroll and not a random scroll, and that is important for a couple of reasons...

end
User avatar
tiffany Royal
 
Posts: 3340
Joined: Mon Dec 25, 2006 1:48 pm


Return to IV - Oblivion