Jump to content

CompGuyJMB

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by CompGuyJMB

  1. OK, that makes sense. I had every other mod except this one disabled during my testing.
  2. Wonder why I couldn't find that. Thanks, ThoraldGM!
  3. Thanks, JackRob. Where in the Creation Kit would I go to make the "archived mod"? Other than the script inclusion, are there any other differences?
  4. Hi Everybody! (Hi Dr. Nick!) I've created a small mod (ESP file) that adds a new interior cell. I have written some custom Papyrus scripts as part of the mod. While sharing it here on the forms to get some troubleshooting help (https://forums.nexusmods.com/index.php?/topic/6413086-script-compiles-doesnt-work-as-intended-noob/), the guys were saying that the scripts were not showing up. I know they were there though, attached to the appropriate ObjectReferences. Do I have to do something special to get my scripts to "become part of the ESP file", so I can share the ESP file and the scripts are included? (That was a Simpsons reference above if anyone missed it...)
  5. I FINALLY GOT EVERYTHING TO WORK THE WAY I WANT IT TO! I got a little creative disabling the generator on initialize. Basically if the marker is off, it shuts the generator off. This only needs to happen the first time things load. I guess OnInit would not disable the generator - maybe the cell wasn't fully loaded (even with a 5 second wait) Thanks so much guys! ESP is updated for you guys to look at if you like. I still have to figure out how to "compile the scripts into the ESP" so they are present. ESP Ilnk: https://www.dropbox.com/s/3lxifp1pnnz44i8/JMB.esp?dl=0 Generator Switch code: Scriptname JMBBunkerGeneratorSwitchScript extends ObjectReference ObjectReference Property GeneratorEnableMarker Auto {Enable / Disable Marker for Generator} ObjectReference Property Generator Auto {The generator that is toggled on and off} ObjectReference Property CellWorkshop Auto {Link this to the cells Workbench} ; Needed for the “CurrentPowerGeneration” variable to get its value WorkshopParentScript Property WorkshopParent Auto Const {Set this to WorkshopParent} Event OnCellAttach() Utility.Wait(1.0) ; Wait 1 second to let cell load ; Retrieve the Current Power Output in the Workshop float CurrentPowerGeneration = CellWorkshop.GetValue(WorkshopParent.WorkshopRatings[WorkshopParent.WorkshopRatingPower].resourceValue) Generator.BlockActivation(true,true) ; Blocks Player Activation, Disables Activate prompt in game. ; Generator.Activate(Game.GetPlayer(), true) will still work, as "true" forces the activation to occur, but also bypasses the OnActivate() event on the generator itself. If (GeneratorEnableMarker.IsDisabled()) ; This means that the Generator SHOULD be off If (CurrentPowerGeneration > 1.0) ; See if Power is being generated (ie Generator is on) Generator.Activate(Game.GetPlayer(), true) ; Activate the generator to turn it off (true disables OnActivate from firing) Debug.MessageBox ("Trying to Shut Down Generator") EndIf EndIf EndEvent Event OnActivate(ObjectReference akActionRef) If (GeneratorEnableMarker.IsDisabled()) GeneratorEnableMarker.Enable() Else GeneratorEnableMarker.Disable() EndIf Generator.Activate(Game.GetPlayer(), true) ;Toggle Generator State - Have to use True since BlockActivation is used above EndEvent Radio Code: 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(1.0) ; Wait 1 second 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 (IsPowered() == false) ; Check if Device is receiving power from Workshop (not necessarily turned on) BlockActivation(true) Else BlockActivation(false) EndIf EndEvent Event OnPowerOn(ObjectReference akPowerGenerator) ; When Workshop Power is Turned On BlockActivation(false) EndEvent Event OnPowerOff() ; When Workshop Power is Turned Off BlockActivation(true) ; If Radio is Playing, Turn it Off If (IsRadioOn()== true) SetRadioOn(false) EndIf EndEvent Now I just have to add the rest of the details. Thanks again!
  6. Kitcat, do you know how would I be able to "fully compile" this mod with the scripts if I wanted to share it? I'm also not sure how he was able to move it either. I couldn't. Not in Workshop move, and now with the Z key like he mentioned. I did not create a crafting recipe. My experience is nowhere near that yet. Seems like we're all getting different results from the same file :confused:
  7. 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:
  8. 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.
  9. 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 :-)
  10. 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. :)
  11. 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.
  12. Hi Kitcat, Thanks for taking the time to check it out. Yes, the button is "detached" at the moment - it's still present but I isolated it from the script for troubleshooting. I have the generator running as it normally would until I get the radio thing figured out. It can be turned on / off by activating the generator itself. The fusion core is simply aesthetic. Down the line, I want to experiment with making the generator "consume" fusion cores, so you have to replenish them so often. The script is added to the radio. Double click on it, and then click on the "Edit Base" button. This is where think you as well as BigAndFlabby suggested I attach it. It was originally in the Reference Box, on the Scripts tab. This is the box before you click the "Edit Base" button. The power connection on the ceiling is left over from my first attempt at making the generator power the cell. I decided to go with the PowerRadiation keyword to avoid wires in the cell. As your question regarding snapping, the 5th button in (a finger pointing), and clicking on the Movement tab allows you to modify the Snap "grid" in the render window, so things align. Pressing Q toggles the snap on and off. I prefer to set the snap at 16 for walls and floors, and 4 when decorating. Pressing Shift + Q will allwo you to double-click on a reference point (say a floor piece) to set that as the "home" for the grid. If things are close but won't quite snap, Press Shift + Q, then double click on the floor piece you want to snap to. Then move the other piece and it will snap. Also for decorating, you can press F to make things "drop" to the floor or a counter, so they're not floating above it. Some surfaces will let things fall though, so be cautious of that. Just press CTRL + Z to undo the drop, and move it manually by holding Z (for Z-Axis). Edit: Updated my ESP to address some of the things you pointed out (as well as add tonight's changes). When I test my mod, I have been loading a save that was created before I began developing my mod. This way, I know my save file isn't contaminated.
  13. So... still not working by moving the script to the base... When switched on, my generator does add power to the workshop. With kitkat's script, the radio just sits there and won't turn on when activated. This time I'm posting all the info I can (in the below images). Hopefully you guys can see what I'm missing? Remember, I'm new, so it could be something you'd assume I know. Radio Info: https://www.dropbox.com/s/tjv4s0muiahjatd/RadioInfo.png?dl=0 Generator Info: https://www.dropbox.com/s/xat6hb1adsajq9a/GeneratorInfo.png?dl=0 Oh, and really - thanks for all the help so far! Edit: Here's a link to the current ESP: https://www.dropbox.com/s/3lxifp1pnnz44i8/JMB.esp?dl=0
  14. I'll try moving the script from the reference window for the radio to the edit base window on the radio. I did add a PowerRadiation tag to the generator of 100, so I don't need to add wires (at least for this)
  15. The script is attached to the Reference box, under the Scripts tab. When you double-click the item in the Render Window, and scroll to the last tab. It's the box before you click the Edit Base button (which is the image shared above) Photo below: https://www.dropbox.com/s/i7vhquang5xxcjn/ReferenceBox.png?dl=0 Is this the wrong location to attach the script?
  16. ThoraldGM, your script from 24 February 08:23AM also fails the IsPowered() check...
  17. Hey kitkat81, I tried replace my entire script with what you posted (non-craftable script), and added the WorkshopCanBePowered keyword, and I'm still failing the IsPowered() check when the generator is on. I tried placing a generator in game from the workshop right next to it, and it made no difference. I've attached a photo of the Activator dialog box, in hopes I simply have something set wrong: https://www.dropbox.com/s/uo5dp8vxt57itkn/RadioEditBase.png?dl=0
  18. Yes. I'm building a "bunker" behind the player home in Sanctuary. My premise is that he built this in anticipation of the war. He arrives home to find the place mostly untouched and a small stock of resources. Everything is dormant waiting on him to fire up the backup generator. My goal was to have a script I could attach to multiple items (lights, the small radio, ham radio, tv etc) that would require this generator to be running. Otherwise, just some "emergency lights" would be on. It would be a player home, so I don't intend much to be moved around in workshop mode. A lot of work for this small bit of immersion. But hey, it's a learning experience too!
  19. Thanks ThoraldGM, I had just assumed that the timer would cancel itself when the cell unloads. Thanks for the tip, I will have to add that! Kitkat81, that is a much more straightforward way of doing things, and avoids the timer all together. I was worried about what kind of performance impact a timer would have. I definitely want to take a look at that. I looked around, have you found a source that explains what some of the different keywords mean / how to use them? Creation kit documentation is somewhat lacking, IMO.
  20. I was thinking the OnPowerOn event was fired when an object was turned on. It looks like (based on the above) that event means if the device has power (available)? I was fighting with that for a while! If I read it correctly, your script would still let a radio turn on if there is no generator turned on in the cell. I was looking to make that not possible for immersion reasons. Thanks so much for the input, I like the "Self" reference - much cleaner.
  21. Finally got it it work. I have to use a timer to periodically check if the generator is on, but I'm happy for now. Script posted below if anyone else has this issue. Thanks again BigAndFlabby and deadbeeftffn for getting me started! Scriptname JMBBunkerCheckForPower extends ObjectReference {Checks to see if PowerSource is on before allowing DeviceToPower to turn on} ObjectReference Property DeviceToPower Auto {Device to Turn On / Off} ObjectReference Property CellWorkshop Auto {Link this to the cells Workbench} ; Needed for the “CurrentPowerGeneration” variable to get its value WorkshopParentScript Property WorkshopParent Auto Const {Set this to WorkshopParent} ; Create a Timer that when it expires, runs function IsPowerOn ; This means that there will be a constant check for power in the workshop ; This Timer will re-create itself when function IsPowerOn runs. ; Only doing this until an OnWorkshopRecalculateResources event is found so I can determine if Workshop Power changes to zero. int TimerLength = 10 ; Timer Length in Seconds int TimerIDNumber = 25 ; ID number of the timer ;============================================= ; EVENTS ;============================================= 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. IsPowerOn() EndEvent Event OnTimer (int aiTimerID) ; This Event runs when the timer expires If (aiTimerID==TimerIDNumber) IsPowerOn() EndIf EndEvent Event OnActivate(ObjectReference akActionRef) If (DeviceToPower.IsActivationBlocked()) Debug.MessageBox("Requires Power") EndIf EndEvent ;============================================= ; Function IsPowerOn ;============================================= bool Function IsPowerOn() ; Retrieve the Current Power Output in the Workshop float CurrentPowerGeneration = CellWorkshop.GetValue(WorkshopParent.WorkshopRatings[WorkshopParent.WorkshopRatingPower].resourceValue) If (CurrentPowerGeneration > 1.0) ;There is power present in the settlement. Want at least 1 in case of “trace” power sources DeviceToPower.BlockActivation (false) ;=============================== Requires DeviceToPower.Activate(Game.GetPlayer(), true) to actually turn device on. True Blocks firing of another OnActivate() event ; Debug.MessageBox("Power Is Present. It is: " + CurrentPowerGeneration) StartTimer(TimerLength, TimerIDNumber) Return True Else ; There is NO power present in the settlement DeviceToPower.BlockActivation (true) ; Debug.MessageBox("Power Is Off") If (DeviceToPower.IsRadioOn()) DeviceToPower.Activate(Game.GetPlayer(), true) EndIf StartTimer(TimerLength, TimerIDNumber) Return False EndIf EndFunction
  22. Ok, last time for tonight...  Below is the new version of my script. It's a mashup of everyone's suggestions.  I think it's working better (based on the debug messages). However, the PowerSource.GetValue(PowerGenerated) value never changes. Does this variable only return what the Generator is SET to output, and not what it is CURRENTLY outputting? I can probably change it with SetValue- but I think that would be a script on the Generator. I can't seem to get OnPowerOn, OnPowerOff, or IsPowered to work on the remote call (it never returns a value that changes the state in my script), so that must be for a device and not a generator? Scriptname JMBBunkerCheckForPower extends ObjectReference{Checks to see if PowerSource is on before allowing DeviceToPower to turn on}  ObjectReference Property DeviceToPower Auto {Device to Turn On / Off}  ObjectReference Property PowerSource Auto {The Power Source Device, NOT Enable Marker}  ActorValue Property PowerGenerated Auto Const  Event OnInit() RegisterForRemoteEvent (PowerSource, "OnActivate")  If (PowerSource.GetValue(PowerGenerated) > 0.0) GotoState ("PowerIsOn") Else GotoState ("PowerIsOff") EndIf EndEvent  State PowerIsOff Event OnBeginState(string asOldState) Debug.MessageBox ("Entered PowerIsOff State") Debug.MessageBox ("PowerGenerated is " + PowerSource.GetValue(PowerGenerated)) DeviceToPower.BlockActivation(true) EndEvent  Event OnActivate(ObjectReference akActionRef) Debug.MessageBox ("The Power Source is Off") EndEvent    Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef) Debug.MessageBox ("Entered OnActivate Event") If (PowerSource.GetValue(PowerGenerated) > 0.0) GotoState ("PowerIsOn") EndIf EndEvent EndState  State PowerIsOn Event OnBeginState(string asOldState) Debug.MessageBox ("Entered PowerIsOn State") Debug.MessageBox ("PowerGenerated is " + PowerSource.GetValue(PowerGenerated)) DeviceToPower.BlockActivation(false) EndEvent   Event OnActivate(ObjectReference akActionRef) Debug.MessageBox ("Enjoy Your Device!") EndEvent    Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef) Debug.MessageBox ("Entered OnActivate Event") If (PowerSource.GetValue(PowerGenerated) > 0.0) GotoState ("PowerIsOn") EndIf EndEvent EndState  ; Empty state placeholders may be required for remotes. Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef) EndEvent Edit: One last thought - is there a variable I can check to see how much power the entire workshop is generating? I can use that as my PowerIsOn check, and skip the PowerSource device altogether. If the entire workshop output is over 1 let's say, then I know the generator is on.
  23. Hey Everyone, I have an Enable / Disable marker, which is toggled between Enabled and Disabled by a push button (RedR_ButtonBox). I want to set up a Register for a Remove Event for when that marker is enabled / disabled. What Event fires on that marker when it is Enabled or Disabled? I'm looking for the equivalent of: Event ObjectReference.OnEnable() ; Do stuff when the marker becomes enabled EndEvent Event ObjectReference.OnDisable() ; Do different stuff when marker becomes disabled EndEvent I don't see that event in the Creation Kit documentation. It might be a simple stuipd answer, but I new to Papyrus. Thanks for the input!
×
×
  • Create New...