Jump to content

User Scripts not Working


daisy8

Recommended Posts

Hi everyone

 

I have found that user scripts on activators are not working in my game. Scripts from the original game work fine.

 

I tried to make a light switch in the creation kit for a mod I am making but it didn't work in the game. I posted a topic in the mod troubleshooting forum and another member sent me an esp file with some custom light switches that worked on his game but they still didn't work on mine. I re installed the creation kit and the game, deleted all the mods I was running including save games and still his working mod didn't work on my game.

 

The file path to the user scripts in the creation is correct.

 

Any ideas ??

 

Thanks

daisy

Link to comment
Share on other sites

The simplest possibility is that you have a runtime error in your user script, or something's bad in your activator's property settings. Check the properties first.

 

I've found in more complex scripts that runtime errors are the most frustrating, because your script will just silently die. A basic light switch script shouldn't be that complicated, though. Check for undefined properties and, if everything's fine there, post the script here and let's see what your activator's bombing on.

Link to comment
Share on other sites

Hey Greslin

 

I don't think its anything to do the actual script. It compiles fine and it has worked for others, just not me !!

 

This is it below. The switch (red button one) is link ref'd to an enable marker with the correct keyword and the marker is an enable parent for some lights.

Scriptname calEnableDisableScript extends ObjectReference Hidden Const

Keyword Property EnablerRef Auto Const Mandatory

Event OnLoad()
	Self.SetNoFavorAllowed()
EndEvent

Event OnActivate(ObjectReference akActionRef)
	if (Game.GetPlayer() == akActionRef)
		ObjectReference TmpRef = GetLinkedRef(EnablerRef)
		if (TmpRef.IsDisabled() == true)
			TmpRef.Enable()
		else
			TmpRef.Disable()
		EndIf
	endif
EndEvent	
Link to comment
Share on other sites

Make sure you have filled the property..Another thing:

 

the line in your script.

if (Game.GetPlayer() == akActionRef)

I`d change it to

If akActionRef == Game.GetPlayer() 

From the human point of view there is no difference, but it seems that the game can dislike such things sometimes. ..I`m not sure that it always matters, but I have once a problem related to the order in the similar line.

Edited by kitcat81
Link to comment
Share on other sites

Maybe you forgot to set linked ref? There was some bug related to lights and disable/enable functions.

You can add debug.notification or debug.trace blocks to the script to check if some function fails . And you can try to create a script based on the working script or to spawn lights/delete lights.

To check where it fails:

Event OnActivate(ObjectReference akActionRef)
    If  akActionRef == Game.GetPlayer()
    Debug.Notification("Activated by player")
        ObjectReference TmpRef = GetLinkedRef(EnablerRef)
        If TmpRef
             Debug.Notification("Found linked ref")
               if  TmpRef.IsDisabled() == true
                    Debug.Notification("Tmpref is disabled")
                     TmpRef.Enable()
                    Debug.Notification("Light on")  
                   else
                     Debug.Notification("Tmpref is enabled") 
                     TmpRef.Disable()
                     Debug.Notification("Light off") 
               EndIf
           EndIf
       Endif
EndEvent    

I`d just create a new script by copypasting the script text.

Edited by kitcat81
Link to comment
Share on other sites

Hi kitcat

 

The problem is solved ! Just needed to amend the custom.ini file to make the game load custom files. With this:

 

[Archive]
bInvalidateOlderFiles=1
sResourceDataDirsFinal=

 

I added some lines to the script so it replaced a light fitting thats off with one thats on when the lights come on. Working script now looks like this:

Scriptname ADZLightSwitchSwapFixture01 extends ObjectReference

Keyword Property EnablerRefBulbs Auto Const Mandatory
Keyword Property EnablerRefFixture Auto Const Mandatory

Event OnActivate(ObjectReference akActionRef)
	if (Game.GetPlayer() == akActionRef)
		ObjectReference TmpRef = GetLinkedRef(EnablerRefBulbs)
		if (TmpRef.IsDisabled() == true)
			TmpRef.Enable()
		else
			TmpRef.Disable()
		EndIf
	endif

	if (Game.GetPlayer() == akActionRef)
		ObjectReference TmpRef = GetLinkedRef(EnablerRefFixture)
		if (TmpRef.IsDisabled() == true)
			TmpRef.Enable()
		else
			TmpRef.Disable()
		EndIf
	endif


EndEvent

Thanks again !

daisy

Link to comment
Share on other sites

  • 1 year later...

I'm having the same issue where user scripts won't load. From this post, I've tried creating a "Fallout4Custom.ini" file with the:

 

[Archive]

bInvalidateOlderFiles=1
sResourceDataDirsFinal=

 

This did not fix my issue though. Nothing else in the configuration settings has been changed, and I have Bethesda.net Launcher downloaded.

Does anyone know what could cause my Fallout 4 not to read my scripts?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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