Clipz Posted September 25, 2007 Share Posted September 25, 2007 Ok, I'm working on a mod that will allow the houses of dead NPC's to be buyable. How I plan to do this is through an Ability spell that continously checks to see whether or not the NPC is alive or not. When they die I'd like it to check for houses that NPC might have owned and removing ownership from it. Then the door's that lead into that building will be set unopenable without a key. A sign will apear infront of the house that when activated will check for the right amount of gold and if you have it take the gold and give you a key. Then once you buy the house the sign will disappear. I don't know how to make it look for buildings(or items for that matter) that belong to the NPC, i don't know if I can check for and lock all doors that lead to the building, and I don't know how to change ownership. For that matter I don't even know if it is possible. Any help on this would be appreciated. Link to comment Share on other sites More sharing options...
Abramul Posted September 25, 2007 Share Posted September 25, 2007 I'll run you through the functions you'll need. I'm not going to explain dialogue, as it's more complex, and I'm not familiar with it. I'm assuming signs posted on doors. I'd suggest you start with only a few NPCs, for instance MD agents. I'm assuming you know where and how to use If and EndIf. Someone gets killed...and the next time you visit their town, a master script uses the following:Begin GameModeto start the script. Since your script will ultimately be fairly complex, you'll want to use a timer (detailed in the GameMode link) to run it every...10 minutes or so should be good. You can use an OnLoad block to reset the timer to cause it to run a few seconds after the player returns to the city. GetDeadorGetDeadCountto check if the owner is dead. Remember, a house may have more than one occupant. Lockto lock the door. 100 is unpickable. Enableto make the For Sale sign appearorPlaceAtMein order to avoid having to place a sign at every door. You'll need to figure out the proper placement for each door style, which can be done in the editor. Endterminates the GameMode block. Now the For Sale sign is on the door. The player activates it...and a separate script attached to the sign starts.Begin OnActivateSelf explanatory. GetGoldto check if the player has enough gold. MessageBoxto ask if the player wants to buy the house. GetButtonPressedto detect their answer. RemoveItemin order to deduct the appropriate amount of gold (EditorID: Gold001). SetCellOwnershipto give the player ownership of a cell. Remember to repeat for basements and other attached cells. SetCellFullNameif you want to change the name of the house. Again, basements etc. Disableto remove the For Sale sign. Endterminates the OnActivate block. ------ You'll end up repeating the stuff inside the GameMode block of the first script for each actor, substituting the relevant references for each. I'm pretty sure you'll end up needing to create a separate script for each house's For Sale sign. Note: I *think* this is everything you'll need. Check the provided links for each command for details on what arguments are needed. Link to comment Share on other sites More sharing options...
Clipz Posted September 26, 2007 Author Share Posted September 26, 2007 Thanks a ton. Luckily your assumptions were correct and I have used most of the script commands before. For those that I havent I can look up on the TES wiki (Which I just noticed is where your links take me) so I can understand them more fully. Again thanks I really appreciate it. If I run across any problems I'll post them, unless ofcourse I solve them on my own. Link to comment Share on other sites More sharing options...
Clipz Posted September 26, 2007 Author Share Posted September 26, 2007 Ok, well this isn't exactly necessary but I'd like to know how to get to NIF files of oblivion objects. I've never tried accessing them before and I found out that they arent on the disc or the file on the computer. Again this isn't necessary and I'll finish the mod with out it but I'd rather have my for sale signs be a blank sheet of paper than a sign that says Anvil. Link to comment Share on other sites More sharing options...
Abramul Posted September 26, 2007 Share Posted September 26, 2007 This tutorial covers retexturing, and has links for all the tools you'll need for that. Link to comment Share on other sites More sharing options...
Clipz Posted September 27, 2007 Author Share Posted September 27, 2007 Thanks for that information. I've got the mod working... for the most part. I'm testing the scripts on an NPC named Eugal who belongs to the MD faction and will attack during the main quest. Once I get it working for him I'll search for any other NPCs that own homes that will be killed during a quest and set it up for them. Link to comment Share on other sites More sharing options...
Clipz Posted September 27, 2007 Author Share Posted September 27, 2007 Ok, I've tried several things and it won't work. After alot of testing I came up with code that should work. I'll post it below.. For some reason, the sign won't appear when Eugal is killed. I have the sign set on Initially Disabled and have its reference ID as EugalSignb. This is the Ability Script which is set as magic and the ability is on the player. scn aabSellHouse float timershort initshort dead Begin OnLoad set init to 0End Begin GameMode if init == 0 set timer to 10 else if timer > 0 set timer to timer - getSecondsPassed else set dead to eugalbeletteref.getDead if dead == 1 eugaldoor.lock 100 1 enable EugalSignb MessageBox "Eugal's house should now be for sale." Endif Endif EndifEnd This is the script on the sign. scn aabEugalSign Short Working Short Choosing Short Choice Begin onActivate Set Choosing to -1 Set Working to 1 end Begin GameMode If Working If (Choosing == 0) Set Working to 0 Elseif (Choosing == -1) Messagebox "Would you like to buy this house for 5000 gold?" "Yes" "No" Set Choosing to 1 Set Choice to -1 Elseif (Choosing == 1) If (Choice == -1) Set Choice to GetButtonPressed Elseif (Choice == 0) player.removeItem 0000000F 5000 setCellOwnership ChorrolEugalBelettesHouse setCellOwnership ChorrolEugalBelettesBasement setCellFullName ChorrolEugalBelettesHouse "My House" setCellFullName ChorrolEugalBelettesBasement "My Basement" disable EugalSignb eugalDoor.unlock Set Choosing to 0 Elseif (Choice == 1) ;Second Option Set Choosing to 0 Endif Endif Set Working to 1 Endif End Any help, again, will be appreciated. Link to comment Share on other sites More sharing options...
Abramul Posted September 28, 2007 Share Posted September 28, 2007 I don't see init being set to something other than 0. It looks like this will end up constantly resetting the timer. Also, you can use a code box (to the right of the Quote button) to preserve tabs...flat text is somewhat ambivalent. Link to comment Share on other sites More sharing options...
Clipz Posted September 28, 2007 Author Share Posted September 28, 2007 Good Point. Looking back now I feel kinda stupid.. Oh well. ANd thanks for tipping me in on the box thing, I was wondering how people did it. Ill test again with it setting init to 1 after setting the timer and if all goes well you won't hear from me again until it's done. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.