Set Entities dry during rain

Hey guys,
I want to stop objects / entities get wet during rain.

So, I place housing shells with the CreateObject function (works fine).
After I did so the shadows and the weather glitched into them.

To fix this issue I needed to move the shell into a building on the map.
That at least fixes the shadow issue.
The weather problem still occurs.

So, I thought just edit the weather script so that it sets the weather to clear when entering a building.
Also works fine.

The Problem is that after entering the Shell and the entities (furniture objects) still got water puddles all over them.

Is there a way to make the entity not be able to get wet ?

I already read about the function SetRainLevel but it prevents to spawn water puddles all over the map at the first place. (I dont want that)

You are better off changing the clients weather and time when entering a shell to day and sunny, then defaulting back to the “worlds” time and weather upon exit.

Thats what I‘m currently doing.
It works fine but there are water puddles all over the place.
Its not raining anymore but the leftovers still exist. Thats the problem.

find a fix

Old thread but nobody posted a real fix so here’s what worked for me

The reason it happens is that shells spawned with CreateObject aren’t part of an interior, so the game treats them like outside geometry. The puddles come from the rain/wetness level, not the weather type itself, that’s why switching to EXTRASUNNY stops the rain but the wet stuff stays there for a while

Option 1, override rain level only while you’re in the shell

SetRainLevel is client side, it only affects you, so the “puddles all over the map” thing doesn’t really matter if you only set it while inside and reset it when you leave

-- on shell enter
SetWeatherTypeNowPersist('EXTRASUNNY')
SetRainLevel(0.0)

-- on shell exit
SetRainLevel(-1.0) -- -1.0 removes the override
-- then let your weather sync put the normal weather back

just make sure your weathersync isn’t reapplying the weather every tick while you’re inside or it’ll keep fighting the override, most of them have an event to disable/enable sync

Option 2, force the shell and props into the interior

since you already moved the shell inside a map building you can force the entities into that interior room, stuff inside a room doesn’t get wet and it also helps with the shadows

local interior = GetInteriorAtCoords(shellCoords.x, shellCoords.y, shellCoords.z)
if interior ~= 0 then
    local roomHash = GetRoomKeyFromEntity(PlayerPedId())
    ForceRoomForEntity(shell, interior, roomHash)
    for _, obj in ipairs(furnitureObjects) do
        ForceRoomForEntity(obj, interior, roomHash)
    end
    ForceRoomForEntity(PlayerPedId(), interior, roomHash)
end

remember ClearRoomForEntity on the player when leaving and on the objects before deleting them

option 1 alone is usually enough, if you still see some wet surfaces or weird lighting use both