SWBFGamers

Modding for the Original SWBF1 and SWBF2 => SWBF1 Modding => Topic started by: Miraak49 on March 19, 2024, 01:01:54 PM

Title: Terrain Issue on Hoth
Post by: Miraak49 on March 19, 2024, 01:01:54 PM
Hey so i am basicaly new to modding this game, but i have already explored around alot and managed to do alot of editing just fine

So i wanted to add CW era to the Hoth map, originally i wanted to directly include that in the base map, but i couldn't get sound working for CW and the menu would not be able to load the CW version (i edited missionlist.lua from shell.lvl with the builder but when trying to start the CW version of hoth i would just get a black screen) so i decided to do it with the AddOn system instead.

So i took the stock map from the BFBuilder assets, applied my side lua scripts, even managed to get CW era sounds working there
Then i edited the map with ZeroEditor (also tried the fixed/HD version) to replace the vehicles (like replacing ATAT with MTT by editing the spawn point) and it worked fine too
But for some reasons the terrain got screwed in some places (some parts are missing)

battlefront 2024-03-19 20-58-52-07.pngbattlefront 2024-03-19 20-58-57-98.pngbattlefront 2024-03-19 20-59-32-77.png

This only seems to appear around the trenches, rest of the map is fine

what can i do to fix/avoid that issue ? (i noticed that after saving the map, the wld file size was reduced to 69kb from 72kb and that the hoth.tga was replaced by a lower res variant, don't know if it's normal)
Title: Re: Terrain Issue on Hoth
Post by: {AR}MetalKiller on March 19, 2024, 01:37:34 PM
These "holes" in the ground can occur around terrain cutters.
However, If you used the stock map this shouldn't happen (if you didn't change anything on the terrain).

Terrain cutters are the purple boxes around certain objects.
As the name says they cut the terrain for you to create tunnel entrances or in this case a ditch.
ze.png

If the terrain level is not inside the purple boxes those "hole" effects may appear.
A trick is to cover the object that has the terrain cutter.
One drawback of ZE is that it's not a WYSIWYG Editor, meaning the Rendering ingame might be different (especially terrain levels).
Title: Re: Terrain Issue on Hoth
Post by: Red04SWBF on March 19, 2024, 04:03:07 PM
Make sure you open the map in ZeroEditor and save it. If you munge it directly it won't take effect (at least that's how it worked well for me when editing the maps).
Title: Re: Terrain Issue on Hoth
Post by: Miraak49 on March 19, 2024, 05:12:55 PM
Well thats strange as i didn't modified those or the terrain at all, anyway since i was not sure yet about how to cover it as you suggested
i thought that maybe my source files were bad so i tried and edited the .wld file directly in a text editor (to add the vehicles) and it worked perfectly fine, no terrain issue
So the issue does arrise only when i try to save the map in ZeroEditor for some reasons even if i don't touch terrain at all...  :(

Btw i have 2 other minor "issues" maybe u can help me
do you know how can i add a loading screen animation to the map ?
the first time i start my map the voice announcer will not play (when capturing/loosing CP, announcing the hero is on the battlefied) but if i press escape and restart mission then it will work just fine (this is the case for every eras)

Title: Re: Terrain Issue on Hoth
Post by: {AR}MetalKiller on March 20, 2024, 01:18:16 AM
You might want to try out the search functionality of this forum  ;)

Here a discussion about custom loading screens: https://www.swbfgamers.com/index.php?topic=13131.msg119776#msg119776 (https://www.swbfgamers.com/index.php?topic=13131.msg119776#msg119776)

Quote from: Miraak49 on March 19, 2024, 05:12:55 PMthe first time i start my map the voice announcer will not play (when capturing/loosing CP, announcing the hero is on the battlefied) but if i press escape and restart mission then it will work just fine (this is the case for every eras)
Are you using custom sound files?
In that case it would be helpful if you could share your scripts.
I believe that sound files have to be loaded at a certain place before using them.
Title: Re: Terrain Issue on Hoth
Post by: Miraak49 on March 20, 2024, 07:55:37 AM
Hey again
Searching helped me alot for previous issues but i had not found that one, ill take a look at it but it seems to concern BF2
I am not trying to implement a completly new loading screen/animation, just trying to using/linking to the vanilla/stock hoth loading animation

