C# Script to Fix Flooding on Maps
-
I've had a few DMs regarding the ocean waves overlapping land. This happens in the French Riviera and Route66 maps, but also in some areas of Liberty City and others.
This isn't unexpected given most mod maps are located in the Pacific Ocean or other bodies of water in San Andreas.
While I'm sure there is a way to modify some meta files to fix this issue, I prefer to have the flexibility to enable or disable waves - at least to reduce the intensity.
I'm not a programmer but the code I do write is always fully tested - stable and functional - or I wouldn't post it here or use it myself.
// FRENCH RIVIERA WAVE CONTROL private void DisableWaves(object sender, EventArgs e) { Function.Call((Hash)0xB96B00E976BE977F, 0.0f); } // _SET_CURRENT_INTENSITY private void EnableWaves(object sender, EventArgs e) { Function.Call((Hash)0x5E5E99285AE812DB); } // _RESET_CURRENT_INTENSITY //void SET_DEEP_OCEAN_SCALER(float intensity) // 0xB96B00E976BE977F 0x53B694B1 b323 //void RESET_DEEP_OCEAN_SCALER() // 0x5E5E99285AE812DB 0x4AD23212 b323
-
On a related note, I was also asked how to eliminate the annoying sound of ocean waves, smack in the middle of Times Square/Star Junction in Liberty City.
This solution was provided by @a63nt-5m1th, the resident expert on all things GTA5.
- Navigate to ...\mods\update\update.rpf\x64\audio\config\categories.dat22.rel
- Export it with RPF Explorer as xml
- Zero out or reduce the values in the file.
- Then re-import the file.
The tags and values I used are shown below, feel free to experiment. Solution should work for other maps as well.
See also Adjusting in-game Sound Effects
<Item type="Unk0" ntOffset="2842"> <Name>weather_thunder</Name> <Flags value="0xAAAAAAAA" /> <Unk01 value="0" /> <Unk02 value="600" /> <Unk03 value="0" /> <Unk04 value="23900" /> <Unk05>hash_68BAA914</Unk05> <Unk06 value="0" /> <Unk07>hash_2C30266B</Unk07> <Unk08 value="100" /> <Unk09 value="100" /> <Unk10 value="100" /> <Unk11 value="100" /> <Unk12 value="100" /> <Unk13 value="100" /> <Unk14 value="100" /> <Unk15 value="0" /> <Unk16 value="0" /> <Unk17 value="100" /> <Unk18 value="4" /> <Items />
-
@JohnFromGWN good! I was experiencing the same problem, but with another map. this will be very helpful. Thanks!
But could you tell me how the events are triggered?
-
@Niziul I trigger 99% of my code with LemonUI. You should look into it - amazing tool to write your own fully customized menus.
Or just assign to a key.
//This is the code to display the Menu options (abbreviated here) private static readonly NativeMenu France = new NativeMenu("France", "~g~More France", ""); private static readonly NativeItem France_3 = new NativeItem("~b~Disable Ocean Waves", "French Riviera"); private static readonly NativeItem France_4 = new NativeItem("~b~Renable Ocean Waves", "French Riviera"); //These are the entries to add those options to the Menu Pool submenu0.AddSubMenu(France, "..."); pool.Add(France); //These are the menu options with triggers France.Add(France_3); France_3.Activated += DisableWaves; France.Add(France_4); France_4.Activated += EnableWaves;
-
@JohnFromGWN good to know!
But in the end I ended up assigning in a new cheat code. I don't like menu
!
the natives were very helpful!
-
@Niziul How did you do that? 🤔
-
@JustDancePC excellent question, i don't know the cheat codes but pretty sure there ain't one for wave intensity.
-
is basically quite simple. I used the
Game.WasCheatStringJustEntered(string cheat)
. and you must use it in the "tick"!// // Resumo: // Gets whether a cheat code was entered into the cheat text box. // // Parâmetros: // cheat: // The name of the cheat to check. // // Devoluções: // true if the cheat was just entered; otherwise, false public static bool WasCheatStringJustEntered(string cheat) { return Function.Call<bool>(Hash._HAS_CHEAT_STRING_JUST_BEEN_ENTERED, GenerateHash(cheat)); }
I did it like this:
if (Game.WasCheatStringJustEntered("Waves(){}")) { Game.TimeScale = 0.1f; var input = string.Empty; var areTheWavesActivated = GTA.Native.Function.Call<float>(GTA.Native.Hash.GET_DEEP_OCEAN_SCALER) > 0f; if (areTheWavesActivated) { input = "[off]"; } else { input = "[on]"; } var userInput = Game.GetUserInput(WindowTitle.EnterChallengeName, input, input.Length); if (userInput != string.Empty) { switch (areTheWavesActivated) { case true: { GTA.Native.Function.Call(GTA.Native.Hash.SET_DEEP_OCEAN_SCALER, 0f); GTA.UI.Notification.Show($"Waves: ~y~off~w~!", true); } break; case false: { GTA.Native.Function.Call(GTA.Native.Hash.SET_DEEP_OCEAN_SCALER, 1f); GTA.UI.Notification.Show($"Waves: ~y~on~w~!", true); } break; } } Game.TimeScale = 1.0f; }
-
@Niziul Good, I thought you had entered it with the phone!
-
@Niziul ohhh, nice. Thanks
-
@JohnFromGWN said in C# Script to Fix Flooding on Maps:
@Niziul Good, I thought you had entered it with the phone!
it would take me forever to get the waves out!