Jump to content

Script Compiles, Doesn't Work as Intended (noob)


CompGuyJMB

Recommended Posts

  • Replies 57
  • Created
  • Last Reply

Top Posters In This Topic

See, that's weird, because when you first enter the cell, the generator is running. I can tell because it adds 10 to the workshop power. If I turn it off, the workshop power drops to zero. It could be the PowerRadiation Range, I'll have to look at that.

 

The enable marker is no longer tied to the generator (though it is named as such). Initially, when you hit that switch, it would Enable the generator (there was a static one there so that the enable / disable didn't make it disappear), and it also activated the enable/disable marker for the lights. I eliminated the generator control portion until the radio thing got worked out - reducing variables. Now, all that switch does is enable the marker for the lights.

 

To make my generator, I used the workshop large generator, and just re-skinned it (changed the model). It should be the same as the large generator, just look different...

 

I'll delete my generator and try placing one in workshop mode and see if that makes a difference. Sounds like it may have for you guys, so maybe something is funky with the generator. If that works, I'll try placing one of the "vanilla" ones without re-skinning it to see if that's the culprit.

 

I'll also try a fresh game as Kitcat suggested.

 

Thanks again guys!

 

One more thing, I threw a bunch of Workshop Keywords at it too. Nothing worked... even tried linking the radio to the workshop as a WorkshopKeywordItem.

Ah sorry, I meant the generator is working fine..I meant your lights are not working. But I got the idea it's not completed yet.

There is a difference between adding power to the workshop and transmitting it to other objects. Just to make it clear..Adding a generator makes the workshop register the power. But it does not automatically transmitts it to other objects. It just poduces it. In order to transmit you connect it to a conduit or power pylon. So you generator only affects other objects after connecting it to the counduit on the ceiling.

Apart from this the radio is missing the script... And I don't know how to help with this..Try ading the script to the radio reference.

Link to comment
Share on other sites

So, even with adding a PowerRadiation value to the generator, it doesn't "radiate" the power? I still have to connect the generator to a pylon or conduit / connector? If so, I can incorporate that as a quest or something to make it fit my lore.. this was the one last step he didn't complete before the bombs dropped. :)
Link to comment
Share on other sites

So, even with adding a PowerRadiation value to the generator, it doesn't "radiate" the power? I still have to connect the generator to a pylon or conduit / connector? If so, I can incorporate that as a quest or something to make it fit my lore.. this was the one last step he didn't complete before the bombs dropped. :smile:

Well...This requires more testing. BigAndFlabby has suggested you changing the value to at least 500. I suspect that the value can be the active radius value. Then 500 means that the radius is close to a couple of vanilla floors which is close to the reality. And you have only 50 . So maybe this is the reason that for me it only worked after connecting it to the conduit.

But you also can go another way. Remove that value from the generator and leave it for player to build the wire. You can put a ladder there and some tools or maybe a skeleton to make it look like someone was going to connect it by died before completeing it. I don't think it would need creating a aquest, it's enough simple to guess.

Edited by kitcat81
Link to comment
Share on other sites

I have no clue why kitcat81 is not seeing the script on the radio. It does show propery with SV for me.

 

And yes, after adjusting the radiation value of the generator to 500 the radio would power up. But only after I picked it up and placed it back down. It was not properly registering that it had power until then. I'm not sure why, unless it has to do with only checking for power in the OnInit which likely fires before the generator actually emits power. Maybe re-checking on every Cell Attach might solve that.

Link to comment
Share on other sites

I have no clue why kitcat81 is not seeing the script on the radio. It does show propery with SV for me.

 

And yes, after adjusting the radiation value of the generator to 500 the radio would power up. But only after I picked it up and placed it back down. It was not properly registering that it had power until then. I'm not sure why, unless it has to do with only checking for power in the OnInit which likely fires before the generator actually emits power. Maybe re-checking on every Cell Attach might solve that.

Hey BigAndFlabby ..I think I know why, my bad. I forgot that I have only the .esp file :D . There is just no script with the required name in my folders. I followed the dropbox link, installed and did not pay attention that it's only .esp.

I think you might be right and it can happen so because OnInit fires prior to power registration. The power was properly registered when I connected the generator to the conduit and also properly changes if I turn the generator off and on by activating it.

Edited by kitcat81
Link to comment
Share on other sites

I'm not using OnInit because of that reason. I'm using OnCellAttach. The first line in OnCellAttach is Utility.Wait(2) to make the script pause for 2 seconds before checking for power, to give the cell some time to fully load. It very well could be that I have to attach a power conduit to get things to work. I'll have to check tonight, I'm taking a break from hanging drywall. Darn wife and her priorities :-)
Link to comment
Share on other sites

