Jokerine Posted July 1, 2014 Share Posted July 1, 2014 (edited) Hello everybody! I have been working hard on a mod to rebuild Nipton, and something I'm stumped with is a script for a rentable bed I'd like to have. I know I could just make the player be given a key to a room with the bed in it, but I would have liked to go with a script that gives the player the key to a room, and simply removes it after 24 hours with a little message to let them know. I have read around about this, and it seems like this requires a timer script, which is absolutely blowing my mind away. I've read the wiki and posts on the forums but I just cannot figure it out. Is there anybody who may happen to know how to make this happen, so I don't end up blowing up my computer? Thank you, fingers crossed! :smile: Edited July 1, 2014 by Jokerine Link to comment Share on other sites More sharing options...
EsvDefcon Posted July 1, 2014 Share Posted July 1, 2014 Don't worry about timers and the like, it's actually really easy to do :) Before you make your script, you need a bed. This bed needs to be a persistent reference, and it needs to have it's own reference (double-click it, give it a reference e.g. BedREF, and tick the persistent reference box). You will also need an NPC to rent the bed from, such as a receptionist. They will also need to have a reference, and be a persistent reference. You will also need top set up a quest for all of this to happen inside of. Assign the following script to your quest, and save the script as a quest. scn RentBedScript short rentday begin Gamemode if gameday != rentdayRentBedREF.SetOwnership RentNPCendif end Then, go to your NPC's dialogue. Go to the topic where you rent the bed from them, and put this in the result script box: player.removeitem caps001 x ;replace x with the caps you have to pay to rent the bed, or just delete this line if you don't want itBedREF.SetOwnershipset RentBedQuest.rentday to gameday This script removes the necessary caps, sets the ownership of your bed to the player, and sets the variable rentday in the script to gameday. The main script creates a variable which is called rentday. Rentday is just a thing, you don't need to worry about it. But, basically, when the bed is rented, then it will set the rentday to gameday. When this is true, the player will own the bed, and they will therefore be able to use it. When the next day comes, the player will no longer own the bed. This will make them unable to use it. As for a key, you can just add: player.additem YourKeyName 1 to the topic where you rent the bed from the NPC, and then do: player.removeitem YourKeyName 1 when the rentday is not gameday. (i.e. if rentday != gameday player.removeitem YourKeyName 1). Link to comment Share on other sites More sharing options...
Jokerine Posted July 1, 2014 Author Share Posted July 1, 2014 (edited) Thanks! This sounds really complicated, but I'll give it a shot tomorrow. I was hoping to avoid quests because I'm bad with those and I did not want to have silent dialogue, so I just wanted to have an activator with the script attached to it, and add/remove the key with the script. But I'll see what I can do with this. WOuld it be possible to add this script to an activator instead of a quest? Thank you again - I hope I don't come across as rude, but all I was hoping for was to have the script to add and remove the key :smile: Edited July 1, 2014 by Jokerine Link to comment Share on other sites More sharing options...
EsvDefcon Posted July 2, 2014 Share Posted July 2, 2014 RIght, for an activator, you could do something similar: scn RentBedScript short rentday begin onActivate Player if gameday != rentdayplayer.additem YourKeyName 1endif end You'd also need a script which removes the key from the player: scn RemoveKeyScript begin onTriggerEnter Player if gameday == rentdayplayer.removeitem YourKeyName 1endif end You'd have to assign that script to a trigger where you want the key to be removed from the player. Or, you could do: scn RemoveKeyScript begin Gamemode if gameday != rentdayplayer.removeitem YourKeyName 1endif end Link to comment Share on other sites More sharing options...
Jokerine Posted July 2, 2014 Author Share Posted July 2, 2014 That sounds like something I could manage, thanks! I figure the "gamemode" block to remove the key would be assigned to a quest? I figure just a blank quest could do, right? I'll read about this now and see what I can do. Thank you so much :) Link to comment Share on other sites More sharing options...
Recommended Posts