Jump to content

Recommended Posts

You skipped step 1, you'll want to put that event into "common events" in your database. Common events can happen anywhere in game, once triggered, they aren't tied to a single map.

Edited by halrawk

Share this post


Link to post
Share on other sites

Actually I found this works best :

 

---

 

1. In "Database", create a "Common Event" called "Apple".

2. In the "content" of this event, open up the "Event Commands" (double clicking a line) and go to the 3rd tab.

3. Under "Advanced", click on "Script".

4. Copy and paste "$survival_v[2] += 20" into the textbox. This means that whenever this function is called, it will add 20 to the value of the food bar.

5. Now go to "Items" and create an "Apple" item.

6. Set the price, description etc to your liking.

7. In the right side of the menu, under "Effects", double click on a space.

8. Under "Other" tab, click on "Common Event" and select the "Apple" you just created in the previous steps.

9. Repeat steps 1-8 changing "Apple" to "Milk" and "v[2]" to "v[3]" to affect your water bar instead.

 

---

Edited by Nightgazer Starlight
  • Like 1

Share this post


Link to post
Share on other sites

nvm my last 2 post i figured it out but now I'm getting a new error and must have something to do with the event i made that turns the script on, i think i may of made the event wrong and everything works well until i try to eat or drink the items i made for this script.

The error is > Script 'Game_Interpreter' line 1411: SyntaxError

Heres a pic of the error and event i made to turn on the script
post-60229-0-21460800-1445918308_thumb.jpg

and other things I've done
post-60229-0-80709600-1445918498_thumb.jpg
post-60229-0-62137500-1445918497_thumb.jpg
post-60229-0-50770300-1445918495_thumb.jpg



i figured it out, i stupidly had @>Script: Script: $survival_v[3] +=15 in the common event, i must of copied the extra Script in by mistake

Edited by Rikifive
Merged double post

Share this post


Link to post
Share on other sites

@kaarnij I have merged your posts. Please avoid double posting unless it's absolutely necessary. Thank you. (=

 

@MoonShadow

Menu and outside-the-menu are two different scenes, so you have to draw the window again in the Map scene (outside the menu)

 

Try this:

 

 

class Scene_Map < Scene_Base
  alias :start_up :start
    def start
    start_up
    create_survival_window
  end
  
  def create_survival_window
    barcount = 0
    if $survival_s[1] == true
      barcount += 1 if $survival_s[6] == false || $survival_v[1] < Anyx::LIFEHIDEVAL
    end # if $survival_s[1] == true
    if $survival_s[2] == true
      barcount += 1 if $survival_s[7] == false || $survival_v[2] < Anyx::FOODHIDEVAL
    end # if $survival_s[2] == true
    if $survival_s[3] == true
      barcount += 1 if $survival_s[8] == false || $survival_v[3] < Anyx::WATERHIDEVAL
    end # if $survival_s[3] == true
    if $survival_s[4] == true
      barcount += 1 if $survival_s[9] == false || $survival_v[4] < Anyx::RESTHIDEVAL
    end # if $survival_s[4] == true
    if $survival_s[5] == true
      barcount += 1 if $survival_s[10] == false || $survival_v[5] > Anyx::TOXINHIDEVAL
    end # if $survival_s[5] == true
    @survival_window = Window_Survival.new
    @survival_window.contents.draw_text(0, 0, 500, 24, " Survival System") if barcount == 0
    barcount -= 1 if barcount >= 1
    survivalwinypos = Anyx::WINYPOS - (24 * barcount)
    @survival_window.x = Anyx::WINXPOS
    @survival_window.y = survivalwinypos
    @survival_window.opacity = Anyx::WINOPACITY
  end # def create_survival_window
end # class Scene_Map < Scene_Base

 

 

Paste below the Survival Script.

Share this post


Link to post
Share on other sites

@MoonShadow


Menu and outside-the-menu are two different scenes, so you have to draw the window again in the Map scene (outside the menu)

 

Try this:

 

 

