• Announcements

    • RagingHobo

      Forum Upgraded!   07/17/2017

      We have successfully upgraded our forum to the latest version! Some things have moved around but don't worry everything is still there, we still need to find updated versions of the plugins we were using previously to restore everything to the way it was. There will be a running topic in the Feedback and Support in case you notice something wrong. Before you do so please clear your browser cache and close your browser completely to rule out a caching issue. Thank you for your patience during the outage and while we get everything back to 150%  
Apellonyx

Survival System

125 posts in this topic

Survival System
v1.10

Changelog

  • v1.0: 2 April 2013 - First Version
  • v1.01: 3 April 2013 - Added configurable maximum values for food, water, and rest. Made the maximum value for life a configurable value. The failsafe mentioned in v1.0's Instructions is no longer needed.
  • v1.02: 3 April 2013 - Added an optional "reverse logic" stat, as suggested by esrann. It supports several different game styles, and is fully configurable.
  • v1.10: 5 April 2013 - Complete rewrite using global variables rather than game variables and switches. All stats are now optional, configurable, and can be hidden from the menu. Also renamed from "Needs System" to "Survival System."

 


 

 

Compatibility Issues

  • While I haven't had any issues reported yet, I can almost guarantee this script will conflict with the Self Data Suite by PK8, since they both make use of the DataManager module. However, PK8 is a much better scripter than I, and he was able to alias the module properly, so they should work fine together if you load this script ABOVE the Self Data Suite.

 


 

 

Introduction

 

So I'm used to playing games like Oblivion and Fallout 3 and whatnot, which allow for all sorts of mods to be added to the games, right? Right. Well, some of the mods I was never able to do without were the ones that dealt with hunger and thirst and all that jazz, since I'm a sucker for realism in my fantasy worlds. And then I attempted to start making a game with RMVX Ace, and I found that you could install scripts, just like you could in the mod creation programs for those big-name games, and I was just like "Whoa, man! I have to do this and this and that other thing," and of course, I had no idea how. Of course, that didn't stop me (I'm approximately as stubborn as they come). I just dove into the scripts and started digging around to see how the syntax worked and stuff, and now, five days later, voila! A script. Now, I suppose you want to know what it does, don't you? Well ...
 

Description

 
Like I said, I could never live without those hunger and thirst mods in those big-name games, so I decided to make one for mine, too. And then I decided to share it. What this script does is set up a needs system, which consists of hunger, thirst, and sleep. However, it's a bit more intricate than just that, since that would be too easy. I then added in this new value called "Life" that will kill you if it reaches zero. And then, per request by esrann (although I can't believe I didn't think of it on my own, with what a huge Fallout fan I am), I added a reverse logic stat called Toxin (which can also kill you). Call it a mini-game. You keep your life stat high by staying well-fed, hydrated, rested, and poison-free. Let your needs drop too low and/or let your toxin get too high, and your life will start dropping, too. And then you eat and sleep and drink some vodka and medicine and poof! Life starts going back up. It's really quite boring to watch, I assure you (as I have play-tested it for extensively). The whole script runs on a total of four to seven variables (depending on whether you choose to use the toxin system and/or timescale variable), two to three switches (depending on the use of toxin) one switch, can be customized rather extensively through a large configuration module, and what's better, there's a menu window that displays the current value of all of your needs! Wanna see?

 

Screenshots

 

Screen1_zps44fa3792.jpg
 
See how pretty it is? Okay, so it's kind of blah. It's my first script; give me a break. But the numbers change colors depending on how high or low they are!

 

2lw2sy.jpg

 
It can easily be configured to fit into any custom menu system that has the space for it.

 

Screen1_zps2040a7a6.jpg

 

And look at that new bar down there at the bottom! Yay for hazardous waste!

 

Screen1_zpsc88a4b4a.jpg

 

Since you can now disable individual stats, you can now use only the ones you want!


 

Required Scripts

 
Well, actually no scripts are required. Well, other than this one, obviously.
 

Features

 
So, in conclusion, we have all of the following features:

  • Easily customized
  • Lots of configuration options
  • Simple-looking, but intelligent
  • Works with several different menu systems
  • Variables can be modified moderately easily through in-game script commands
  • The whole system can be turned off by flipping a switch
  • Individual stats can be paused, hidden, or turned off on the fly
  • Not bad looking

