Check if player has bought house upgrades?

Post » Fri May 27, 2011 9:36 pm

I want to make a simple mod that allows the player to rent out a player owned house.

But I wanted to make it so the rent goes up each time the player buys one of the upgrades for it. But how would I tell in the script that the player has bought an upgrade?
User avatar
Mike Plumley
 
Posts: 3392
Joined: Wed Sep 05, 2007 10:45 pm

Post » Sat May 28, 2011 6:55 am

I want to make a simple mod that allows the player to rent out a player owned house.

But I wanted to make it so the rent goes up each time the player buys one of the upgrades for it. But how would I tell in the script that the player has bought an upgrade?


Each house has a quest with a questscript. You can look up the references of the stuff that gets enabled there. If all the upgrades were bought the quest advances to stage 30. You could check for these things. Like

short BravilRentif getstage HouseBravil >= 10 && getstage HouseBravil < 30; house bought, no upgrades yet, set rent to minimumset BravilRent to 20    if ParentReadingAreaBravil.getdisabled == 0    ; check for the various additions and increase the rent      set BravilRent to BravilRent + 5    endif    if ParentKitchenAreaBravil.getdisabled == 0      set BravilRent to BravilRent + 5    endif    if ParentDiningAreaBravil.getdisabled == 0      set BravilRent to BravilRent + 5    endif    if ParentStorageAreaBravil.getdisabled == 0      set BravilRent to BravilRent + 5    endif    if ParentRacksBravil.getdisabled == 0      set BravilRent to BravilRent + 5    endif    if ParentPaintingsTapsBravil.getdisabled == 0      set BravilRent to BravilRent + 5    endifelseif getstage HouseBravil == 30; all upgrades bought, set rent to maximumset BravilRent to 50endif


There are quite a lot of checks, but if the script runs at default questdelaytime or less it shouldn't matter.
User avatar
michael danso
 
Posts: 3492
Joined: Wed Jun 13, 2007 9:21 am

Post » Fri May 27, 2011 9:04 pm

There are quite a lot of checks, but if the script runs at default questdelaytime or less it shouldn't matter.

I'm currently at work, so I cannot look inside the scripts, but I have peeked inside those quest scripts before and IIRC each script contains a variable telling how many upgrades have been bought for that house. So instead of checking each upgrade individually, just check the value of that quest variable. If it is 5, it means that 5 upgrades have been bought.
User avatar
Daniel Lozano
 
Posts: 3452
Joined: Fri Aug 24, 2007 7:42 am

Post » Sat May 28, 2011 2:56 am

Thanks guys, that'll make it much easier.

I am having an issue though, maybe someone can help.

Currently I have a script running on my Imperial House key that when equiped it brings up a MessageBox asking if I want to rent that house out.

If I press YES the script runs StartQuest RentHouse which runs a quest script that deposits gold into the player each day. That works fine.

However, it is stopping the quest that I'm having difficulty with. I tried using StopQuest RentHouse if I press NO but the quest continues. I don't understand this as StopQuest should work.

How do I stop the quest after starting it by using the object script attached to my key?
User avatar
carly mcdonough
 
Posts: 3402
Joined: Fri Jul 28, 2006 3:23 am


Return to IV - Oblivion