Loading additional ingame.lvl through custom user script

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
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Loading additional ingame.lvl through custom user script

Post by DarthD.U.C.K. »

i want to replace some common models and effect through a new ingame.lvl. because i dont have the sourcefiles for the 1.2/1.3 ingame.lvl their updates dont affect the game anymore and the 1.2 weapons have no proper hudicons anymore if i replace the main ingame.lvl. therefore i tried making a custom user script that loads "ingame_2.lvl" with all the modified files whenever a map is loaded. however it doesnt seem to work.
heres my shell.req:
Hidden/Spoiler:
ucft
{

REQN
{
"script"
"user_script_11"
}
}
my user_script_11.lua:
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
--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
ReadDataFile("ingame_2.lvl")
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")
after munging, i rename the shel.lvl to "user_script_11.lvl" and put it into battlefronts lvl_pc folder and of course copy the "ingame_2.lvl" in too.

do i have some fault in the code or is it simply not possible to replace content from the ingame.lvl through an userscript?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: loading additional ingame.lvl through custom user script

Post by [RDH]Zerted »

What's your debug output?
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: loading additional ingame.lvl through custom user script

Post by DarthD.U.C.K. »

-previous content removed-
-and again-

for some reason battlefront now load the custom ingame.lvl without any problems and loads all the included files, but they dont replace anything. how can that be when a custom userscript should act as if it was the maps scriptpostload??
Post Reply