i am using custom sound files ye, here is my script

---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is cREPed from C to start the mission.
---------------------------------------------------------------------------

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

    SetAttackingTeam(ATT);

        AddMissionObjective(CIS, "orange", "level.hoth.objectives.1");
    AddMissionObjective(CIS, "red", "level.hoth.objectives.2");
--  AddMissionObjective(CIS, "red", "level.hoth.objectives.3");
    AddMissionObjective(REP, "orange", "level.hoth.objectives.1");
    AddMissionObjective(REP, "red", "level.hoth.objectives.3");
    AddMissionObjective(REP, "red", "level.hoth.objectives.4");

    SetTeamAggressiveness(REP, 1.0)
    SetTeamAggressiveness(CIS, 1.0)

    SetMaxFlyHeight(70)
    SetMaxPlayerFlyHeight(70)
   
--    ReadDataFile("sound\\hot.lvl;hot1gcw");
    ReadDataFile("dc:sound\\hot.lvl;hot1cw");
    ReadDataFile("SIDE\\rep.lvl",
        "rep_hover_speederbike",
        "rep_inf_basic",
        "rep_fly_jedifighter",
        "rep_inf_macewindu",         
        "rep_inf_jet_trooper")
    ReadDataFile("SIDE\\cis.lvl",
        "cis_inf_basic",
        "cis_inf_countdooku",       
        "cis_inf_droideka",
        "cis_hover_mtt",
        "cis_hover_aat")
    ReadDataFile("SIDE\\imp.lvl",
        "imp_droid_probe")


--  Republic Stats
    SetTeamName(REP, "Republic");
    SetTeamIcon(REP, "rep_icon");
    AddUnitClass(REP, "rep_inf_clone_trooper",14)
    AddUnitClass(REP, "rep_inf_arc_trooper",3)
    AddUnitClass(REP, "rep_inf_clone_pilot",4)
    AddUnitClass(REP, "rep_inf_clone_sharpshooter",4)
    AddUnitClass(REP, "rep_inf_jet_trooper",3)
    SetHeroClass(REP, "rep_inf_macewindu")

--  CIS Stats
    SetTeamName(CIS, "CIS");
    SetTeamIcon(CIS, "cis_icon");
    AddUnitClass(CIS, "cis_inf_battledroid",14)
    AddUnitClass(CIS, "cis_inf_assault",3)
    AddUnitClass(CIS, "cis_inf_pilotdroid",4)
    AddUnitClass(CIS, "cis_inf_assassindroid",4)
    AddUnitClass(CIS, "cis_inf_droideka",3)
    SetHeroClass(CIS, "cis_inf_countdooku")

--  Level Stats
    ClearWalkers()
    AddWalkerType(0, 16) -- 0 droidekas
    SetMemoryPoolSize("CommandHover", 2)
    SetMemoryPoolSize("EntityFlyer", 4)
    SetMemoryPoolSize("EntityHover", 12)
    SetMemoryPoolSize("MountedTurret", 48)
    SetMemoryPoolSize("PowerupItem", 60)
    SetMemoryPoolSize("EntityMine", 40)
    SetMemoryPoolSize("OrdnanceTowCable", 8) -- need extra for wrapped/fREPen cables
    SetMemoryPoolSize("EntityLight", 120)

    ReadDataFile("dc:HOT\\hot.lvl")
    SetSpawnDelay(10.0, 0.25)
    SetDenseEnvironment("false")
    SetDefenderSnipeRange(170)
    AddDeathRegion("Death");

--  Local Stats
    SetTeamName(3, "Local")
    AddUnitClass(3, "imp_droid_probe", 4);
    SetUnitCount(3, 4)
    SetTeamAsEnemy(3,DEF)
    SetTeamAsFriend(3,ATT)

--  Attacker Stats
    SetUnitCount(ATT, 28)
    SetReinforcementCount(ATT, 250)
    AddBleedThreshold(ATT, 31, 0.0)
    AddBleedThreshold(ATT, 21, 0.75)
    AddBleedThreshold(ATT, 11, 2.25)
    AddBleedThreshold(ATT, 1, 3.0)
    SetTeamAsFriend(ATT, 3)

