Page 1 of 1

User Script(s) not loading [Solved]

Posted: Sat Oct 17, 2015 7:36 am
by DeltaTimo
Hey,

I'm quite new to modding Star Wars Battlefront 2 and I'm looking for a way to disable the point limits for all classes. I've already removed the limits for the default classes, but obviously, for any other mod class they are still present.
Now I thought I could remove them with user scripts but I can't get them to work.
I have
  • picked a user script slot, in this case "11" as there is already "user_script_10.lvl".
  • created the folder "data_USR\Shell".
  • a textfile "shell.req" in "data_USR\Shell":

    Code: Select all

    ucft
    {
        REQN
        {
            "script"
            "user_script_11"
        }
    }
  • a scriptfile "user_script_11.lua" in "data_USR\Shell\scripts":

    Code: Select all

    print("user_script_11: Entered")
    
    --attempt to take control of (or listen to the calls of) the ScriptPostLoad function
    if ScriptPostLoad then
    	print("user_script_11: Taking control of ScriptPostLoad()...")
    	
    	--check for possible loading errors
    	if us11_ScriptPostLoad then
    		print("user_script_11: Warning: Someone else is using our us1_ScriptPostLoad variable!")
    		print("user_script_11: Exited")
    		return
    	end
    	
    	--backup the current ScriptPostLoad function
    	us11_ScriptPostLoad = ScriptPostLoad
    
    	--this is our new ScriptPostLoad function
    	ScriptPostLoad = function()
    	    print("user_script_11: ScriptPostLoad(): Entered")
    	    
    	    --only do these changes when in SP
    	    --if we wanted them done in MP too, we should check to make sure that we are the server's host: ScriptCB_GetAmHost()
    	    if not ScriptCB_InMultiplayer() then
    		    --build the FakeConsole list
    			ff_rebuildFakeConsoleList()
    		    
    		    ff_DoCommand( "Remove Point Limits" ) --gain lots os points for little work
    		    ff_DoCommand( "Remove Award Effects" )	--no more graphical hues or annoying sounds when you get awards
    			
    			--clear the FakeConsole table to save memory
    			gConsoleCmdList = {}
    		end
    
    	    --make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
    	    us11_ScriptPostLoad()
    	    print("user_script_11: ScriptPostLoad(): Exited")
    	end
    	
    	print("user_script_11: Have control of ScriptPostLoad()")
    else
    	print("user_script_11: Warning: No ScriptPostLoad() to take over")
    	print("user_script_11: Exited")
    	return
    end
    
    print("user_script_11: Exited")
  • munged my level once because it could not find "Common\MUNGED\core.files" if I had not.
  • munged my level with only "Shell" selected.
  • renamed "data_USR\_LVL_PC\shell.lvl" to "user_script_11.lvl" and copied it into my "Star Wars Battlefront II\GameData\DATA\_LVL_PC" folder.
But nothing happens ingame. I tried adding jetpacks in user_script_11.lua but that didn't work either.
In the How-To Docs it is said I could check the "debug output". If I understand that correctly, it is referring to "BF2_modtools.exe" but since I am using the Steam-Version of the game I do not have a disk.

Thanks in advance,
Timo.

Re: User Script(s) not loading

Posted: Sat Oct 17, 2015 10:29 am
by Anakin
Wow a very detailed problem description from a new member. :thumbs:

So you already found the best way to debug your script. The debug output :mrgreen:
Since you are using the DVD/Digital Version, take the BF2_modtools.exe from the FAQ question 4. Or klick here: https://dl.dropboxusercontent.com/u/384 ... _NoDVD.exe


And welcome to GT.

Re: User Script(s) not loading

Posted: Sat Oct 17, 2015 11:50 am
by DeltaTimo
Thank you!
I found out it is not loaded at all and not even user_script_10.lvl was loaded.
So I decided to do a fresh reinstall of the patch and now it works like a charm! There wasn't even anything wrong with the user script itself.