Jump to content

Custom Recruitment Radio Beacon (scripting help)


pepperman35

Recommended Posts

 

The relay towers retract on their own, after some time.

That was always annoying. Is that a result of cell reset or any other reason? They are persistent and do not seem to do it on themselves by OnLoad/Unload. Maybe, placing into NoReset zone, can prevent this?

Edited by hereami
Link to comment
Share on other sites

I've improved the script a bit:

Scriptname RTRB_ControlScript extends ObjectReference

; custom scripting by niston for pepperman35

; public interface - properties

ObjectReference Property RecruitmentBeacon Auto Const
{ Pick Custom Recruitment Beacon reference in Render Window }

; public interface - event handlers

Event OnInit()
	; call setup procedure from OnInit event
	Debug.Trace(self + " - OnInit()")
	Setup()
EndEvent

Event OnLoad()
	; call setup procedure from OnLoad event
	Debug.Trace(self + " - OnLoad()")
	Setup()
EndEvent

Event Actor.OnPlayerLoadGame(Actor akSender)
	; call setup procedure from OnPlayerLoadGame event (OnLoad will not fire for the first cell the player loads into)
	Setup()
EndEvent

Event OnAnimationEvent(ObjectReference akSource, String eventName)
	; animation event received
	Debug.Trace(self + " - Animation Event received")
	; update beacon according to current state
	UpdateBeacon()
EndEvent

; public interface - functions

Function UnregisterAll()
	UnRegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
	UnRegisterForAnimationEvent(self, "done")	
EndFunction

; private functions (there are no private functions in Papyrus, but these below are not meant to be called from outside this script)

Function Setup()
	; (re-)register Player.OnGameLoad event
	UnRegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")
	RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame")		
	; (re-)register animation event, make sure we dont stack up registrations
	UnRegisterForAnimationEvent(self, "done")
	If (RegisterForAnimationEvent(self, "done"))
		Debug.Trace(self + " - Animation Event registered succcessfully")
	Else
		Debug.Trace(self + " - Failed to register Animation Event")
	EndIf
	; update beacon according to current state
	UpdateBeacon()
EndFunction

Function UpdateBeacon()
	; enables/disables the RecruitmentBeacon, depending on wether the radio tower is extended or retracted
	String curState = ((Self as ObjectReference) as RelayTowerScript).GetState()
	If (curState == "DownPosition" || curState == "MovingDown")
		; tower is retracted, disable beacon
		Debug.Trace(self + " - Tower retracted; Disabling beacon...")
		RecruitmentBeacon.Disable()
	ElseIf ((curState == "UpPosition") || (curState == "MovingUp"))
		; tower is extended, enable beacon
		Debug.Trace(self + " - Tower extended; Enabling beacon...")
		RecruitmentBeacon.Enable()
	EndIf
EndFunction

It has a little optimization, uses Debug.Trace instead of Debug.Notification and listens to OnPlayerLoadGame event as well. I've also added UnregisterAll() function, in case you want to make an uninstall chem or whatever for your mod; Call this function to clear up event registrations on the RTRB_ControlScript.

Link to comment
Share on other sites

That was always annoying. Is that a result of cell reset or any other reason? They are persistent and do not seem to do it on themselves by OnLoad/Unload. Maybe, placing into NoReset zone, can prevent this?

 

I wonder about this myself, but didn't check any further on why. Please do report back if you find out.

 

There's another thing in the RelayTowerScript, which I don't understand: How does MoveTower() get called? There's no statement inside the script that calls this function anywhere, so I suppose the call must be external. But whrere from? No idea! Ah, likely MoveTower() is called from the Terminal.

Link to comment
Share on other sites

Okay, my success rate in implementing your script is not good. For situational awareness, here is what I have done.


  1. Duplicated RelayTowerPublic and renamed it Peps_NWCPCommsTower
  2. Added Keywords to the tower: WorkshopPowerConnectionDUPLICATE000, WorkshopRadioObject, WorkshopStartPoweredOn, and WorkshopSwitchActivatorKeyword
  3. Added Actor values to the tower: powerradiation (1500), workshop rating radio (1), and workshopresourceobject (1)
  4. Peps_NWCPCommsTower has the RelayTowerScript
  5. Added a default terminal and set it up exactly like RelayTowerTerminal
  6. Hopped in game and tested it…Satellite antenna raise and lower via the terminal commands
  7. Back in CK…Complied the revised script written by niston; added custom script to the tower
  8. Tried to pick Custom Recruitment Beacon reference in Render Window and was unable to do it via the visual crosshair gizmo. The crosshair was red in color and wouldn’t select the tower. Manually completed the fields for the RecruitmentBeacon property.
  9. Hopped in game to test…Comms tower is invisible. When executing terminal command to Extend Satellites, the terminal ties to execute but hangs up with no way to recover or move forward. Tower remains invisible.


I tried fast traveling away and then back, hoping that it might reset something but game crashes on fast traveling to the Nuka world settlement. However, able to return via foot. Unfortunately, no change in status.


I’m sure it is operator error on my end, and haven’t implement things properly. Any suggestion for corrective action would be welcomed and appreciated.
Link to comment
Share on other sites

Why did you duplicate the relay tower? :smile: I suppose you wanted to duplicate the workshop recruitment beacon instead?

 

Just be sure, is this for a settlement of yours? Do you want to use the existing relay tower at the location you indicated (relaytower01ext) to control a recruitment beacon, or do you want to make a buildable (workshop mode) relay tower that acts as a recruitment beacon or something suchlike?

 

