Water Supply Script Ver. 1.1 - GoldenShadow - 09-03-2005
Water Supply Script Ver. 1.1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
What is it?
If you played Breath of Fire 3, think of the Desert of Death.
You walk in a desert, with water supplies. Each 10 steps (can be modified)
will lose 1 water supply item.
If all the water supplies are out, you start to lose HP (you're thirsty you know).
Do You THINK I have use for this? Well do ya, Punk?!
I have no idea if you're going to use it. Frankly, I don't care.
And I expect that a few people will use this. Luckily, I am a very
giving person who doesn't like to keep projects and scripts secret/private.
So here it is. I hope you don't behave like X-RPG folks.
attr_accessor :water_item_id # for use out of the class
attr_accessor :water_reduce_hp # same here
def initialize # initialize all variables we're gonna need
@water_item_id = 1 # item ID that represents the water supply
@water_reduce_hp = 2 # hp to be lost from when items = 0
end
def remove_water # this is for removing the water
if $game_party.item_number(@water_item_id) > 0 # it removes items if its > 0 (larger than)
$game_party.lose_item(@water_item_id, 1) # this is to remove but 1 item
else # if items = 0...
for i in 0...$game_party.actors.size # gets everyone of party
@actor = $game_party.actors[i] # makes them ready for...
@actor.hp -= @water_reduce_hp # ...losing hp
end
$game_screen.start_flash(Color.new(0, 0, 255), 5) # flash the screen blue on hp loss
end
end
end
# This window is kinda weird. Some of my beta testers reported the text won't show properly.
# Yet others report a good view. Maybe it's the font or resolution? I don't know...
class Window_Supply < Window_Base
# window for the supply to show
def initialize
super(16, 16, 364, 44)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize - 8
refresh
end
def refresh # yeah this is self explaining
self.contents.clear
self.contents.draw_text(4, -10, self.width - 40, 32, "Water Supply")
@supply = $game_party.item_number($water.water_item_id) * 2
self.contents.draw_text(300, -10, self.width - 40, 32, "#{@supply / 2} left")
if (@supply / 2) >= 50 # change color if its larger than 50
@color = Color.new(0, 0, 255) # to blue
elsif (@supply / 2) >= 25 and (@supply / 2) < 50 # lless than 50 but more than 25
@color = Color.new(255, 128, 0) # to orange
elsif (@supply / 2) < 25 # less than 25
@color = Color.new(255, 0, 0) # to red (critical)
end
if (@supply / 2) > 0 # unless items are 0
rect = Rect.new(84, 3, @supply, 6) # show a bar
self.contents.fill_rect(rect, @color) # Modify the color as pleased
else # if you're out of water supply, HP losing will start
self.contents.draw_text(84, -10, self.width - 40, 32, "OUT OF WATER! Party is losing #{$water.water_reduce_hp}
HP!")
end
end
end
class Scene_WaterSupply
# the scene for all the above
def main
$water = Water_Supply.new # init the variable
@spriteset = Spriteset_Map.new # map init
@steps = $game_party.steps # setup steps
@steps_count = 0 # counter
@supply = Window_Supply.new # the window
@message_window = Window_Message.new
Graphics.transition # transing it, so it updates
loop do
Graphics.update
Input.update
update # updating the stuff, see def update
if $scene != self
break
end
end
Graphics.freeze # when closing, freeze it all first
@spriteset.dispose
@supply.dispose
@message_window.dispose
end
def update # well, self explain: updates everything
@spriteset.update
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
@supply.update
@message_window.update
if $game_temp.gameover
# If player dies, it will be gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
# Going to title screen (F12 or something)
$scene = Scene_Title.new
return
end
if $game_temp.message_window_showing
return
end
check_steps # ...check steps...duh
end
def check_steps # this is important def.
if @steps_count >= 10 # if 10 or more steps were made
$water.remove_water # remove supply/HP
@supply.refresh # refresh the window
@steps_count = 0 # and reset counter again
else # if less than 10,
if @steps != $game_party.steps # if these are not the same (you did steps)
@steps = $game_party.steps # then it sets it the same again
@steps_count += 1 # but adding one step to counter
end
end
end
end
# FINAL UPDATE: 21 August 2005 @ 13:36 CET
# SEMI UPDATE: 2 February 2007 - Fixed errors
As you see, this is one heck of a simple and short script ever.
And yes, I'm sorry I didn't post this earlier. The reason behind it is,
this was originally for a project of mine, Breath of Fire Dragon's Path.
We (Squall789 and I) had a discussion on whether I'd post this or not.
At first we came to a conclusion that I wouldn't post it, but since
the project is practicly On Hold at the moment, I won't hold back and just
post the damn thing. I will mod it anyway for the project... as expected.
Anyway, at the moment it still looks odd. With the windows and all, but
pretty soon I'm going to make a Menu support and such.
Also the window will be gone and the icon of the water supply item will
be shown with the quantity next to it. You'll see.
As for now, you'll have to deal with this. It's all I got, unless Nick fucks with it,
then we have another problem. That kid got a serious problem...
He tends to mutate my script into something I never seen before...
Nick... if you read this: I dare ya.
Tell me what you think and find of this script. All comments are welcome.
And for this once, I also accept flame posts....