--  Defender Stats
    SetUnitCount(DEF, 28)
    SetReinforcementCount(DEF, 250)
    AddBleedThreshold(DEF, 31, 0.0)
    AddBleedThreshold(DEF, 21, 0.75)
    AddBleedThreshold(DEF, 11, 2.25)
    AddBleedThreshold(DEF, 1, 3.0)
    SetTeamAsEnemy(DEF, 3)

--  Sound Stats
    OpenAudioStream("sound\\hot.lvl", "hotgcw_music");
    OpenAudioStream("sound\\hot.lvl", "hot1gcw");
    OpenAudioStream("sound\\hot.lvl", "hot1gcw");
    OpenAudioStream("dc:sound\\hot.lvl", "hot1cw");
    OpenAudioStream("dc:sound\\hot.lvl", "hot1cw");
    OpenAudioStream("sound\\cw.lvl", "cw_vo");
    OpenAudioStream("sound\\cw.lvl", "cw_tac_vo");

    SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1);
    SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing",   1);
    SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing",   1);
    SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1);

    --SetLowReinforcementsVoiceOver(REP, CIS, "REP_hot_transport_away", .75, 1);
    --SetLowReinforcementsVoiceOver(REP, CIS, "REP_hot_transport_away", .5, 1);
    --SetLowReinforcementsVoiceOver(REP, CIS, "REP_hot_transport_away", .25, 1);

    SetLowReinforcementsVoiceOver(REP, REP, "rep_off_defeat_im", .1, 1);
    SetLowReinforcementsVoiceOver(REP, CIS, "rep_off_victory_im", .1, 1);
    SetLowReinforcementsVoiceOver(CIS, CIS, "cis_off_defeat_im", .1, 1);
    SetLowReinforcementsVoiceOver(CIS, REP, "cis_off_victory_im", .1, 1);

    SetOutOfBoundsVoiceOver(2, "Repleaving");
    SetOutOfBoundsVoiceOver(1, "Cisleaving");

    SetAmbientMusic(REP, 1.0, "all_hot_amb_start",  0,1);
    SetAmbientMusic(REP, 0.99, "all_hot_amb_middle", 1,1);
    SetAmbientMusic(REP, 0.1,"all_hot_amb_end",    2,1);
    SetAmbientMusic(CIS, 1.0, "imp_hot_amb_start",  0,1);
    SetAmbientMusic(CIS, 0.99, "imp_hot_amb_middle", 1,1);
    SetAmbientMusic(CIS, 0.1,"imp_hot_amb_end",    2,1);

    SetVictoryMusic(REP, "all_hot_amb_victory");
    SetDefeatMusic (REP, "all_hot_amb_defeat");
    SetVictoryMusic(CIS, "imp_hot_amb_victory");
    SetDefeatMusic (CIS, "imp_hot_amb_defeat");

    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin");
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout");
    --SetSoundEffect("WeaponUnableSelect",  "com_weap_inf_weaponchange_null");
    --SetSoundEffect("WeaponModeUnableSelect",  "com_weap_inf_modechange_null");
    SetSoundEffect("SpawnDisplayUnitChange",       "shell_select_unit");
    SetSoundEffect("SpawnDisplayUnitAccept",       "shell_menu_enter");
    SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change");
    SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter");
    SetSoundEffect("SpawnDisplayBack",             "shell_menu_exit");

    SetPlanetaryBonusVoiceOver(CIS, CIS, 0, "CIS_bonus_CIS_medical");
    SetPlanetaryBonusVoiceOver(CIS, REP, 0, "CIS_bonus_REP_medical");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 1, "");
    SetPlanetaryBonusVoiceOver(CIS, REP, 1, "");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 2, "CIS_bonus_CIS_sensors");
    SetPlanetaryBonusVoiceOver(CIS, REP, 2, "CIS_bonus_REP_sensors");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 3, "CIS_bonus_CIS_hero");
    SetPlanetaryBonusVoiceOver(CIS, REP, 3, "CIS_bonus_REP_hero");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 4, "CIS_bonus_CIS_reserves");
    SetPlanetaryBonusVoiceOver(CIS, REP, 4, "CIS_bonus_REP_reserves");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 5, "CIS_bonus_CIS_sabotage");--sabotage
    SetPlanetaryBonusVoiceOver(CIS, REP, 5, "CIS_bonus_REP_sabotage");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 6, "");
    SetPlanetaryBonusVoiceOver(CIS, REP, 6, "");
    SetPlanetaryBonusVoiceOver(CIS, CIS, 7, "CIS_bonus_CIS_training");--advanced training
    SetPlanetaryBonusVoiceOver(CIS, REP, 7, "CIS_bonus_REP_training");--advanced training

    SetPlanetaryBonusVoiceOver(REP, REP, 0, "REP_bonus_REP_medical");
    SetPlanetaryBonusVoiceOver(REP, CIS, 0, "REP_bonus_CIS_medical");
    SetPlanetaryBonusVoiceOver(REP, REP, 1, "");
    SetPlanetaryBonusVoiceOver(REP, CIS, 1, "");
    SetPlanetaryBonusVoiceOver(REP, REP, 2, "REP_bonus_REP_sensors");
    SetPlanetaryBonusVoiceOver(REP, CIS, 2, "REP_bonus_CIS_sensors");
    SetPlanetaryBonusVoiceOver(REP, REP, 3, "REP_bonus_REP_hero");
    SetPlanetaryBonusVoiceOver(REP, CIS, 3, "REP_bonus_CIS_hero");
    SetPlanetaryBonusVoiceOver(REP, REP, 4, "REP_bonus_REP_reserves");
    SetPlanetaryBonusVoiceOver(REP, CIS, 4, "REP_bonus_CIS_reserves");
    SetPlanetaryBonusVoiceOver(REP, REP, 5, "REP_bonus_REP_sabotage");--sabotage
    SetPlanetaryBonusVoiceOver(REP, CIS, 5, "REP_bonus_CIS_sabotage");
    SetPlanetaryBonusVoiceOver(REP, REP, 6, "");
    SetPlanetaryBonusVoiceOver(REP, CIS, 6, "");
    SetPlanetaryBonusVoiceOver(REP, REP, 7, "REP_bonus_REP_training");--advanced training
    SetPlanetaryBonusVoiceOver(REP, CIS, 7, "REP_bonus_CIS_training");--advanced training