class Scene_Map < Scene_Base
  alias :start_up :start
    def start
    start_up
    create_survival_window
  end
  
  def create_survival_window
    barcount = 0
    if $survival_s[1] == true
      barcount += 1 if $survival_s[6] == false || $survival_v[1] < Anyx::LIFEHIDEVAL
    end # if $survival_s[1] == true
    if $survival_s[2] == true
      barcount += 1 if $survival_s[7] == false || $survival_v[2] < Anyx::FOODHIDEVAL
    end # if $survival_s[2] == true
    if $survival_s[3] == true
      barcount += 1 if $survival_s[8] == false || $survival_v[3] < Anyx::WATERHIDEVAL
    end # if $survival_s[3] == true
    if $survival_s[4] == true
      barcount += 1 if $survival_s[9] == false || $survival_v[4] < Anyx::RESTHIDEVAL
    end # if $survival_s[4] == true
    if $survival_s[5] == true
      barcount += 1 if $survival_s[10] == false || $survival_v[5] > Anyx::TOXINHIDEVAL
    end # if $survival_s[5] == true
    @survival_window = Window_Survival.new
    @survival_window.contents.draw_text(0, 0, 500, 24, " Survival System") if barcount == 0
    barcount -= 1 if barcount >= 1
    survivalwinypos = Anyx::WINYPOS - (24 * barcount)
    @survival_window.x = Anyx::WINXPOS
    @survival_window.y = survivalwinypos
    @survival_window.opacity = Anyx::WINOPACITY
  end # def create_survival_window
end # class Scene_Map < Scene_Base

 

 

Paste below the Survival Script.

 

It works ok but updates only if I open the menu.

 

Share this post


Link to post
Share on other sites

I'm really not sure how the script/window will react to this, since I didn't make that script and I'm not exactly sure how it was written, so test that and tell me what happens.

The window will be refreshed each 2 seconds.

 

 

class Scene_Map < Scene_Base
  alias :start_up :start
    def start
    start_up
    create_survival_window
  end
  
  def create_survival_window
    barcount = 0
    if $survival_s[1] == true
      barcount += 1 if $survival_s[6] == false || $survival_v[1] < Anyx::LIFEHIDEVAL
    end # if $survival_s[1] == true
    if $survival_s[2] == true
      barcount += 1 if $survival_s[7] == false || $survival_v[2] < Anyx::FOODHIDEVAL
    end # if $survival_s[2] == true
    if $survival_s[3] == true
      barcount += 1 if $survival_s[8] == false || $survival_v[3] < Anyx::WATERHIDEVAL
    end # if $survival_s[3] == true
    if $survival_s[4] == true
      barcount += 1 if $survival_s[9] == false || $survival_v[4] < Anyx::RESTHIDEVAL
    end # if $survival_s[4] == true
    if $survival_s[5] == true
      barcount += 1 if $survival_s[10] == false || $survival_v[5] > Anyx::TOXINHIDEVAL
    end # if $survival_s[5] == true
    @survival_window = Window_Survival.new
    @survival_window.contents.draw_text(0, 0, 500, 24, " Survival System") if barcount == 0
    barcount -= 1 if barcount >= 1
    survivalwinypos = Anyx::WINYPOS - (24 * barcount)
    @survival_window.x = Anyx::WINXPOS
    @survival_window.y = survivalwinypos
    @survival_window.opacity = Anyx::WINOPACITY
    
    @refresh_timer = 120
  end # def create_survival_window
  
  alias :map_update_up :update
  def update
    map_update_up
    @refresh_timer = @refresh_timer > 0 ? @refresh_timer - 1 : 120
    @survival_window.refresh if @refresh_timer == 0
  end
  
end # class Scene_Map < Scene_Base

 

 

Replace the previous snippet I gave you.

Share this post


Link to post
Share on other sites