Of course, there are a few downfalls I need to get fixed, too:

  • Currently does not support separate values for multiple-actor games
  • I had to overwrite a few methods in the DataManager module; messy, but effective

Script

 
Version 1.02 (If for some reason, you want it): http://pastebin.com/GjdEBhcq

Version 1.10: http://pastebin.com/4FLHGRsk

 

Planned Updates

 
I have several updates in mind to improve the way the script works. At the moment, it is very limited, with support for only one actor games, the need to set up common events for each sustenance item, and so on.

  • I'm still working on setting up some notetags to make setting up items easier.
  • Secondly, I want to extend the functionality to include parties with more than one actor so each actor has his or her own needs, and he or she can die--permanently--if they aren't kept up properly. Of course, this one will likely be the most difficult, since it requires a lot more conditional work, and I'd have to rewrite the entire needs window from scratch to accommodate for the additional info.
  • Third, I want the needs to actually affect how the player plays the game. High needs stats lead to buffs, low needs stats lead to debuffs, so on and so forth. I'll get to that soon enough.
  • Lastly, and I'm putting this here now even though I don't plan to implement it until all of the above conditions are met, I know I will get at least one request for something more elaborate and intricate than just five simple variables. Yeah, I know. I'm already planning out how protein and fat and carbohydrates will affect the food stat, how the water stat is affected by alcohol consumption and dashing on the map, how performing magic leads to needing more sleep, how using certain items repeatedly can lead to an addiction to that item, so on and so forth. It's all very complicated, and most of it will never make it into the final version, but it's all up in my head, so don't bother with suggestions that fit into this category, since they're already being sorted through.

If you have any suggestions, be sure to mention them. I may add them in, I may not; it all depends on the difficulty of the modification and whether it would fit into the system well or not. Oh, and if you catch any bugs, TELL ME! I'll do my best to squash them pronto.
 

Credit

 
Actually, I did all of the work myself, I'm proud to say, with the idea for the toxin system having been introduced by esrann. You are free to use this system however you wish, in commercial and non-commercial games alike. If you edit the script extensively, it is not necessary to credit me (Apellonyx), since you clearly only used my code as a framework, but I would appreciate credit if it is used in its current form, or if only minor changes were made to the script. By the way, configuring the configuration module does not qualify as an extensive edit. You know, just to clarify.

Edited by Apellonyx

Share this post


Link to post
Share on other sites

Very nice. I haven't tested it quite yet, but it's a very delicious looking script you've got there. And I'm certain anyone with a survival-based project will very much appreciate this. Well done.

CT Bolt likes this

Share this post


Link to post
Share on other sites

Thanks a bunch. It's my first script using RGSS3, or any Ruby derivative, for that matter, but it turned out surprisingly well, I think.

Share this post


Link to post
Share on other sites

Very nice! Finally I can start a little survival game which most likely you will die at the first few minutes :P. Gonna see how I can mess around with this script.

CT Bolt likes this

Share this post


Link to post
Share on other sites

Wow, looks awesome!  :)  Going to test it out later. Cool contribution & your first RGSS3 script... nicely done. ^_^

PS. In your screenshot food is 108 out of 100%, does that mean the person is like overly full? lol. ^_^

Edited by CT Bolt
Pikalyze likes this

Share this post


Link to post
Share on other sites

@ Pikalyze: Thanks for the compliment. By the way, you can kill people off whenever you want (legitimately, even) by setting the timescale variable to some insanely high number (really, anything over 100). Then, needs will drain faster than people can replenish them, and you, as the game's developer, win. Hehe.

 

@ CT Bolt: Thanks to you, as well. And yes, it does mean the person is overly full. At present, the script doesn't have a maximum value set for the stats, other than life. Life can't go over 100%, unless you specifically change it in the script, but food, water, and rest all can. In fact, if you don't set up the common event failsafe I mentioned in the "Instructions" portion of the script's comments, players can stock up on needs and never have to eat, drink, or sleep again. lol.

 

By the way, the main post has been updated to include mention of the fact that the system currently only works for one actor games, as well as the addition of the new "Planned Updates" section.

Edited by Apellonyx
CT Bolt likes this

Share this post


Link to post
Share on other sites

Really nice script!

