Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Hunger with Huds
RD12
post Dec 30 2012, 06:30 AM
Post #1



Group Icon

Group: Member
Posts: 2
Type: Scripter
RM Skill: Skilled
Rev Points: 5




Hunger with Huds


Compatibility: Just RMVxACE
How to use: paste it in the scripts sections

Resume:
Set the time to increase hunger;
Set value that hunger increases for each actors;
Create items that reduce or increase hunger;
Hud for all Characters (Actors);
Hud simple and small to not pollute the screen;
Character dies when hunger reaches 100.

Screens



Huds in Screen(Last Actor died)

Increased Hunger, Hunger Current(Translated)


Script


CODE
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#                             Hunger for Actors              
#|Autor: RD12|          
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# The hunger will 0-100.
# If fome arrive in 100, the actor dies
#
# For an item decreases hunger, insert in your Nota: -huger value
# Increases: +huger value

module Fome
  #Time that decreases hunger
  Segundos = 5
  #Value that will increase the hunger
  Actor = []#Var Initialization
  Actor[0] = 9 #First Actor
  Actor[1] = 6 #Second
  Actor[2] = 4 #Third
  Actor[3] = 11#Fourth
  #Actor[4] = 11#Fifth
  
  #Hud Position
  HUDs_x = 1
  HUDs_y = 190
end

#===============================================================================
#Hud da fome dos jogadores
class Hud_Fome < Sprite
  def initialize
    super
    self.bitmap = bitmap = Bitmap.new(100,300)
    self.bitmap.font.size = 14
    self.bitmap.font.name = "Segoe UI"
    self.x = Fome::HUDs_x
    self.y = Fome::HUDs_y
    refresh
  end
    
  def update
    super
    refresh
  end
  
  def refresh
    self.bitmap.clear
    for i in 0..$game_party.members.size-1
      @actor = $game_party.members
      base = Cache.picture("Fome_Base")
      rect = Rect.new(0,0,base.width,base.height)
      self.bitmap.blt(10,21+30*i,base,rect)
      self.bitmap.draw_text(10, 30*i, 100, 32, @actor[i].name, 0)
      if @actor[i].fome >= 100
         @actor[i].hp = 0
         hud_name = "Fome_100"
       else
         hud_name = "Fome_Hud"
      end
      base = Cache.picture(hud_name)
      rect = Rect.new(0,0,base.width * @actor[i].fome / 100,base.height)
      self.bitmap.blt(10,21+30*i,base,rect)
     end  
  end
end

#===============================================================================
#Atualiza a Hud e Aumenta a fome de acordo com o tempo configurado
class Scene_Map
  alias rd12_main main
  def main
    $Fome = Hud_Fome.new
    @segundos = 0
    rd12_main
    $Fome.dispose
  end
  alias rd12_update update
  def update
    if Graphics.frame_count % 60 == 0
      @segundos += 1
    end
    if @segundos == Fome::Segundos
     for i in 0..$game_party.members.size-1
      $game_party.members[i].fome = (Fome::Actor[i])
     end  
    @segundos = 0
    end
    rd12_update
  end
end

#===============================================================================
#Adiciona a fome nos personagens
class Game_Actor < Game_Battler
  alias rd12_initialize initialize
  def initialize(actor_id)
    @fome = 0
    rd12_initialize(actor_id)
  end
  
  def fome=(arg)
   @fome = 0 if @fome == nil
   @fome += arg
   @fome = 0 if @fome < 0
   $Fome.refresh
  end
  
  def fome
   @fome
  end
end

#===============================================================================
#Modifica o m�ƒ©todo para poder usar o item de fome
class Game_Battler < Game_BattlerBase
  def item_test(user, item)
    return false if item.for_dead_friend? != dead?
    return true if $game_party.in_battle
    return true if item.for_opponent?
    return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
    return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
    return true if item_has_any_valid_effects?(user, item)
    arg = item.note.split
    return true if arg[0] == "-fome" or arg[0] == "+fome"
    return false
end
end