Glad could help! (=

 

If you want to make the window update faster, then change two values:

(...)

  @refresh_timer = 120 <<< THIS /\/\/\/\/\/\/\\/\/\/\/\/\/\/\\/\//\\/\/\/
  end # def create_survival_window
  
  alias :map_update_up :update
  def update
    map_update_up
    @refresh_timer = @refresh_timer > 0 ? @refresh_timer - 1 : 120 <<< AND THIS \//\/\/\/\/\//\\/\/\/
    @survival_window.refresh if @refresh_timer == 0
  end
  

120 is 120 frames ~ game runs at 60 FPS (unless it runs horrible on some PC's ( ͡° ͜ʖ ͡°)) so it gives 2 seconds.

Replace these two to for example 30 and it will update the window each 0.5 second.

Good luck! (=

  • Like 1

Share this post


Link to post
Share on other sites

What exactly do you mean?

Turning off the display or generally disabling it?

Share this post


Link to post
Share on other sites

I'm really not sure and can't test, since I don't have prepared things, but try this and tell me what happens.

(Paste below scripts)

class Game_Player < Game_Character

  def dash?
    return false if @move_route_forcing
    return false if $game_map.disable_dash?
    return false if vehicle
    return Input.press?(:A) && $survival_v[2] >= 50 && $survival_v[3] >= 50
  end

end
  • Like 1

Share this post


Link to post
Share on other sites

YAY! Glad could help! =3

 

You can edit these:

 && $survival_v[2] >= 50 && $survival_v[3] >= 50

[2] is food and [3] is water.

They are listed here (in the survival script):

 

 

  def self.create_survival_commands
    $survival_v       =   Survival_Variables.new
    $survival_s       =   Survival_Switches.new
    $survival_v[1]    =   LIFEINIT
    $survival_v[6]    =   LIFERATE
    $survival_s[1]    =   LIFEENABLE
    $survival_s[6]    =   LIFEHIDE
    $survival_v[2]    =   FOODINIT # this line
    $survival_v[7]    =   FOODRATE
    $survival_s[2]    =   FOODENABLE
    $survival_s[7]    =   FOODHIDE
    $survival_v[3]    =   WATERINIT # and that line
    $survival_v[8]    =   WATERRATE
    $survival_s[3]    =   WATERENABLE
    $survival_s[8]    =   WATERHIDE
    $survival_v[4]    =   RESTINIT
    $survival_v[9]    =   RESTRATE
    $survival_s[4]    =   RESTENABLE
    $survival_s[9]    =   RESTHIDE
    $survival_v[5]    =   TOXININIT
    $survival_v[10]   =   TOXINRATE
    $survival_s[5]    =   TOXINENABLE
    $survival_s[10]   =   TOXINHIDE
  end # def self.create_survival_commands

 

 

 

You can change the values (50) to other to fit your needs. (=

  • Like 1

Share this post


Link to post
Share on other sites

Hello, im just curious if it is possible to put the "Survival window" on the main screen and not on main menu, i know i can adjust the position on the menu but i would prefer to have it on main screen.

 

Thank you.

 

 

Nevermind, there is an answer to it on other reply. sorry

 

 

 

 

Most scripts are not "plug and play" especially if it's gameplay related.

 

Are you sure you did step 10-12 properly? THAT is how you ACTIVATE the script. Probably the only way...

 

Uh...I forgot to mention something very important. When you customize any event, MAKE SURE you check the "Trigger". Set it to "Parallel Process". Default is "Action Button". I shall edit that post now. I think this is what you're missing.

 

Oh and, I've fixed the problem I had (where if the value reached the "exceed" value, it stops working). It's a simple if statement if anyone wants it. Just have to know where to put it lol. I *can* post a script but since it's not mine, there are copyright problems so...yea.......

Hi, im having same issue when i exceed food value, did you make a conditional branch in common events("apple effect") ? that you can only replenish food if youre food is >=99 ? Edited by Rikifive
Merged double post

Share this post


Link to post
Share on other sites

Rikifive thank you so much for the support you've given to this thread, I've been following it for quite some time and you're really helping quite a lot.

  • Like 1

Share this post


Link to post
Share on other sites

hello, if I use the script for food and water for example. $survival_v[2] =+100 and I already 40% my hunger bar will reach 140%. How do I get her up to 100% even using values that surpass it?

Share this post


Link to post
Share on other sites

Do you mean not getting past the limit?

 

Then try this:

$survival_v[2] = [($survival_v[2] + 100),100].min
  • Like 1

Share this post


Link to post
Share on other sites

as you can do to pop up the values of hunger, thirst and rest in a game when down below 15?

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.

×
Top ArrowTop Arrow Highlighted