--  Camera Stats
--Hoth
--Hangar
AddCameraShot(0.944210, 0.065541, 0.321983, -0.022350, -500.489838, 0.797472, -68.773849);
--Shield Generator
AddCameraShot(0.371197, 0.008190, -0.928292, 0.020482, -473.384155, -17.880533, 132.126801);
--Battlefield
AddCameraShot(0.927083, 0.020456, -0.374206, 0.008257, -333.221558, 0.676043, -14.027348);


end

But like i said all sounds are working perfectly fine, except for the announcer but if i restart the map (just by pressing escape and "restart mission") the announcer will work without any issue (and this also happen if i play GCW wich use the stock script and looks for the stock sound file)
Title: Re: Terrain Issue on Hoth
Post by: {AR}MetalKiller on March 21, 2024, 09:38:40 AM
I haven't used custom sounds extensively, but your script seems fine.
One thing you might try is to uncomment the remaining gcw stuff that you replaced with cw files:

...
    OpenAudioStream("sound\\hot.lvl", "hot1gcw");
    OpenAudioStream("sound\\hot.lvl", "hot1gcw");
...
Not sure if this will have an effect.

Another thing that you might want to try is loading your "custom" resources first (before the music)
...
    OpenAudioStream("dc:sound\\hot.lvl", "hot1cw");
    OpenAudioStream("dc:sound\\hot.lvl", "hot1cw");
...
Title: Re: Terrain Issue on Hoth
Post by: Miraak49 on March 21, 2024, 05:24:48 PM
After testing, the sound issue seems to be related to the game itself on steam and not my map
I noticed it also happened on those stock maps (a friend with the steam version and a fresh install had the exact same issues on those maps):
-Hoth
-both Bespin CW only
-Tatooine Dune Sea both eras
-Tatooine Mos Eisley GCW only

This only happen when you are using the OpenAl for restored 3D audio, ofc you can just turn it off to fix it but the game just sound much better with it, ill try to find a fix
EhPortal 1.34 © 2024, WebDev