Question: Gas Powered Generator?

Post » Sat Mar 20, 2010 7:53 am

I noticed that the mod : Underground city, has a generator in one of the rooms that if you put in some flamer fuel, it will power the lights in the room when It's activated, how would I go about putting this into my mod? Also is there a way I could script this so I need to keep pouring more in in order for the lights to keep powering up and staying on?
User avatar
Sarah MacLeod
 
Posts: 3422
Joined: Tue Nov 07, 2006 1:39 am

Post » Sat Mar 20, 2010 12:13 pm

Thought I am not 100% sure how, I know that you can do that relatively easily. Sorry I just started learning menus and that kind of thing, so I would probably confuse some things and tell you how to wrong. Pkleiss (the maker of Underground City) should be along shortly.
User avatar
Madison Poo
 
Posts: 3414
Joined: Wed Oct 24, 2007 9:09 pm

Post » Sat Mar 20, 2010 6:21 am

ok np ill wait
User avatar
Vickey Martinez
 
Posts: 3455
Joined: Thu Apr 19, 2007 5:58 am

Post » Sat Mar 20, 2010 6:57 pm

Ahh you know what. I'm unsure as to when he will be on (should be soon >.>) but I think I will give it a go. First I have some questions about what you are looking for. So it is my understanding you want a generator, where you put Flamer Fuel into it to run it. For examples sake shall we say, it consumes 1 unit of fuel every minute? Also, do you want to put the fuel in with a menu? i.e. a menu pops up saying something like "there is a fuel tank in the generator, it looks like you could pour some in to run it." or whatever. Then have two buttons, one saying "Leave it alone" and one saying "Pour in some flamer fuel." or would you rather you just use (activate) the generator and it automatically adds flamer fuel from your inventory if you have it, otherwise it does nothing. Once you answer this I will help you try to put this together.

EDIT: Pkleiss is on, so he should be able to help shortly :D (Sorry for volunteering you lol :P)
User avatar
Marina Leigh
 
Posts: 3339
Joined: Wed Jun 21, 2006 7:59 pm

Post » Sat Mar 20, 2010 3:40 am

Its three parts: the generator, the switch and the terminal/lights.

The generator has a script that displays a menu message to either leave the thing alone or add some fuel. The option to add fuel has a condition that the player actually have the right amount needed to start it up, so it only displays when the player has enough fuel on him. Once the player adds fuel, a variable called "Task" in the generator script is set to 1. The switch next to the generator uses Task == 1 in an OnActivate block. If Task = 1, the script fires and disables the "Off" terminal on the desk. The "Off" terminal is set as the enable parent of the "On" terminal which is placed in the exact same spot as the "Off" terminal and its the enable parent of the light as well. Both the "On" terminal and the lights are set so that the enable state is opposite of the parent. Disabling the "Off" terminal then has the visual effect of turning on the terminal and the lights. To make it use fuel, you would have to add a timer section to the generator script that every time period, say 2 minutes, it uses up one fuel. You would define a variable that stores the amount of fuel, and every time the timer runs out, subtract 1 from the amount of fuel variable and reset the timer. Once the fuel variable reaches zero, enable the "Off" terminal to turn off the terminal and lights and reset the Task variable to 0 to start the process all over again. You might also want to add some options to the menu message to add various amounts of fuel based on the player's inventory. Mine only requires 5 Flamer fuel, but you could add options for more, thus allowing the lights and stuff to stay on longer.
User avatar
Skrapp Stephens
 
Posts: 3350
Joined: Mon Aug 06, 2007 5:04 am


Return to Fallout 3