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)

DESERT HEAT
Version 1.0
By Wyatt


What is this script?

This script is for desert areas.

You have a water supply, which runs down every time you move. (You drink from exhaustion from the heat of the desert basically). If you run out of water, you start losing health until you get water again.

Instructions

They are in the script.

But, a note. To make water points where you can fill up your water, do a call script with:

$desert_left =

And then after that put the amount of steps you'd like the player to be able to go with this water before losing health.


If you do not want on-map regeneration:

Delete lines 36 to 40.

If you just want on-map regeneration, just use:

Code:
class Game_Party

  def increase_steps

    @steps = [@steps + 1, 9999999].min

    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

....instead of this script.
Notes

Should be compatable with most things other than those which edit the steps method of Game_Player.

It shouldn't lag too much, because it is just adding on to a system already in place (the steps system).

The Script

It's not very long.

Code:
#===============================================================================

# * Desert Heat (and map regeneration)

#

# By Wyatt, version 1.0

# [url=http://www.vengeance-rpg.co.nr]http://www.vengeance-rpg.co.nr[/url]!

#

# To turn on desert heat change $in_desert to true

# To turn it off again change $in_desert to false

#

# To change the amount characters are regenetated by change

# the number "1" on lines 28, 33, and 38.

#

# 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.

#===============================================================================

class Game_Party

  def increase_steps

    @steps = [@steps + 1, 9999999].min

    if $in_desert == true

      if $desert_left > 0

        $desert_left -= 1

        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

        for i in 0...$game_party.actors.size

          $game_party.actors[i].hp -= 1 unless $game_party.actors[i].hp <= 0

        end

      end

    else

      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
 

Jason

Awesome Bro

Hey, this is a really good idea, I think it will come in handy for my game actually, nice work Wyatt, kee it up !

I just thought, where it says
Code:
# To turn on desert heat change $in_desert to true
# To turn it off again change $in_desert to false
Do I just call a script saying this when I enter a desert
Code:
$in_desert = true
and
Code:
$in_desert = false
When I come out of a desert area ?

Sorry, but I havent' scripted for a while so I'm not 100% sure on this.
 

Jason

Awesome Bro

Ah, I'll edit that then.
Wow, this is kinda simple to use, I'm going to use it with your permission lol, and I'll tell you if I have any problems.
 
Just what I needed. Good Job!

I better learn RGSS quick so I won't be leaching so much. heh.

One Question. What's on-map regeneration and whats its use?
 

Jason

Awesome Bro

On-map regeneration is when your HP slowly refills while your walking around a map, just like on most MMORPG's where your HP will slowly refill.
Examples are:
WoW, MapleStory, Runescape (Kind of), GuildWars, and others.
 
Kudos, man. This is pretty good ;)

Reminds me of a script some guy made where you constantly run out of air if you're underwater for too long.
 
So you just turn it off whenever you find water or whatever? Script looks great and simple! It'd be nice if there was some screen flashing or ME looping when your health is below, say 50, like a warning so you know when you're about to die. A HUD would also be nice, but you could just find that in a different script.
 
If you don't mind here are my two quick cents:

First try avoiding Globals try using Class Variables:
instead of:
Code:
$in_desert use @in_desert
then add:
Code:
Class Game_Party
    attr_accessor :in_desert
end
do the same for desert_left
To use simply do $game_pary.in_desert instead of $in_desert.
also:
for i in 0...$game_party.actors.size Don't use this.
try
Code:
 $game_party.actors.each each do {|actor|} do
 #stuff in here like p actor.name

The last thing I have is you should use alias:

Code:
class Game_Party
alias eduardo_increase_steps increase_steps
def increase_steps
   eduardo_increase_steps
   #your Stuff in here
end
That will give a boost in Compatibilty issues.

Also do you need sugestions for improvement try these:
Try making it not work by step, but by frame because if you are in the sun even if not moving you desihidrate(sp?).
Check if the player is in a shadow and stop taking the water needed or a least take less.
[Spoiler = "Don't Open if you want to find your self how to do it"] Check if the player is a certain terrain tag, that would refill a litte of his health.[/Spoiler]
Make other eye candy effects like Allucinations, heat effects, Faints etc...
[Spoiler = "Don't Open if you want to find your self how to do it"] For allucinations, just try spawning random sprites/events in the map like water and other things, try making more character sprites etc.[/Spoiler]


There they are my 2 cents, hope it was helpfull, and I hoping to see more scripts from you.
 
Eduardo has a point, the script is great but it'd be more realistic if you lose water supply and health based on frames rather than steps.
 
Wouldn't they need to be global so that you can turn them on/off from a call script though? Edit: Ah, I see. That's a pretty good idea. I never knew how the attr accessor thing worked before, it's never explained in tutorials.

Edit: I tried healing by frames before. It works at first, but then you start to notice a large amount of lag, and as frame rate is constantly changing sometimes, it's a bit... uneven. E.g. if you have an antivirus running, then you'll be at a disadvantage (or advantage regarding desert heat).

Oh and hallucinations can easily be done with events. :)
 
Yeah I guess so, I was just point some sugestions, other thing you can do is by time, and not frame, TIme is Constant.So try it.
 
It would be better by second but you will have to make it stop when entering the menu or if you have a script that pauses the game.
 
Eh, Reaper, you can simply bypass that problem if you make it in Scene_Map. No problem then. Nice script by the way, and I'd love to see a version of it that lets players lose water each x frames.
 
Thats not really the point, reaper. I think that could be done easy. Just a little HUD in the upper right like a pause icon. When you get in the pause mode, there comes a picter "pause" in-game.
 
That would be easy Reaper*, you just would need to check if the current Scene is a Game_Map, $scene.is_a?(Game_Map), I guess that the syntax is like that.
 

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