I'm not using OnInit because of that reason. I'm using OnCellAttach. The first line in OnCellAttach is Utility.Wait(2) to make the script pause for 2 seconds before checking for power, to give the cell some time to fully load. It very well could be that I have to attach a power conduit to get things to work. I'll have to check tonight, I'm taking a break from hanging drywall. Darn wife and her priorities :-)

Hi there. If you want us to test you need to upload your script somewhere. I don't have a copy of it and don't know what changes has been made.

Link to comment
Share on other sites

I think I posted the link to the ESP earlier, but I just made sure the most-recent version is there. Here's the link in case it isn't working. I haven't shared too much with Dropbox :)

 

https://www.dropbox.com/s/3lxifp1pnnz44i8/JMB.esp?dl=0

 

I'm not sure why the script isn't showing up. Do I need to include something else or compile it differently? I've included it below:

Scriptname JMBBunkerCheckForPower extends ObjectReference
{Checks to see if PowerSource is on before allowing device (self) to turn on}

Event OnCellAttach()
; When Player enters cell
	Utility.Wait(2.0) ; Wait 2 seconds to give the cell some time to load.  Cannot use OnLoad or OnCellLoad - not fired everytime cell is entered, or OnInit - only fires when ESP is loaded.

	If (Self.IsPowered() == false) ; Check if Device is receiving power from Workshop (not necessarily turned on)
		BlockActivation(true)
		Debug.MessageBox ("Device is not receiving power")
	Else
		BlockActivation(false)
		Debug.MessageBox ("Device IS receiving power")
	EndIf
EndEvent

Event OnPowerOn(ObjectReference akPowerGenerator)
; When Workshop Power is Turned On
	Debug.MessageBox ("Generator was Turned On")
	BlockActivation(false)
EndEvent

Event OnPowerOff()
; When Workshop Power is Turned Off
	Debug.MessageBox ("Generator was Turned Off")
	BlockActivation(true)
	
	; If Radio is Playing, Turn it Off
	If (IsRadioOn()== true)
		SetRadioOn(false) ; stop playing
	EndIf

EndEvent

Thanks again to all of you for putting your time into helping me work through this.

Link to comment
Share on other sites

So, I loaded the same ESP as I shared here. Even with upping the PowerRadiation from 50 to 500, it had no effect on the radio.

1. I built a ceiling power conduit, but could not attach my generator to it - most likely because the visual model I'm using doesn't have a power line attachment.

2. I built a small generator while in workshop mode, and this still had no effect on the radio (using CanBePowered keyword). As soon as I connected the workshop generator to the power conduit, everything worked fine. YAY!

3. In the creation kit, I removed my "pre-installed" generator, and placed DLC02WorkshopGeneratorFusion, adding a PowerRadiation of 500.00 (it had none by default). This generator has a power connection by vanilla. Started the game, and the radio didn't work. As soon as I attached the generator to the power conduit, things worked fine.

4. I went back into the creation kit and added a ceiling power conduit. Went back in game, and as soon as I connected the generator to the condiut, things worked fine.

 

So, it seems that regardless of the PowerRadiation setting of the generator, the radio does not "receive" power until the generator is connected to a power conduit (as I believe someone may have mentioned). The generator itself will not "radiate" power, despite having this keyword. This is kind of odd, and may take some tinkering if I decide to persue it. Good news is I now know the problem was generator/power radiation related, not radio script related.

 

One last thing to contend with is having the generator start in the "powered off" state. Last month, I had posted that question here, and received no "helpful" answers:

 

https://forums.nexusmods.com/index.php?/topic/6379166-creation-kit-switch-controlled-generator/

 

Now knowing more about how the creation kit works, I can probably eventually figure this out... unless someone knows off the top of their head :wink:

 

I'm thinking a simple check at OnInit to see if the workshop is getting power and if so, "activate" the generator to turn it off. This would have to be done at OnInit instead of OnCellAttach, otherwise the generator would continually shut itself off, if the player decides he wants to leave it on.

 

Another "interesting idea" I had is to find a way to have the generator "consume" fusion cells. Perhaps set a counter that starts on activation (power up) and pauses on activation (power off). After so accumulated time running, it would shut down. When re-activated it would remove a fusion cell from the player's inventory, or complain that they don't have one and have to get one. I've seen some Skyrim scripts on making a working fireplace that removes kindling from the player's inventory, so I know it's possible.

 

You know, more difficult ideas just for immersion's sake :smile:

Edited by CompGuyJMB
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...