10-04-2005, 01:00 PM
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.
No support is given. If you are the owner of the thread, please contact administration.
Credits
Anaxim, for requesting
Namco tales studio, for original system
Enterbrain, for making this possible
DubeAlex, for his tutorials
My family, for support^-^...yeah right...
Namco tales studio, for original system
Enterbrain, for making this possible
DubeAlex, for his tutorials
My family, for support^-^...yeah right...
script
Code:
#Jimme Reashu's ToP Food system
#You should know a bit about scripting before implementing this. Because you have to add some stuff
#to other scripts that are to big to alias and chances are you ahve modified them alot, well, maybe not
#Scene_Map, but Scene_Menu at least.
#If you want the food window to show up add
#@food_window=Window_Food.new among the rest of them in either scene_map, scene_menu or
#scene_item (or any two of them, ot all of them)
#The same for @food_window.dispose among the rest of the disposes. And @food_window.update
#with the rest of the updates. You're set with the scripting part.
#To use it, make an item with Attribute number 17(you'll have to make it) and make it's target "none"
#The recover hp (not the % one) is the amount your food amount will increase with.
#You can change 17 in the script at line 76
#Every two steps you'll recover 5 hp, and the screen will flash green, you'll lose food according to the
#number of heroes who eat. The number of steps can be changed at line 124, the hp at 147 and the
#flash at line 155
#To add food without the items, use
#$game_party.add_food(how_much_food_you_want_the_player_to_get)
#To check how much food the player has use
#$game_party.food_count
#The player can only have 500 units of food, change it at line 165
#If you know any scripting at all you should be able to fix this so it's modifiable in-game, I just didn't
#see it as a necessity.
class Window_Food < Window_Base
def initialize
super(16, 416, 124, 56)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"#the font type
self.contents.font.size = 22#the font size
self.opacity=124#255 is opaque, 0 is transparent
refresh
end
def refresh
self.contents.clear
bitmap = RPG::Cache.icon("041-Item10")#the name of the icon to display
self.contents.blt(4, 0, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.font.color = normal_color#the color you want the food text to have
self.contents.draw_text(32, 0, 60, 24, $game_party.food_count.to_s, 2)
end
def update
super
refresh
end
end
#Don't touch much of htis section...
class Scene_Item
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
#==========================
#This is the element that food items should have.
if @item.element_set.include?(17)
#==========================
$game_party.add_food(@item.recover_hp)
if @item.scope == 0
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
end
end
if @item.scope >= 3
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
$scene = Scene_Map.new
return
end
end
return
end
end
end
class Game_Player
def increase_steps
super
unless @move_route_forcing
# 歩数増加
$game_party.increase_steps
if $game_party.steps % 2 == 0
$game_party.check_map_slip_damage
end
#==========================
#This is how many steps between each "meal"
if $game_party.steps % 2 == 0
#==========================
$game_party.check_food
end
end
end
end
class Game_Party
def check_food
@food=0 if @food==nil
numb=0
for actor in @actors
if actor.hp != 0 and actor.hp != actor.maxhp
numb+=1
end
end
if @food>=numb
@food -= numb
for actor in @actors
if actor.hp != 0
#==========================
#This adds the hp, number 5 is what you might want to change
actor.hp = [actor.hp+5, actor.maxhp].min
#==========================
end
end
if numb != 0
#==========================
#This is the flash, you'll probably remove it, but I put it in just incase
#To remove it type a # at the beginning of the line
$game_screen.start_flash(Color.new(0,255,0,50), 4)
#==========================
end
end
end
def add_food(numb)
@food=0 if @food==nil
#==========================
#This is what tells the game the maximum food amount
#500 is what should be changed
@food=[@food+numb,500].min
#==========================
end
def food_count
return @food
end
end
#You may remove any comments except the very top one.
instructions
RTFM! It's in the script...
What it does
This script lets the player recover 5 hp(changeable) every two(changeable) steps as long as they have 1 food unit(changeable, but there are no instructions) per living, damaged character. It includes a window, but it is not implemented in any script so that's whyyou need to know a bit scripting, albeit very basic. If you don't know it the script probably expalins well enough anyways. It's not hard to implement so check it out...