Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weather System
#1
Always wanted weather for your game?

Always thought you could do it yourself?

Tried the weather from the old forms and aren't happy with it's results?

You've come to the right place! This is from Konfuze's source, or whatever they wanna call it now..(Elysium... Diamond..?) Anyways...

Don't add this unless you've saved your code.

Level of Dificulty: 1/5(Just C&P and Understand...)

First, and foremost, back up your code.

Second, Open the Server.

This is the only thing you have to add.

Change
Code:
' Lets change the weather if its time to
    If WeatherSeconds >= 60 Then
        i = Int(Rnd * 3)
        If i  GameWeather Then
            GameWeather = i
            Call SendWeatherToAll
        End If
        WeatherSeconds = 0
    End If

To read

Code:
' Lets change the weather if its time to
    If WeatherSeconds >= 18600 / 2 Then
        i = Int(Rnd * 3)
        If i  GameWeather Then
            GameWeather = i
            Call SendWeatherToAll
            Call PutVar(FileName, "Weather", "Weather", Trim(GameWeather))
        End If
        WeatherSeconds = 0
    End If

That just checks for half a day(12 hours, irl) and changes the weather randomly.

Also, uncomment this line
Code:
WeatherSeconds = WeatherSeconds + 1

That's important. Keeps the time for weather.

Now, close the server. You're done with it. (AHMAGAWD, THAT WAS EASY!!1)

Next, open the client. Open modDirectX.

Put this in there
Code:
Sub BltWeather()
Dim i As Long

    Call DD_BackBuffer.SetForeColor(RGB(0, 0, 200))
    
    If GameWeather = WEATHER_RAINING Then
        For i = 1 To MAX_RAINDROPS
            If DropRain(i).Randomized = False Then
                If frmMirage.tmrRainDrop.Enabled = False Then
                    BLT_RAIN_DROPS = 1
                    frmMirage.tmrRainDrop.Enabled = True
                    If frmMirage.tmrRainDrop.Tag = "" Then
                        frmMirage.tmrRainDrop.Interval = 200
                        frmMirage.tmrRainDrop.Tag = "123"
                    End If
                End If
            End If
        Next i
    ElseIf GameWeather = WEATHER_SNOWING Then
        For i = 1 To MAX_RAINDROPS
            If DropSnow(i).Randomized = False Then
                If frmMirage.tmrSnowDrop.Enabled = False Then
                    BLT_SNOW_DROPS = 1
                    frmMirage.tmrSnowDrop.Enabled = True
                    If frmMirage.tmrSnowDrop.Tag = "" Then
                        frmMirage.tmrSnowDrop.Interval = 200
                        frmMirage.tmrSnowDrop.Tag = "123"
                    End If
                End If
            End If
        Next i
    Else
        If BLT_RAIN_DROPS > 0 And BLT_RAIN_DROPS  RainIntensity Then
    tmrRainDrop.Enabled = False
    Exit Sub
End If
If BLT_RAIN_DROPS > 0 Then
        If DropRain(BLT_RAIN_DROPS).Randomized = False Then
            Call RNDRainDrop(BLT_RAIN_DROPS)
        End If
    End If
    BLT_RAIN_DROPS = BLT_RAIN_DROPS + 1
    If tmrRainDrop.Interval > 30 Then
        tmrRainDrop.Interval = tmrRainDrop.Interval - 10
    End If
End Sub

Private Sub tmrSnowDrop_Timer()
If BLT_SNOW_DROPS > RainIntensity Then
    tmrSnowDrop.Enabled = False
    Exit Sub
End If
If BLT_SNOW_DROPS > 0 Then
        If DropSnow(BLT_SNOW_DROPS).Randomized = False Then
            Call RNDSnowDrop(BLT_SNOW_DROPS)
        End If
    End If
    BLT_SNOW_DROPS = BLT_SNOW_DROPS + 1
    If tmrSnowDrop.Interval > 30 Then
        tmrSnowDrop.Interval = tmrSnowDrop.Interval - 10
    End If
End Sub

And that should be it. If you have any problems whatsoever, or if I'm missing anything, please tell me. This is as easy as I could get it, ripped from Elysium to work for MSE.

Sorry I can't explain what any of it does. I don't understand DirectX too well to do so. Maybe someone else could explain?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)