My bird's view assumption was that you were to create a settlement at said existing relay tower and wanted to use that very same, already existent relay tower to double as the settlement's recruitment beacon.

 

If my assumption is correct, please confirm as I can then outline exactly the steps you need to take to achieve your goal. If not, please give me an updated bird's eye view on your project so that I may try and suggest a suitable solution.

Link to comment
Share on other sites

1. I am working on a settlement mod for Nuka World Red Rocket settlement. Essentially, it is based on the blueprint I posted up some time ago. https://www.nexusmods.com/fallout4/mods/39377

 

2. I want to use the RelayTowerPublic to double as s recruitment beacon for that settlement, built into the mod and controllable by a terminal. I'd like for the beacon to begin broadcasting once the satellites antennas deploy and stop broadcasting when they retract. In other words, after the player claims the Nuka World Red Rocket settlement, he/she can activate the beacon via a terminal that will reside in the communications building. No workshop building of a beacon required.

 

Makes sense?

Link to comment
Share on other sites

Alright. This is very similar to what I did in Forest Grove Water Lock. Really should publish that update some day.... But I digress. Here we go:

 

 

1) Prepare custom Recruitment Beacon

 

1.1) Create a duplicate of the Workshop Recruitment Beacon

1.2) Give the duplicate a new Editor ID, something like Peps_RecruitmentBeaconNWRR will work

1.3) You can give the object a name like "Recruitment Beacon - NW Red Rocket"; It'll show up exactly like that in the PipBoy later on

1.4) Make sure the keywords go like this:

- WorkshopRadioObject

- WorkshopCanBePowered

- WorkshopStartPoweredOn

- WorkshopItemKeyword

- UnscrappableObject

- BlockPlayerActivation

 

Note that you don't need WorkshopPowerConnectionDUPLICATE000 or the WorkshopSwitchActivatorKeyword: You're not going to wire this beacon and it won't have a switch. Thus, remove all keywords not shown in the above list.

 

1.5.) Attach my custom activator script (posted earlier) to the beacon. There are no properties to configure on that one.

1.6.) Give the beacon object a bunch of Actor Values:

- PowerGenerated 1.0

- PowerRequired 1.0

- WorkshopRatingRadio 1.0

- WorkshopResourceObject 1.0

 

Remove all AVs not shown in the list above (if any).

 

1.7.) Give the object a new NIF. I used SetDressing\Greebs\Greebles09.nif for my testing. You can later change this to invisible.NIF or whatever.

1.8.) Make sure that workshopobjectscript is attached to the custom beacon and that it's WorkshopParent property is set to WorkshopParent (QUEST 0x2058E)

 

You now have a self-powered, customized recruitment beacon, requiring no wires and looking like a vault-tec something. This custom beacon will automatically start recruiting people to the local workshop, whenever it exists. You can use .Enable() on it to turn it on and .Disable() to make it go away. The RTRB_ControlScript does just that.

 

 

 

2) Set up your relay tower

 

2.1.) Duplicate existing one and give new Editor ID. Peps_NWCPRelayTower would be fine.

2.2.) Do not add funky keywords to the relay tower, don't give it power radiation or some such.

2.3.) Make sure the relaytowerscript is attached to it

2.4.) You can configure a bunch of radios for the tower to repeat (amplify) on the RelayTowerScript - But I have not looked into any of this, so can't give any guidance.

2.5.) Put the Peps_NWCPRelayTower reference at Nukaworld Red Rocket

2.6.) Create the relay tower terminal and link (LinkedRef) from the the relay tower reference to it, with Keyword LinkCustom01

2.7.) RefLink from the Terminal reference back to the relay tower reference without a keyword

2.8.) Attach the revised RTRB_ControlScript to the relay tower reference

 

 

You have placed the relay tower with it's controling terminal and set it up for "normal" operation - possibly except everything to make it actually relay some radios. The tower already has the RTRB_ControlScript on it, which will later control the custom beacon you made, in accordance with the relay tower's status (extended/retracted). So it is time to place that custom recrutiment beacon.

 

 

 

3) Place the custom recruitment beacon

 

3.1.) Put the Peps_RecruitmentBeaconNWRR reference somewhere near the relay tower.

3.2.) Set the beacon reference to initially disabled.

3.3.) On the RTRB_ControlScript, fill out the RecruitmentBeacon property: Select from render window, pick the recruitment beacon, not the relay tower.

 

After the beacon has been placed and set to initially disabled, the RTRB -short for RelayTowerRecruitmentBeacon, of course- script was configured to perform it's enable/disable magic on the actual beacon reference. You should now be set.

 

 

 

4) Test in game

 

4.1.) When you extend the tower, the beacon should spawn into existence (getting enabled) and the radio signal is detected in pipboy immediately

4.2.) When you retract the tower, beacon despawns (disabled) and the radio signal vanishes.

4.3.) If everything works to your satisfaction, you may replace the greeble NIF with invisible NIF, so the beacon itself will not be visible to Player

 

You might perhaps also want to add some functionality that prevents interaction with the tower's terminal, until power to NW is restored. And while at that, you could place a power outlet (connector) at the NW RR and have it output some power when the NW power plant has been restored - It always irked me a bit that there is a power plant around, but then you still need to setup generators and such :smile:

 

 

Disclaimer;: It's entirely possible I missed something. Let me know how it works out!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...