Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Edit to Game_Map

Status
Not open for further replies.

OS

Sponsor

Hello again! I decided to try and figure out my last problem by myself, and this is the result. I edited Game_Map's refresh Method so that every time it refresh's the variable count changes. If count == 20, then a bunch of conditional's go into effect that decide a weather change, using Ccoa's Weather script. I need to know if it would even work?

Here is the revised method:
Code:
#--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # If map ID is effective
    if @map_id > 0
      # Refresh all map events
      for event in @events.values
        event.refresh
      end
      # Refresh all common events
      for common_event in @common_events.values
        common_event.refresh
      end
      # Refresh Weather
      @count = (@count + 1) % 140
      if @count == 20
        weather_types = RandWeather::WEATHER
        i = 0
        case rand(weather_types.size - 1)
        when i
          $game_screen.weather(0, 0, 0)
        when i + 1
        rate = RandWeather::RATE[i + 1]
        occurs = (rate * 2.0) / 2
        if occurs > 2.5
          rndm = rand(2)
          if rndm >= 1
            change = true
          else
            change = false
          end
        elsif occurs <= 2.5
          rndm = rand(3)
          if rand >= 2
            change = true
          else
            change = false
          end
        end
          if change == true
            $game_screen.weather(weather_type[i + 1], (rand(49) + 1), (rand(9) + 1))
          end
        when i + 2
        rate = RandWeather::RATE[i + 1]
        occurs = (rate * 2.0) / 2
        if occurs > 2.5
          rndm = rand(2)
          if rndm >= 1
            change = true
          else
            change = false
          end
        elsif occurs <= 2.5
          rndm = rand(3)
          if rand >= 2
            change = true
          else
            change = false
          end
        end
          if change == true
            $game_screen.weather(weather_type[i + 2], (rand(49) + 1), (rand(9) + 1))
          end
        when i + 3
        rate = RandWeather::RATE[i + 1]
        occurs = (rate * 2.0) / 2
        if occurs > 2.5
          rndm = rand(2)
          if rndm >= 1
            change = true
          else
            change = false
          end
        elsif occurs <= 2.5
          rndm = rand(3)
          if rand >= 2
            change = true
          else
            change = false
          end
        end
          if change == true
            $game_screen.weather(weather_type[i + 3], (rand(49) + 1), (rand(9) + 1))
          end
        end
      end
    end
    # Clear refresh request flag
    @need_refresh = false
  end

My game run's fine, but nothing happens. Every so often I gain a little lag, but other than that, nothing changes. I need to know how my count variable actually works (I got it from an other help topic), and why nothing ever changes. I know it's a bit long to look through, but I would really appreciate it.

Peace Out!

~Broken
 

OS

Sponsor

Thank you for telling me this. I edited my script, and it now works (almost) perfectly! It should be fine for now! THIS TOPIC IS NOW RESOLVED.

Peace Out!

~Broken
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top