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.

Desert Heat (includes on-map regeneration)

Well, based on seconds would be cool. The time when you drink a bit, can be varied as you go deeper in desert it'll be warmer so you drink more.
 
Everything I said is quite easily to do, since I don't know how good Wyat is with Rgss,but I think he can pull it off very well.
 
I've tried what you said, unfortunately it... doesn't work. (I'll work on timed regeneration later).

Code:
#===============================================================================
# * Desert Heat (and map regeneration)
#
# By Wyatt, version 1.1
# www.vengeance-rpg.co.nr!
#
# To turn on desert heat change $in_desert to true
# To turn it off again change $in_desert to false
#
# When you enter a desert area, call a script with:
# $desert_left = x
# Where "x" is the amount of steps you want before you start losing health
#
# License:
# It's only a small script, feel free to use in free or commercial games.
# But please give credit.
#
# Updates:
# 1.1 - - Used attr_accessor and aliased methods
#===============================================================================
class Game_Party
  
  # obtain variables
  attr_accessor :in_desert
  attr_accessor :desert_left
  
  # alias methods
  alias desert_steps increase_steps
  alias desert_initialize initialize
  
  # initialize
  def initialize
    desert_initialize
    @desert_left = 250
    @in_desert = false
  end
  
  # increase steps
  def increase_steps
    desert_steps
    # if you are in the desert...
    if @in_desert == true
      if @desert_left > 0
        # drain water
        @desert_left -= 1
        # raise health
        for i in 0...$game_party.actors.size
          $game_party.actors[i].hp += 1 unless $game_party.actors[i].hp ==
          $game_party.actors[i].maxhp
        end
      else
        # drain health (if you have no water left)
        for i in 0...$game_party.actors.size
          $game_party.actors[i].hp -= 1 unless $game_party.actors[i].hp <= 0
        end
      end
    else
      # raise health
      for i in 0...$game_party.actors.size
        $game_party.actors[i].hp += 1 unless $game_party.actors[i].hp ==
        $game_party.actors[i].maxhp
      end
    end
  end
end
 
Eduardo, giving tips are ok, when they are... right -_-....

Code:
$game_party.actors.each each do {|actor|} do
 #stuff in here like p actor.name

I think you meant...

Code:
$game_party.actors.each { |actor| #stuff }

Which is the exact same as

Code:
for actor in $game_party.actors

So it wouldn't be less resources consuming (Dunno if working with i = RANGE is more resources costing)

Code:
use Class Variables

Class variables are @@something and are not defined within the method. You meant Instance Variables. There's such a difference...

Also, I would NOT sugest putting this in Game_Party. Although you could say: The Party is in a desert, you better put in in Game_Map. Try to put related data in related places. YOu could do...

Code:
class Game_Map
[...]

DESERT_MAPS = [3,231,42]

def setup(map_id)
[...]
@desert_map = DESERT_MAPS.include?(map_id)
[...]

def in_desert
  return @desert_map
end
[...]
 

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