Page 1 of 1

loading custom ground textures via sides problems

Posted: Mon May 04, 2009 10:13 am
by YaNkFaN
So I've tried to implement random ground textures through custom sides in order to allow for night and day maps. It has been successful and it has not. Here's what I've done I'm at school now so I don't have any files on me I will post them tonight. Here's what i've done see if there is any error.

I made a custom side in data_abc/sides and put a folder named "textures" with all my ground textures in it
I also made a .req folder with a day.req. In the day .req i put this
uctf
{
REQN
{
"texture"
"name of textures"
}
}
Then in the sidename.req I put this
uctf
{
REQN
{
"lvl"
"day"
}
}
I also put a clean.bat and munge.bat in the side folder
Munging the side I got a day.lvl in the right folder.
^this part so far i think is right
Now in my .lua under where I called for the customsky.lvl I also called for the customside so that each one contains 2 ReadDataFiles
I then deleted all the textures from the world 1 folder and copied the day.lvl to it's respective addon directory
There are also no errors in the bf2 error log or munge log

When I play the game there is no terrain ie no texture to terrain and when i turn or move the game crashes.

EDIT
Here's .lua
Hidden/Spoiler:
[code]--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()
WeatherMode = math.random(1,4)
weather()

--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
cp6 = CommandPost:New{name = "cp6"}
cp7 = CommandPost:New{name = "cp7"}




--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp7)
conquest:Start()



end
function weather()
if WeatherMode == 1 then
ReadDataFile("dc:FR3\\sky.lvl", "sun")
ReadDataFile("dc:SIDE\\day.lvl")
elseif WeatherMode == 2 then
ReadDataFile("dc:FR3\\sky.lvl", "set")
ReadDataFile("dc:SIDE\\day.lvl")
elseif WeatherMode == 3 then
ReadDataFile("dc:FR3\\sky.lvl", "rain")
ReadDataFile("dc:SIDE\\day.lvl")
elseif WeatherMode == 4 then
ReadDataFile("dc:FR3\\sky.lvl", "nite")
ReadDataFile("dc:SIDE\\nite.lvl")
end
end
[/code]
This is in script post load obviously script init is the next line

Re: loading custom ground textures via sides problems

Posted: Mon May 04, 2009 10:24 am
by Maveritchell
Ah, that's your problem. First of all, it's not "textures," it's "texture." And you'll want to load your textures directly in the side.req (remember, always look at stock assets for your cues on doing things).

Re: loading custom ground textures via sides problems

Posted: Mon May 04, 2009 6:02 pm
by YaNkFaN
woops "textures" was a typo in the thread it says "texture" in the .req and about calling them in the side name.req I'm getting a .lvl file called day.lvl and that is the one I am calling in my .lua is there something wrong with that .lvl possibly or is it just more conventional to call the textures from the sidename.req also I think the side is set up correctly due to the existence of a .lvl which is about 5mb or 12 .tgas. I personally think it's a problem with the game reading the .lua since there is no terrain texture in game but the game does load

EDIT
I attached .lua to first post