As a fan of survival rpg's, I've been wanting to add a system like yours into a project I'm working on.

 

 

Couple of ideas:

 

- The Life value could be hidden and only used for giving the actor debuffs as it gets lower.

I think it would be more challenging if the player didn't explicitly see the value, only see the individual stat levels and the effects of the worsening condition.

 

- 'Reverse logic' stats, for example as your Toxin Dose gets higher, Life value decreases. Then you need to take certain meds to keep the toxin level low.

Share this post


Link to post
Share on other sites

I had already planned to have the life value affect buffs and debuffs, but I hadn't thought about having it hidden. I like the idea, but I won't add it in until I have the system set up to activate the buffs and debuffs and whatnot, since at the moment, there isn't any other way to tell what range your life stat is in. Even once it's in, I'll make it optional to be hidden, since the value can kill off your character if it reaches zero.

 

As for your second idea, I'm not sure I know exactly what you mean. From what I'm guessing, it's something related to the radiation levels in the Fallout games, where being in certain areas or consuming certain items will increase your radiation level, which in turn decreases your overall health. If that is what you mean, it's a great idea, and I'll add support for it in the script. Of course, it will have to be an optional value, since it isn't likely to be used in a lot of games.

Share this post


Link to post
Share on other sites

I have this mechanic in my project that lowers your maxHP if you have deseases or toxic contamination. So even a high-level actor may temporarily have a really low max health if he is affected by a lot of bad status effects. Compare to real world: even if you're a professional athlete, acute radiation syndrome or ebola will make you pretty weak. Of course, the player won't be able to heal him past the maxHP. So, this works sort of like the Life value, but instead of simply killing the actor it will make him die very easily. Well, this is just my approach and works in the context of my project. I know a really hardcore survival game mechanic can be really immersive and lots of fun, too.

 

Yeah, you understood my second suggestion correctly, I just expressed it in a weird way. I meant that the logic is reversed compared to your existing stats: instead of [variable decreases -> life decreases], you'd have [variable increases -> life decreases]. I used to have a system similiar to this in RPGMXP so I was thinking about the code logic...  :rolleyes:  Fallout rad level is a perfect example, I should have used that to begin with. :)

 

As you know, a script that allows lots of room for developer creativity will need to have optional features and in general be modular. It's not easy, but you seem skilled in coding, even if you're new to Ruby or RGSS3. Anyways, these are just ideas I come up with when playing games and brainstorming with my geek friends, don't mean to sound demanding or anything. I appreciate the fact that your sharing your work with us!

Share this post


Link to post
Share on other sites

Esrann, I got you a present! The script has been updated to include the toxin system you suggested. It's nice and complicated to configure, but it works really well. I even have a whole section in the script describing how to configure it how you want, since I wasn't sure how you'd like it, so I set it up to handle several different methods. It still doesn't have the buffs or debuffs (so no maxHP decreases just yet), but it does affect the life stat. Strangely, it's even more configurable than the other stats. lol.

 

Oh, and by the way, I LOVE suggestions. I'm good at coming up with general ideas, but my creativity has been lacking lately, so I'm kind of relying on other people to give me something to do.

Share this post


Link to post
Share on other sites

Went and tested this script earlier. It's quite awesome, I have to say.

 

The only thing I can think of to improve it at the moment are individual switches to enable and disable the different needs individually. While it's wonderful having them all, there may be some individuals who only want Food and Water, or those Fallout guys only wanting the Toxin meter. :P Perhaps also an option to hide it from the menu or easily include it in their own scenes and menus.

 

Once again, great work. The survival developers will benefit greatly from having this script released.

Edited by Vaster

Share this post


Link to post
Share on other sites

Oooh, I feel like christmas morning, man!

 

@Vaster: I agree, customization & modularity. A module with switches for different needs and errr... anti-needs (like the toxin thing, I don't know the technical term).

Or a module with an array to add custom needs with different parameters.

 

At the moment, I use Galv's Region Effects and Variable Instance Bars to have certain areas (region id's) increase toxin dose variable. These scripts might be interesting to you.

 

I don't know, I suck at scripting and math and stuff in general. I do graphic design (for living)...

Share this post


Link to post
Share on other sites