#===============================================================================
#Modifica o m�ƒ©todo para ganhar ou perder Fome
class Scene_Item < Scene_ItemBase
  def use_item_to_actors
    item_target_actors.each do |target|
      arg = item.note.split
      if arg[0] == "-hunger"
        target.fome = -arg[1].to_i
        #Mostra mensagem com a fome atual
        msgbox("Hunger decreases in -#{arg[1]}\n","Hunger current: #{target.fome}/100")
      end
      if arg[0] == "+hunger"
        target.fome = arg[1].to_i
        #Mostra mensagem com a fome atual
        msgbox("Hunger increases in +#{arg[1]}\n","Hunger current: #{target.fome}/100")
      end
      item.repeats.times { target.item_apply(user, item) }
    end
  end
end
#===============================================================================


Pictures
Place in the folder picture
> http://i.imgur.com/Y9VWt.png
Name: Fome_Base
> http://i.imgur.com/HOlyh.png
Name: Fome_Hud
> http://i.imgur.com/5Wtfn.png
Name: Fome_100

Instructions:
1. To set the HUD position, modify these lines:
CODE
HUDs_x = 1
HUDs_y = 190

Replace 1 with the desired X and 190 with the desired Y.

2. To create an item which modifies hunger, write whether +hunger value or -hunger value in the item's notes, where value must be replaced with the amount of hunger that item will increase or decrease respectively.

3. To set the time interval from an hunger's increase to the following one, modify this line:
CODE
Segundos = 5
Replace 5 with the number of seconds which should pass between two increases.

4. To set how much hunger will increase each time interval, modify these values:
CODE
Actor[0] = 9 #First Actor
  Actor[1] = 6 #Second
  Actor[2] = 4 #Third
  Actor[3] = 11#Fourth

Replace 9 with the hunger increment intended for the first party member, 4 with the hunger increment for the second party member and so on.


I'm don't speak english very well. I'm learning English.

Credits

Script by Lucas RD12
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Jan 2 2013, 09:40 AM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




I'm sorry but there's a template to follow in order to submit a script.
It's all made by yourself? If not, remember to credit your sources.
Please, add some info like known issues, compatibility issues (if there are any) and installation instructions (if you just have to paste it in the materials sections, just write a line about that).


Anyway, good idea and nice script. In my opinion you should give the option to move the HUD in a different position and make a window appear to show how much hunger is decreased instead of showing the system messagebox.

Jens


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
RD12
post Jan 3 2013, 06:05 AM
Post #3



Group Icon

Group: Member
Posts: 2
Type: Scripter
RM Skill: Skilled
Rev Points: 5




Sorry, I didn't know.
And all is made by I.(The image is in Portuguese because I'm Brazilian)

To change Hud position, see the script:
#Hud Position
HUDs_x = 1
HUDs_y = 190
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Jan 4 2013, 03:07 AM
Post #4


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




I've edited your post a bit in order to remove a format error in the codebox and to add proper instructions.
BTW, now the OP is updated and your submission is OK smile.gif

For future submissions: remember to follow these rules:

Rules
When posting a script that you did not write, make sure the author is okay with you doing so. Also, include the author's name somewhere early in your post. It is very important to direct credit (or blame) for the script in the correct direction to avoid the appearance of plagiarism.

It is encouraged that when posting moderately complicated scripts to include a demo illustrating how the script may be set up. We also encourage you to post screenshots when possible, and detailed instructions.

If you're not going to support a script or have stopped actively developing it (fixing bugs, etc), we'd appreciate it if you said so in your first post.

When posting a script, please use the following template, or something similar:


<Title>
<Version>
<Author(s)>


Information:

<Information about the script. what it does/does not do.>

Screenshots:

For screenshots, please use minimize or spoiler tags!
[ minimize ] image url [ / minimize ]
[ spoiler ] image url [ / spoiler ]

Instructions:

<Detailed instructions informing how to set up and use the script.>

Demo Link:

<http://yourdemolink> We encourage the use of demos when providing moderately complex scripts, especially those requiring database or graphical setup. We provide script/script-demo hosting here.

Compatibility:

<Any compatibility problems you know of.>

Author's Notes:

<Anything you want to say about the script or about changes from version to version.>


As regards the HUD position, I'm quite an idiot since I haven't seen it though it actually was in the script itself sad.gif
For any doubt about submissions, just ask or PM me.

Just a note about the script: you should assign the Actor[i] increments to the actors in the database and not in the party.
In that case, if I have a prty of four elements and I switch the party order, the new first party member's hunger will increase as the former party leader's.

Jens

This post has been edited by Jens of Zanicuud: Jan 4 2013, 03:21 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 07:19 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker