user scripts

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Dakota
Field Commander
Field Commander
Posts: 991
Joined: Mon Dec 06, 2010 8:21 pm
Projects :: making random weapon assets
Games I'm Playing :: SWBF2 and more
xbox live or psn: PS3 beats xbox
Location: at a computer desk floating around in space

user scripts

Post by Dakota »

ok i have been trying to make a custom user script for the past week but i can't get it to work (or even munge fully) how would i make one i am working with the one in the example thing for the 1.3 patch. i read both of the documents about it and still have no idea how to use or make one. i want it for my dedicated server for cp locking.
here is my moddification so far of the user_script_1
Hidden/Spoiler:
print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
print("user_script_1: Taking control of ScriptPostLoad()...")

--check for possible loading errors
if us1_ScriptPostLoad then
print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
print("user_script_1: Exited")
return
end

--backup the current ScriptPostLoad function
us1_ScriptPostLoad = ScriptPostLoad

--this is our new ScriptPostLoad function
ScriptPostLoad = function()
print("user_script_1: ScriptPostLoad(): Entered")

--only do these changes when in SP
ScriptCB_GetAmHost()
ScriptCB_InMultiplayer()
ff_rebuildFakeConsoleList()

end

--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
us1_ScriptPostLoad()
print("user_script_1: ScriptPostLoad(): Exited")
end

print("user_script_1: Have control of ScriptPostLoad()")
else
print("user_script_1: Warning: No ScriptPostLoad() to take over")
print("user_script_1: Exited")
return
end

print("user_script_1: Exited")
plase help me (wow maybe i should have added an extra please...)

[munge log]
Hidden/Spoiler:
C:\BF2_ModTools\ToolsFL\Bin\luac.exe: ..\..\shell\scripts\user_script_1.lua:33: <eof> expected near `else'
ERROR[scriptmunge scripts\user_script_1.lua]:Could not read input file.ERROR[scriptmunge scripts\user_script_1.lua]:Could not read input file. [continuing]
2 Errors 0 Warnings

ERROR[levelpack shell.req]:Expecting bracket, but none was found.
File : munged\pc\user_script_1.script.req(1)...

ucft <--
ERROR[levelpack shell.req]:Expecting bracket, but none was found.
File : munged\pc\user_script_1.script.req(1)...

ucft <--

2 Errors 0 Warnings
i just checked the all you need to know thread i didn't find anything...

does anyone know...
501st_commander
Master Bounty Hunter
Master Bounty Hunter
Posts: 1570
Joined: Wed Dec 10, 2008 7:48 pm

Re: user scripts

Post by 501st_commander »

Code: Select all

print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
	print("user_script_1: Taking control of ScriptPostLoad()...")

	--check for possible loading errors
	if us1_ScriptPostLoad then
		print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
		print("user_script_1: Exited")
		return
	end

	--backup the current ScriptPostLoad function
	us1_ScriptPostLoad = ScriptPostLoad

	--this is our new ScriptPostLoad function
	ScriptPostLoad = function()
		print("user_script_1: ScriptPostLoad(): Entered")

		--only do these changes when in SP
		ScriptCB_GetAmHost()
		ScriptCB_InMultiplayer()
		ff_rebuildFakeConsoleList()

	end

	--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
	us1_ScriptPostLoad()
	print("user_script_1: ScriptPostLoad(): Exited")
end <------Why?--------------------------------------------------------------------------

	print("user_script_1: Have control of ScriptPostLoad()")
else <---- because, this else doesnt have a parent if-----------------------------------------
	print("user_script_1: Warning: No ScriptPostLoad() to take over")
	print("user_script_1: Exited")
	return
end

print("user_script_1: Exited")


User avatar
Dakota
Field Commander
Field Commander
Posts: 991
Joined: Mon Dec 06, 2010 8:21 pm
Projects :: making random weapon assets
Games I'm Playing :: SWBF2 and more
xbox live or psn: PS3 beats xbox
Location: at a computer desk floating around in space

Re: user scripts

Post by Dakota »

i'll test and munge right now. THANK YOU SO MUCH i have had this topic out about a month, it is good to get a reply :D :D :D
Hidden/Spoiler:
oh wait that wasn't the fixed thing it is one telling me how to fix. well still thanks for helping and replying i will get to fixing
Last edited by Dakota on Sun Feb 20, 2011 9:03 pm, edited 1 time in total.
501st_commander
Master Bounty Hunter
Master Bounty Hunter
Posts: 1570
Joined: Wed Dec 10, 2008 7:48 pm

Re: user scripts

Post by 501st_commander »

Your welcome.

Next time, look the code and use common logic :D

i need to get my luaeditor done......
User avatar
Dakota
Field Commander
Field Commander
Posts: 991
Joined: Mon Dec 06, 2010 8:21 pm
Projects :: making random weapon assets
Games I'm Playing :: SWBF2 and more
xbox live or psn: PS3 beats xbox
Location: at a computer desk floating around in space

Re: user scripts

Post by Dakota »

501st_commander wrote:Your welcome.

Next time, look the code and use common logic :D

i need to get my luaeditor done......
(i never tryed making one of these before and got no clue how...)
well time to test

(i hope that lua editor you are making gets finished soon and is susscessfull i really need it...)


EDIT: ok new problem the script still won't work (i probably did something wrong i need an example of what the script should look like)

here is my munge log and script

munge log
Hidden/Spoiler:
ERROR[levelpack shell.req]:Could not open ..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
ERROR[levelpack shell.req]:Could not open ..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
[continuing]
2 Errors 0 Warnings

ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
[continuing]
2 Errors 0 Warnings

ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
ERROR[levelpack MOD.req]:Could not open ..\..\common\munged\pc\core.files for input. DOS reports:
No such file or directory
[continuing]
2 Errors 0 Warnings
Script
Hidden/Spoiler:
print("user_script_1: Entered")

--attempt to take control of (or listen to the calls of) the ScriptPostLoad function
if ScriptPostLoad then
print("user_script_1: Taking control of ScriptPostLoad()...")

--check for possible loading errors
if us1_ScriptPostLoad then
print("user_script_1: Warning: Someone else is using our us1_ScriptPostLoad variable!")
print("user_script_1: Exited")
return
end

--backup the current ScriptPostLoad function
us1_ScriptPostLoad = ScriptPostLoad

--this is our new ScriptPostLoad function
ScriptPostLoad = function()
print("user_script_1: ScriptPostLoad(): Entered")

--only do these changes when in SP
ScriptCB_GetAmHost()
ScriptCB_InMultiplayer()
ff_rebuildFakeConsoleList()

end

--make sure to forward the method call to the real ScriptPostLoad, so the game can function normally
us1_ScriptPostLoad()
print("user_script_1: ScriptPostLoad(): Exited")

print("user_script_1: Have control of ScriptPostLoad()")
print("user_script_1: Warning: No ScriptPostLoad() to take over")
print("user_script_1: Exited")
return
end

print("user_script_1: Exited")
(once again i think i need a step by step tutorial, i am good at odfs but i fail horribly in scripting)

can someone please help its been awhile...

been about a month, i know, but i still really need some help with this.


Last bumped by Dakota on Sun Mar 13, 2011 10:15 pm.
Post Reply