Actually, I was already planning to have each one be optional, but I can't quite figure out how to set up the darn window. It worked just fine when I was only working with one optional stat, but when I try two, it gets a little picky, and then three just gets wonky. I'm working on it, though. And it can be called pretty easily into any menu or scene that has room for it (and even ones that don't, since windows can sit on top of one another), by just calling it with the following script code:

 

@needs_window = Window_Survival.new
@needs_window.x = 0
@needs_window.y = 0
@needs_window.z = 0
@needs_window.width = 150
@needs_window.opacity = 0
@needs_window.contents_opacity = 150

 

Of course, the only thing that's actually necessary is that first line (maybe the next two as well, if you don't want it in the top left corner). This is just the settings I like for HUD displays. lol. Yes, I'm going to implement HUD. No, I haven't done it yet. I have to go to work. :)

Edited by Apellonyx

Share this post


Link to post
Share on other sites

NEW UPDATE!!! The entire script was rewritten from scratch to implement several new features. Now, everything runs on global variables instead of game variables, so it won't take up half of your game variables (precious gold, they are), and thanks to some rather stressful coding sessions, I managed to make all of the stats optional without screwing up the window. So now, you can turn off the ones you don't want and keep the ones you do want. There are several other options, as well, but if you want to know them, just look at the main post. You know, this whole scripting bit is a lot harder than I thought it would be. I'm taking the day off tomorrow. lol

Edited by Apellonyx

Share this post


Link to post
Share on other sites

Very nice, very nice indeed. It is one of those scripts I did not know I needed until I saw it. Many thanks.

Share this post


Link to post
Share on other sites

Oh wow, this is quite the piece of work. For your first script I find this incredible. Now please hand over your brain so I can learn to script. 

 

Sincerely,

A Learning Scripter

Share this post


Link to post
Share on other sites

Well, it's pretty much plug n' play. All you have to do is work in your preferences into the configuration module at the top. Everything else works itself out. What exactly are you trying to do?

Share this post


Link to post
Share on other sites

I had it working earlier but it stopped working.  All the menu is there but its not going down on its own and lethal amounts of toxin doesnt kill me.  Probably over thinking it tho

Edited by Rumuwi

Share this post


Link to post
Share on other sites

Well, I was looking at the code, and I noticed a rather major bug that I've never seen before (although I have no idea how I missed it), and that is that the script quits working if any of the levels fall within a certain range (between 0 and 1, for example, which I forgot to change when I added the ability to use floats). I'm working on changing it now, and hopefully, that will fix it. I'm sorry I didn't see it before. Another possibility is that if you somehow accidentally switched off the switch that runs the script (in the Apyx module, its switch number is set by changing the SURVIVALSWITCH constant). If for some reason it gets switched off, the whole script stops working, which would explain both problems. The script only kills you at lethal toxin levels if the script is actually turned on. Horray for failsafes backfiring!

 

Alternatively, as for the lethal amounts of toxin not killing you, the first thing that pops into my head is that if you have DEATHFULLTOXIN set to false, it won't kill you. I'll look for any other stuff I may have missed in the script, but I didn't find anything with a quick look through, and it works on my computer, so I'm not really sure what the problem might be.

 

EDIT: The script has been updated to fix the float problem, and I still can't find anything in the script that would keep lethal toxin levels from killing you, other than the SURVIVALSWITCH or the DEATHFULLTOXIN being set to false. Also, by a suggestion from DarthVollis, I made the window's opacity configurable. In order to make the window show up on the map rather than the menu, though, it would require pretty much a whole new script, and (if you follow my activity, you'll notice) I don't really have the time to make it right now. Sorry DarthVollis.

Edited by Apellonyx

Share this post


Link to post
Share on other sites

Im kinda of a Noob, But how would i set this up with Script

 

 

#==============================================================================
#   XS - Variable Hud
#   Author: Nicke
#   Created: 02/04/2012
#   Edited: 09/04/2012
#   Version: 1.0a
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# A small hud to display variables on the map.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-VAR-WIN-HUD"] = true
 
module XAIL
  module VAR_HUD
  #--------------------------------------------------------------------------#
  # * Settings
  #--------------------------------------------------------------------------#
      # FONT = [name, size, color, bold, shadow]
      FONT = [["Verdana"], 14, Color.new(255,255,255), true, true]
 
      # HUD = [width, x, y, z, opacity, skin]
      HUD = [270, 295, -5,  200, 0, nil]
 
      # VAR_HUD_SWITCH = switch_id
      VAR_HUD_SWITCH = 1
 
      # VAR_LIST = [variable_id, vocab (nil), icon_index (nil), x, y]
      VAR_LIST = [] # Don't remove!
      VAR_LIST[0] = [1, nil, nil]
      VAR_LIST[1] = [2, nil, 358]
      VAR_LIST[2] = [3, nil, 359]
      VAR_LIST[3] = [4, nil, 366]
      
      # Set the symbol for the amount.
      # Can be set to "" to disable.
      # SYMBOL = string
      SYMBOL = ""
 
      # The space beetween the variables.
      # SPACING = number
      SPACING = 24
 
  end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Window_Var_Hud
#------------------------------------------------------------------------------
#  Class for drawing the variable hud.
#==============================================================================#
class Window_Var_Hud < Window_Base
 
  def initialize
    # // Method to initialize the var hud window.
    super(0, 0, window_width, fitting_height(XAIL::VAR_HUD::VAR_LIST.size))
    refresh
  end
 
  def window_width
    # // Method to return the width.
    return XAIL::VAR_HUD::HUD[0]
  end
 
  def draw_var(var, unit, x, y, width)
    # // Method to draw a variable with the content.
    value = "#{$game_variables[var]}#{XAIL::VAR_HUD::SYMBOL}"
    contents.font = Font.new(XAIL::VAR_HUD::FONT[0], XAIL::VAR_HUD::FONT[1])
    contents.font.color = XAIL::VAR_HUD::FONT[2]
    contents.font.bold = XAIL::VAR_HUD::FONT[3]
    contents.font.shadow = XAIL::VAR_HUD::FONT[4]
    draw_text(x, y, width - 60, line_height, value, 2)
    draw_text(x, y, width - 18, line_height, unit, 2) unless unit.nil?
    reset_font_settings
  end
 
  def refresh
    # // Method to refresh the variable hud.
    contents.clear
    draw_var_hud
  end
 
  def draw_var_hud
    # // Method to draw the var hud.
    y = 0
    @vars = {}
    for i in XAIL::VAR_HUD::VAR_LIST
      x = i[1].nil? ? 32 : -10
      draw_var(i[0], i[1], x, y, contents.width - 8)
      draw_icon(i[2], 210, y - 2) unless i[2].nil?
      y += XAIL::VAR_HUD::SPACING
      @vars[i[0]] = $game_variables[i[0]]
    end
  end
 
  def update
    # // Method to update the variable hud if a value has been changed.
    super
    for i in XAIL::VAR_HUD::VAR_LIST
      refresh if($game_variables[i[0]] != @vars[i[0]])
    end
  end
 
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  Show variable hud on the map.
#==============================================================================
class Scene_Map < Scene_Base
 
  alias xail_var_hud_window_start start
  def start(*args, &block)
    # // Method to start the var hud window on the map.
    xail_var_hud_window_start(*args, &block)
    create_var_hud_window
    @var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
  end
 
  alias xail_var_hud_window_terminate terminate
  def terminate(*args, &block)
    # // Method to terminate the var hud window on the map.
    xail_var_hud_window_terminate(*args, &block)
  end
 
  def create_var_hud_window
    # // Method to create the variable window.
    @var_hud_window = Window_Var_Hud.new
    @var_hud_window.x = XAIL::VAR_HUD::HUD[1]
    @var_hud_window.y = XAIL::VAR_HUD::HUD[2]
    @var_hud_window.z = XAIL::VAR_HUD::HUD[3]
    @var_hud_window.opacity = XAIL::VAR_HUD::HUD[4]
    @var_hud_window.windowskin = Cache.system(XAIL::VAR_HUD::HUD[5]) unless XAIL::VAR_HUD::HUD[5].nil?
  end
 
  alias xail_var_hud_window_update update
  def update(*args, &block)
    # // Method to update the var hud window on the map.
    xail_var_hud_window_update(*args, &block)
    @var_hud_window.visible = $game_switches[XAIL::VAR_HUD::VAR_HUD_SWITCH]
  end
 
end # END OF FILE
 
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#

 


I Would Prefer Bars but Percents are fine.

Edited by Kalebtbacon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.